Skip to content

Commit

Permalink
refactor swagger message
Browse files Browse the repository at this point in the history
  • Loading branch information
susumutomita committed May 19, 2024
1 parent 93ac0ab commit df166b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 82 deletions.
70 changes: 1 addition & 69 deletions src/app/api/users/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,75 +2,7 @@ import { PrismaClient } from '@prisma/client';
import { NextResponse } from 'next/server';

const prisma = new PrismaClient();
/**
* @swagger
* /api/users:
* get:
* description: Retrieve all users
* responses:
* 200:
* description: A list of users
* content:
* application/json:
* schema:
* type: array
* items:
* $ref: '#/components/schemas/User'
* post:
* description: Create a new user
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/User'
* responses:
* 201:
* description: Created
*
* /api/users/{id}:
* get:
* description: Retrieve a user by ID
* parameters:
* - in: path
* name: id
* required: true
* schema:
* type: string
* responses:
* 200:
* description: A user object
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/User'
* put:
* description: Update a user
* parameters:
* - in: path
* name: id
* required: true
* schema:
* type: string
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/User'
* responses:
* 200:
* description: Updated
* delete:
* description: Delete a user
* parameters:
* - in: path
* name: id
* required: true
* schema:
* type: string
* responses:
* 204:
* description: No content
*/

export async function GET() {
try {
const users = await prisma.user.findMany();
Expand Down
17 changes: 4 additions & 13 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
Expand All @@ -24,12 +20,9 @@
}
],
"paths": {
"@/*": [
"./src/*",
"src/*"
]
"@/*": ["./src/*", "src/*"]
},
"baseUrl": ".", // ここを追加
"baseUrl": "." // ここを追加
},
"include": [
"next-env.d.ts",
Expand All @@ -38,7 +31,5 @@
".next/types/**/*.ts",
"next.config.js"
],
"exclude": [
"node_modules"
]
"exclude": ["node_modules"]
}

0 comments on commit df166b6

Please sign in to comment.