-
Notifications
You must be signed in to change notification settings - Fork 0
Intelligent Setup System with Comprehensive Validation & Documentation #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e4691e1
50bec49
60648c9
54e3da8
c4d3627
b09e780
156f2b5
083c926
d5cc2da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Todo API (Generated with Z.ai GLM-4.6) | ||
|
|
||
| ## Features | ||
| - User authentication | ||
| - Todo CRUD operations | ||
| - PostgreSQL + Prisma | ||
| - NestJS framework | ||
|
|
||
| ## Files | ||
| - schema.prisma - Database schema | ||
| - openapi.yaml - API specification | ||
| - todo.controller.ts - NestJS controller | ||
| - todo.service.ts - Business logic | ||
|
|
||
| ## Generated by | ||
| - Model: glm-4.6 | ||
| - Provider: Z.ai |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,321 @@ | ||
| ```yaml | ||
| openapi: 3.0.0 | ||
| info: | ||
| title: Todo API | ||
| description: A simple API for managing a list of todos with user authentication. | ||
| version: 1.0.0 | ||
| servers: | ||
| - url: https://api.example.com/v1 | ||
| description: Production Server | ||
| paths: | ||
| /auth/register: | ||
| post: | ||
| summary: Register a new user | ||
| description: Creates a new user account. | ||
| tags: | ||
| - Authentication | ||
| requestBody: | ||
| required: true | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| required: | ||
| - username | ||
| - password | ||
| properties: | ||
| username: | ||
| type: string | ||
| example: johndoe | ||
| password: | ||
| type: string | ||
| format: password | ||
| example: a_strong_password | ||
| responses: | ||
| '201': | ||
| description: User registered successfully | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| properties: | ||
| message: | ||
| type: string | ||
| example: User created successfully | ||
| '400': | ||
| description: Invalid input provided | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/Error' | ||
| '409': | ||
| description: Username already exists | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/Error' | ||
|
|
||
| /auth/login: | ||
| post: | ||
| summary: Login user | ||
| description: Authenticates a user and returns a JWT token. | ||
| tags: | ||
| - Authentication | ||
| requestBody: | ||
| required: true | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| required: | ||
| - username | ||
| - password | ||
| properties: | ||
| username: | ||
| type: string | ||
| example: johndoe | ||
| password: | ||
| type: string | ||
| format: password | ||
| example: a_strong_password | ||
| responses: | ||
| '200': | ||
| description: Login successful | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| properties: | ||
| accessToken: | ||
| type: string | ||
| example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... | ||
| '401': | ||
| description: Invalid credentials | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/Error' | ||
|
|
||
| /todos: | ||
| get: | ||
| summary: List all todos | ||
| description: Retrieves a list of all todos for the authenticated user. | ||
| tags: | ||
| - Todos | ||
| security: | ||
| - BearerAuth: [] | ||
| responses: | ||
| '200': | ||
| description: A list of todos | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: array | ||
| items: | ||
| $ref: '#/components/schemas/Todo' | ||
| '401': | ||
| description: Unauthorized | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/Error' | ||
| post: | ||
| summary: Create a new todo | ||
| description: Adds a new todo to the list for the authenticated user. | ||
| tags: | ||
| - Todos | ||
| security: | ||
| - BearerAuth: [] | ||
| requestBody: | ||
| required: true | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| required: | ||
| - title | ||
| properties: | ||
| title: | ||
| type: string | ||
| example: Buy groceries | ||
| completed: | ||
| type: boolean | ||
| example: false | ||
| responses: | ||
| '201': | ||
| description: Todo created successfully | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/Todo' | ||
| '400': | ||
| description: Invalid input provided | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/Error' | ||
| '401': | ||
| description: Unauthorized | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/Error' | ||
|
|
||
| /todos/{id}: | ||
| get: | ||
| summary: Get a todo by ID | ||
| description: Fetches a single todo item for the authenticated user. | ||
| tags: | ||
| - Todos | ||
| security: | ||
| - BearerAuth: [] | ||
| parameters: | ||
| - name: id | ||
| in: path | ||
| required: true | ||
| schema: | ||
| type: integer | ||
| format: int64 | ||
| description: The ID of the todo to retrieve | ||
| responses: | ||
| '200': | ||
| description: Successful response | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/Todo' | ||
| '401': | ||
| description: Unauthorized | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/Error' | ||
| '404': | ||
| description: Todo not found | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/Error' | ||
| put: | ||
| summary: Update a todo | ||
| description: Updates an existing todo for the authenticated user. | ||
| tags: | ||
| - Todos | ||
| security: | ||
| - BearerAuth: [] | ||
| parameters: | ||
| - name: id | ||
| in: path | ||
| required: true | ||
| schema: | ||
| type: integer | ||
| format: int64 | ||
| description: The ID of the todo to update | ||
| requestBody: | ||
| required: true | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| properties: | ||
| title: | ||
| type: string | ||
| example: Buy groceries | ||
| completed: | ||
| type: boolean | ||
| example: true | ||
| responses: | ||
| '200': | ||
| description: Todo updated successfully | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/Todo' | ||
| '400': | ||
| description: Invalid input provided | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/Error' | ||
| '401': | ||
| description: Unauthorized | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/Error' | ||
| '404': | ||
| description: Todo not found | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/Error' | ||
| delete: | ||
| summary: Delete a todo | ||
| description: Deletes a todo item for the authenticated user. | ||
| tags: | ||
| - Todos | ||
| security: | ||
| - BearerAuth: [] | ||
| parameters: | ||
| - name: id | ||
| in: path | ||
| required: true | ||
| schema: | ||
| type: integer | ||
| format: int64 | ||
| description: The ID of the todo to delete | ||
| responses: | ||
| '204': | ||
| description: Todo deleted successfully | ||
| '401': | ||
| description: Unauthorized | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/Error' | ||
| '404': | ||
| description: Todo not found | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/Error' | ||
|
|
||
| components: | ||
| securitySchemes: | ||
| BearerAuth: | ||
| type: http | ||
| scheme: bearer | ||
| bearerFormat: JWT | ||
| schemas: | ||
| Todo: | ||
| type: object | ||
| properties: | ||
| id: | ||
| type: integer | ||
| format: int64 | ||
| readOnly: true | ||
| example: 1 | ||
| title: | ||
| type: string | ||
| example: Buy groceries | ||
| completed: | ||
| type: boolean | ||
| example: false | ||
| createdAt: | ||
| type: string | ||
| format: date-time | ||
| readOnly: true | ||
| updatedAt: | ||
| type: string | ||
| format: date-time | ||
| readOnly: true | ||
| Error: | ||
| type: object | ||
| properties: | ||
| error: | ||
| type: string | ||
| example: A human-readable error message | ||
| message: | ||
| type: string | ||
| example: A detailed message explaining the error | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "name": "todo-api-zai", | ||
| "version": "1.0.0", | ||
| "description": "Todo API generated with Z.ai GLM-4.6", | ||
| "scripts": { | ||
| "start": "nest start", | ||
| "start:dev": "nest start --watch", | ||
| "build": "nest build" | ||
| }, | ||
| "dependencies": { | ||
| "@nestjs/common": "^10.0.0", | ||
| "@nestjs/core": "^10.0.0", | ||
| "@nestjs/platform-express": "^10.0.0", | ||
| "@nestjs/jwt": "^10.0.0", | ||
| "@prisma/client": "^6.0.0", | ||
| "bcrypt": "^5.1.0" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| ```prisma | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Prisma schema file now starts with a Markdown code fence (```prisma), which makes the schema invalid and causes Prisma tooling to fail. Remove this fence so the file begins directly with valid Prisma syntax. Prompt for AI agents |
||
| // This is your Prisma schema file, | ||
| // learn more about it in the docs: https://pris.ly/d/prisma-schema | ||
|
|
||
| generator client { | ||
| provider = "prisma-client-js" | ||
| } | ||
|
|
||
| datasource db { | ||
| provider = "postgresql" | ||
| url = env("DATABASE_URL") | ||
| } | ||
|
|
||
| model User { | ||
| id String @id @default(cuid()) | ||
| email String @unique | ||
| password String | ||
| name String | ||
| createdAt DateTime @default(now()) | ||
| todos Todo[] | ||
| } | ||
|
|
||
| model Todo { | ||
| id String @id @default(cuid()) | ||
| title String | ||
| description String? | ||
| completed Boolean @default(false) | ||
| createdAt DateTime @default(now()) | ||
| updatedAt DateTime @updatedAt | ||
| userId String | ||
| user User @relation(fields: [userId], references: [id], onDelete: Cascade) | ||
| } | ||
| ``` | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The closing Markdown code fence (```) at the end of the Prisma schema also breaks the schema parser. Remove this fence so the file ends with valid Prisma content. Prompt for AI agents |
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nest startrequires the Nest CLI, but this package.json doesnβt install@nestjs/cli, sonpm run startandnpm run start:devwill fail when the binary isnβt present. Please add the CLI dependency or adjust the scripts to avoid relying on it.Prompt for AI agents