Skip to content

Commit 8cc13e3

Browse files
committed
Added Next.js BE & FE
1 parent f90df5d commit 8cc13e3

File tree

2 files changed

+191
-0
lines changed

2 files changed

+191
-0
lines changed

.idea/swagger-settings.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openapi.yaml

+185
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
openapi: 3.1.0
2+
info:
3+
title: ToDo API Documentation
4+
description: |
5+
API documentation for the ToDo application.
6+
version: 1.0.0
7+
contact:
8+
name: Son Nguyen
9+
servers:
10+
- url: https://todo-app-nextjs-stack.vercel.app/api
11+
description: Production server
12+
paths:
13+
/todos:
14+
get:
15+
summary: Fetch all todos for a user
16+
tags: [Todos]
17+
parameters:
18+
- name: userId
19+
in: query
20+
required: true
21+
schema:
22+
type: string
23+
description: ID of the user whose todos are being fetched
24+
responses:
25+
'200':
26+
description: A list of todos
27+
content:
28+
application/json:
29+
schema:
30+
type: array
31+
items:
32+
$ref: '#/components/schemas/Todo'
33+
'400':
34+
description: Missing or invalid userId
35+
post:
36+
summary: Add a new todo
37+
tags: [Todos]
38+
requestBody:
39+
required: true
40+
content:
41+
application/json:
42+
schema:
43+
$ref: '#/components/schemas/Todo'
44+
responses:
45+
'201':
46+
description: Todo added successfully
47+
'400':
48+
description: Invalid input
49+
/todos/{todoId}:
50+
patch:
51+
summary: Update the completion status of a todo
52+
tags: [Todos]
53+
parameters:
54+
- name: todoId
55+
in: path
56+
required: true
57+
schema:
58+
type: string
59+
description: ID of the todo to update
60+
requestBody:
61+
required: true
62+
content:
63+
application/json:
64+
schema:
65+
type: object
66+
properties:
67+
userId:
68+
type: string
69+
completed:
70+
type: boolean
71+
responses:
72+
'200':
73+
description: Todo updated successfully
74+
'400':
75+
description: Invalid input
76+
delete:
77+
summary: Delete a todo
78+
tags: [Todos]
79+
parameters:
80+
- name: todoId
81+
in: path
82+
required: true
83+
schema:
84+
type: string
85+
description: ID of the todo to delete
86+
requestBody:
87+
required: true
88+
content:
89+
application/json:
90+
schema:
91+
type: object
92+
properties:
93+
userId:
94+
type: string
95+
responses:
96+
'200':
97+
description: Todo deleted successfully
98+
'400':
99+
description: Invalid input
100+
/auth/login:
101+
post:
102+
summary: Login to the application
103+
tags: [Authentication]
104+
requestBody:
105+
required: true
106+
content:
107+
application/json:
108+
schema:
109+
type: object
110+
properties:
111+
username:
112+
type: string
113+
password:
114+
type: string
115+
responses:
116+
'200':
117+
description: Login successful
118+
'400':
119+
description: Invalid input
120+
'401':
121+
description: Unauthorized
122+
/auth/reset-password:
123+
post:
124+
summary: Reset the password for a user
125+
tags: [Authentication]
126+
requestBody:
127+
required: true
128+
content:
129+
application/json:
130+
schema:
131+
type: object
132+
properties:
133+
username:
134+
type: string
135+
newPassword:
136+
type: string
137+
responses:
138+
'200':
139+
description: Password reset successfully
140+
'400':
141+
description: Invalid input
142+
'404':
143+
description: Username not found
144+
/auth/register:
145+
post:
146+
summary: Register a new user
147+
tags: [Authentication]
148+
requestBody:
149+
required: true
150+
content:
151+
application/json:
152+
schema:
153+
type: object
154+
properties:
155+
username:
156+
type: string
157+
password:
158+
type: string
159+
responses:
160+
'201':
161+
description: User registered successfully
162+
'400':
163+
description: Invalid input
164+
'500':
165+
description: Failed to register user
166+
components:
167+
schemas:
168+
Todo:
169+
type: object
170+
properties:
171+
id:
172+
type: string
173+
task:
174+
type: string
175+
category:
176+
type: string
177+
completed:
178+
type: boolean
179+
User:
180+
type: object
181+
properties:
182+
username:
183+
type: string
184+
password:
185+
type: string

0 commit comments

Comments
 (0)