Skip to content

Commit cec2376

Browse files
committed
add models for post, thread, board, user and role
1 parent 4d4d0ed commit cec2376

File tree

1 file changed

+135
-10
lines changed

1 file changed

+135
-10
lines changed

swagger.yaml

Lines changed: 135 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
openapi: 3.0.0
2-
32
info:
43
title: ω bbs
54
version: 0.0.0
6-
75
servers:
86
- url: https://xn--omega.com/api
9-
107
paths:
118
/posts/{post_id}:
129
get:
@@ -16,22 +13,150 @@ paths:
1613
- name: post_id
1714
in: path
1815
required: true
19-
schema:
20-
type: string
16+
schema: { type: string }
2117
responses:
2218
200:
23-
description: ""
19+
description: ''
2420
content:
2521
application/json:
2622
schema:
27-
$ref: "#/components/schemas/Post"
28-
23+
$ref: '#/components/schemas/Post'
2924
components:
3025
schemas:
3126
Post:
3227
type: object
3328
properties:
34-
id:
29+
id: { type: number }
30+
bodyType:
31+
type: string
32+
enum:
33+
- text/markdown
34+
- text/plain
35+
body: { type: string }
36+
authorId: { type: number }
37+
threadId:
38+
type: number
39+
description: Id of the thread where the thread located
40+
createdAt: { type: number }
41+
updatedAt: { type: number }
42+
deletedAt: { type: number }
43+
required:
44+
- bodyType
45+
- body
46+
- authorId
47+
- threadId
48+
- craetedAt
49+
- updatedAt
50+
Thread:
51+
type: object
52+
properties:
53+
id: { type: number }
54+
title: { type: string }
55+
boardId: { type: number }
56+
authorId: { type: number }
57+
rootPostId: { type: number }
58+
lastPostId: { type: number }
59+
visible:
60+
type: boolean
61+
default: true
62+
createdAt: { type: number }
63+
updatedAt: { type: number }
64+
deletedAt: { type: number }
65+
required:
66+
- title
67+
- boardId
68+
- visible
69+
- authorId
70+
- rootPostId
71+
- lastPostId
72+
- createdAt
73+
- updatedAt
74+
Board:
75+
type: object
76+
properties:
77+
id: { type: number }
78+
slug:
79+
type: string
80+
description: for url only
81+
name: { type: string }
82+
className:
83+
type: string
84+
description: for display only
85+
description:
86+
type: string
87+
description: should be rendered as HTML
88+
required:
89+
- slug
90+
- name
91+
User:
92+
type: object
93+
properties:
94+
id: { type: number }
95+
username:
96+
type: string
97+
description: '@ and login, unique and immutable'
98+
displayName:
99+
type: string
100+
description: displays in post author, not unique
101+
email: { type: string }
102+
hashedPassword:
103+
type: string
104+
description: bcrypt
105+
bio: { type: string }
106+
role: { type: number }
107+
avatar:
108+
type: string
109+
description: uploaded avatar will save into db as url; needs regenerate if storage driver updated
110+
avatarId:
111+
type: number
112+
description: null if the avatar is not uploaded manually
113+
lastLoggedInAt: { type: number }
114+
createdAt: { type: number }
115+
required:
116+
- username
117+
- email
118+
- hashedPassword
119+
- role
120+
- createdAt
121+
Role:
122+
type: object
123+
properties:
124+
id: { type: number }
125+
permissions:
126+
type: array
127+
items: { type: string }
128+
title: { type: string }
129+
required:
130+
- permissions
131+
- title
132+
File:
133+
type: object
134+
properties:
135+
id: { type: number }
136+
postId:
137+
type: number
138+
description: null if this file is not associated with any post (avatar or so)
139+
authorId: { type: number }
140+
filename: { type: string }
141+
mime: { type: string }
142+
hash: { type: string }
143+
size:
35144
type: number
36-
title:
145+
description: in bytes
146+
storageDriver: { type: string }
147+
path: { type: string }
148+
url:
37149
type: string
150+
description: calculated at runtime
151+
createdAt: { type: number }
152+
deletedAt: { type: number }
153+
required:
154+
- authorId
155+
- filename
156+
- mime
157+
- hash
158+
- size
159+
- storageDriver
160+
- path
161+
- url
162+
- cratedAt

0 commit comments

Comments
 (0)