{"id":22963572,"url":"https://github.com/mj23978/typegraphql-orm","last_synced_at":"2025-08-03T04:04:47.993Z","repository":{"id":138143852,"uuid":"437427566","full_name":"Mj23978/typegraphql-orm","owner":"Mj23978","description":"This Cli Tool Create TypeGraphQL Crud Resolvers and Orm Classes and Functions from Speacial TS Files","archived":false,"fork":false,"pushed_at":"2021-12-12T01:33:37.000Z","size":162,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T03:45:49.370Z","etag":null,"topics":["oclif","orm","ts-morph","typegraphql"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mj23978.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-12T01:33:24.000Z","updated_at":"2021-12-12T01:35:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"91cf5922-2ee9-4865-b0e5-107d8fbbf09d","html_url":"https://github.com/Mj23978/typegraphql-orm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Mj23978/typegraphql-orm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mj23978%2Ftypegraphql-orm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mj23978%2Ftypegraphql-orm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mj23978%2Ftypegraphql-orm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mj23978%2Ftypegraphql-orm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mj23978","download_url":"https://codeload.github.com/Mj23978/typegraphql-orm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mj23978%2Ftypegraphql-orm/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268492035,"owners_count":24258747,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-03T02:00:12.545Z","response_time":2577,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["oclif","orm","ts-morph","typegraphql"],"created_at":"2024-12-14T19:36:10.236Z","updated_at":"2025-08-03T04:04:47.938Z","avatar_url":"https://github.com/Mj23978.png","language":"TypeScript","readme":"# TypeGraphQL + Any Orm !!\n\nThis Repo is a Cli that Creates Models and Crud Resolvers for orm and typegraphql stack \n(currently typeorm and mikroorm)\n\n## Installation\n\nFist of all, you have to install the generator, as a dev dependency:\n\n```sh\nnpm i -D @mj23978/simple-generator\n```\n\nFurthermore, `simple-generator`  requires Typegraphql \u0026 Typeorm to work properly, so please install Prisma dependencies if you don't have it already installed:\n\nYou also need to install the GraphQL JSON scalar library (to support the Prisma `Json` scalar):\n\n```sh\nnpm i graphql-type-json\n```\n\nas well as the `graphql-fields` that is used to properly support the aggregations queries:\n\n```sh\nnpm i graphql-fields @types/graphql-fields\n```\n\n## Usage\n\nGiven that you have this part of datamodel definitions:\n\n```typescript\n@Tog({\n  id: true,\n  createdAt: true,\n  updatedAt: true,\n  middlewares: {\n    create: [\"Authenticate\", \"Authorize([Role.Customer])\"],\n    delete: [\"Authenticate\", \"Authorize([Role.Customer])\"],\n    deleteMany: [\"Authenticate\", \"Authorize([Role.Customer])\"],\n    findMany: [\"Authenticate\", \"Authorize([Role.Customer])\"],\n    findUnique: [\"Authenticate\", \"Authorize([Role.Customer])\"],\n    update: [\"Authenticate\", \"Authorize([Role.Customer])\"],\n    updateMany: [\"Authenticate\", \"Authorize([Role.Customer])\"],\n  },\n})\nexport class TogPost {\n  @MinLength(4)\n  @MaxLength(100)\n  @TogField()\n  title: string;\n\n  @MinLength(2)\n  @MaxLength(75)\n  @TogField()\n  description?: string;\n  \n  @TogField()\n  text?: string;\n\n  @TogField()\n  textJson?: JsonValue;\n\n  @TogField({type: \"embedded\"})\n  metadata?: TogMetadata[];\n\n  @TogField({type: \"embedded\"})\n  privateMetadata?: TogMetadata[];\n\n  @TogRelationField({\n    model: \"User\",\n    modelField: \"posts\",\n    type: \"m2o\",\n  })\n  user: TogUser;\n}\n```\n\nIt will generate a `User` class in the output folder, with TypeGraphQL decorators, and an enum - you can import them and use normally as a type or an explicit type in your resolvers:\n\n```ts\nexport enum PostKind {\n  BLOG = \"BLOG\",\n  ADVERT = \"ADVERT\",\n}\nTypeGraphQL.registerEnumType(PostKind, {\n  name: \"PostKind\",\n  description: undefined,\n});\n\n@TypeGraphQL.ObjectType({\n  isAbstract: true,\n  description: undefined,\n})\nexport class Post {\n  @TypeGraphQL.Field(_type =\u003e String, {\n    nullable: false,\n    description: undefined,\n  })\n  id!: string;\n\n  @TypeGraphQL.Field(_type =\u003e String, {\n    nullable: false,\n    description: undefined,\n  })\n  email!: string;\n\n  @TypeGraphQL.Field(_type =\u003e String, {\n    nullable: true,\n    description: undefined,\n  })\n  name?: string | null;\n\n  posts?: Post[] | null;\n}\n```\n\n- findOne\n- create\n- update\n- delete\n- findMany\n- updateMany\n- deleteMany\n\nBy default, the method names will be mapped to a GraphQL idiomatic ones (like `findManyPost` -\u003e `posts`).\nYou can opt-in to use original names by providing `useOriginalMapping = true` generator option.\n\nAlso, if you want to have relations like `User -\u003e posts` emitted in schema, you need to import the relations resolvers and register them in your `buildSchema` call:\n\n```ts\nimport {\n  User,\n  UserRelationsResolver,\n  UserCrudResolver,\n} from \"@generated/type-graphql\";\n\nconst schema = await buildSchema({\n  resolvers: [CustomUserResolver, UserRelationsResolver, UserCrudResolver],\n  validate: false,\n});\n```\n\nAll generated CRUD and relations resolvers fully support this feature and they map under the hood the original prisma property to the renamed field exposed in schema.\n\nThe same goes to the resolvers input types - they will also be emitted with changed field name, e.g.:\n\n```graphql\ninput UserCreateInput {\n  emailAddress: String!\n  posts: PostCreateManyWithoutAuthorInput\n}\n```\n\nThe emitted input type classes automatically map the provided renamed field values from GraphQL query into proper Prisma input properties out of the box.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmj23978%2Ftypegraphql-orm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmj23978%2Ftypegraphql-orm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmj23978%2Ftypegraphql-orm/lists"}