-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathopenapi.yaml
More file actions
1153 lines (1118 loc) · 34.5 KB
/
openapi.yaml
File metadata and controls
1153 lines (1118 loc) · 34.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# openapi.yaml
openapi: 3.0.3
info:
title: Blog API
version: 1.0.0
description: A RESTful API for managing blog posts, users, comments, and likes.
servers:
- url: https://blog-api.codewithsadee.com/api/v1
description: API v1 Base Path
tags: # Group endpoints for better organization
- name: Root
description: API Status
- name: Authentication
description: User authentication operations
- name: Users
description: User management operations
- name: Blogs
description: Blog post management
- name: Likes
description: Liking/Unliking operations
- name: Comments
description: Comment management
components:
# --- Reusable Schemas ---
schemas:
# --- Data Models ---
User:
type: object
properties:
_id:
type: string
format: objectid
description: Unique identifier for the user
readOnly: true
username:
type: string
description: User's unique username
maxLength: 20
email:
type: string
format: email
description: User's unique email address
maxLength: 50
role:
type: string
enum: [admin, user]
description: User role
readOnly: true
default: user
firstName:
type: string
description: User's first name
maxLength: 20
lastName:
type: string
description: User's last name
maxLength: 20
socialLinks:
type: object
properties:
website:
type: string
format: url
maxLength: 100
facebook:
type: string
format: url
maxLength: 100
instagram:
type: string
format: url
maxLength: 100
linkedin:
type: string
format: url
maxLength: 100
x:
type: string
format: url
maxLength: 100
youtube:
type: string
format: url
maxLength: 100
createdAt:
type: string
format: date-time
description: Timestamp of user creation
readOnly: true
updatedAt:
type: string
format: date-time
description: Timestamp of last user update
readOnly: true
required:
- username
- email
- role
UserInputRequired: # For Registration/Login where password is required input
type: object
properties:
email:
type: string
format: email
description: User's email address
maxLength: 50
password:
type: string
description: User's password
minLength: 8
writeOnly: true # Typically not shown in responses
role:
type: string
enum: [admin, user]
description: User role (optional for registration)
required:
- email
- password
UserUpdateInput: # For updating user profile
type: object
properties:
username:
type: string
description: User's unique username
maxLength: 20
email:
type: string
format: email
description: User's unique email address
maxLength: 50
password:
type: string
description: New password (min 8 chars)
minLength: 8
writeOnly: true
first_name: # Note: using snake_case from request, mapping to firstName internally
type: string
description: User's first name
maxLength: 20
last_name: # Note: using snake_case from request, mapping to lastName internally
type: string
description: User's last name
maxLength: 20
website:
type: string
format: url
maxLength: 100
facebook:
type: string
format: url
maxLength: 100
instagram:
type: string
format: url
maxLength: 100
linkedin:
type: string
format: url
maxLength: 100
x:
type: string
format: url
maxLength: 100
youtube:
type: string
format: url
maxLength: 100
Blog:
type: object
properties:
_id:
type: string
format: objectid
readOnly: true
title:
type: string
maxLength: 180
slug:
type: string
readOnly: true
description: URL-friendly identifier, automatically generated
content:
type: string
description: HTML content of the blog post
banner:
type: object
properties:
url:
type: string
format: url
description: URL of the banner image
readOnly: true
width:
type: integer
description: Width of the banner image
readOnly: true
height:
type: integer
description: Height of the banner image
readOnly: true
# publicId excluded as it's internal
author:
# Could be just ObjectId or expanded User schema
$ref: "#/components/schemas/User" # Referencing User schema for populated author
readOnly: true
viewsCount:
type: integer
default: 0
readOnly: true
likesCount:
type: integer
default: 0
readOnly: true
commentsCount:
type: integer
default: 0
readOnly: true
status:
type: string
enum: [draft, published]
default: draft
publishedAt:
type: string
format: date-time
readOnly: true
updatedAt:
type: string
format: date-time
readOnly: true
required:
- title
- content
- banner
- author
- status
BlogInput:
type: object
properties:
title:
type: string
maxLength: 180
content:
type: string
description: HTML content
status:
type: string
enum: [draft, published]
default: draft
banner_image: # For multipart/form-data
type: string
format: binary
description: Banner image file (png/jpg/webp, max 2MB)
required:
- title
- content
- banner_image # Required for POST
BlogUpdateInput: # For PUT request body
type: object
properties:
title:
type: string
maxLength: 180
content:
type: string
description: HTML content
status:
type: string
enum: [draft, published]
banner_image: # Optional for PUT
type: string
format: binary
description: New banner image file (png/jpg/webp, max 2MB)
Comment:
type: object
properties:
_id:
type: string
format: objectid
readOnly: true
blogId:
type: string
format: objectid
description: ID of the associated blog post
userId:
type: string
format: objectid
description: ID of the user who commented
readOnly: true # Set by server based on auth
content:
type: string
maxLength: 1000
description: The comment text
likesCount:
type: integer
default: 0
readOnly: true
# replies omitted as not implemented in API
createdAt:
type: string
format: date-time
readOnly: true
updatedAt:
type: string
format: date-time
readOnly: true
required:
- blogId
- userId
- content
CommentInput:
type: object
properties:
blogId:
type: string
format: objectid
description: ID of the blog post to comment on
content:
type: string
maxLength: 1000
description: The comment text
required:
- blogId
- content
PaginatedUsers:
type: object
properties:
limit:
type: integer
offset:
type: integer
total:
type: integer
users:
type: array
items:
$ref: "#/components/schemas/User"
PaginatedBlogs:
type: object
properties:
limit:
type: integer
offset:
type: integer
total:
type: integer
blogs:
type: array
items:
$ref: "#/components/schemas/Blog"
AccessTokenResponse:
type: object
properties:
accessToken:
type: string
description: JWT Access Token
LoginResponse:
allOf: # Combines AccessTokenResponse and User details
- $ref: "#/components/schemas/AccessTokenResponse"
- type: object
properties:
user:
$ref: "#/components/schemas/User" # Or a simplified User view
# --- Error Models ---
ErrorResponse:
type: object
properties:
code:
type: string
description: Application-specific error code
message:
type: string
description: Human-readable error message
required:
- code
- message
ValidationErrorDetail:
type: object
properties:
type:
type: string
value:
type: string # Can be any type depending on input
msg:
type: string
path:
type: string
location:
type: string
ValidationErrorResponse:
type: object
properties:
code:
type: string
enum: [ValidationError]
errors:
type: object
additionalProperties: # Allows for dynamic field names like 'email', 'password'
$ref: "#/components/schemas/ValidationErrorDetail"
required:
- code
- errors
# --- Security Schemes ---
securitySchemes:
bearerAuth: # Name used in security requirement objects
type: http
scheme: bearer
bearerFormat: JWT
description: JWT Access Token obtained via login/register/refresh
# --- Parameters (Reusable) ---
parameters:
LimitParam:
in: query
name: limit
schema:
type: integer
minimum: 1
maximum: 50
default: 20
description: Maximum number of items to return.
required: false
OffsetParam:
in: query
name: offset
schema:
type: integer
minimum: 0
default: 0
description: Number of items to skip for pagination.
required: false
UserIdParam:
in: path
name: userId
schema:
type: string
format: objectid # Indicate it should be a MongoDB ObjectId
required: true
description: ID of the user.
BlogIdParam:
in: path
name: blogId
schema:
type: string
format: objectid
required: true
description: ID of the blog post.
BlogSlugParam:
in: path
name: slug
schema:
type: string
required: true
description: Slug of the blog post.
CommentIdParam:
in: path
name: commentId
schema:
type: string
format: objectid
required: true
description: ID of the comment.
RefreshTokenCookie:
in: cookie
name: refreshToken
schema:
type: string
format: jwt
required: true
description: HTTP-only refresh token cookie.
# --- Responses (Reusable) ---
responses:
Unauthorized:
description: Authentication information is missing or invalid (e.g., missing/expired token).
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
example:
code: AuthenticationError
message: Access denied, no token provided
Forbidden:
description: Access denied due to insufficient permissions.
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
example:
code: AuthorizationError
message: Access denied, insufficient permissions
NotFound:
description: The specified resource was not found.
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
example:
code: NotFound
message: Resource not found
BadRequestValidation:
description: Invalid input data provided. See errors object for details.
content:
application/json:
schema:
$ref: "#/components/schemas/ValidationErrorResponse"
ServerError:
description: An unexpected error occurred on the server.
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
example:
code: ServerError
message: Internal server error
NoContent:
description: Request successful, no response body.
# --- Global Security Requirement (Applies JWT by default) ---
security:
- bearerAuth: [] # Requires JWT Bearer token globally
# --- API Paths ---
paths:
# --- Root ---
/:
get:
tags: [Root]
summary: Get API Status
description: Provides basic status and information about the API.
operationId: getApiStatus
security: [] # No authentication required for this endpoint
responses:
"200":
description: API Status Information
content:
application/json:
schema:
type: object
properties:
message: { type: string }
status: { type: string }
version: { type: string }
docs: { type: string, format: url }
timestamp: { type: string, format: date-time }
example:
message: API is live
status: ok
version: 1.0.0
docs: https://docs.blog-api.codewithsadee.com
timestamp: 2025-05-06T14:30:00.000Z
# --- Authentication Paths ---
/auth/register:
post:
tags: [Authentication]
summary: Register New User
description: Creates a new user account. Admin registration requires whitelisted email.
operationId: registerUser
security: [] # No authentication required
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/UserInputRequired"
responses:
"201":
description: User registered successfully. Sets refreshToken cookie.
content:
application/json:
schema:
$ref: "#/components/schemas/LoginResponse" # Same response structure as login
"400":
$ref: "#/components/responses/BadRequestValidation"
"403": # Specific case for admin registration attempt
description: Admin registration denied for non-whitelisted email.
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
example:
code: AuthorizationError
message: You cannot register as an admin
"500":
$ref: "#/components/responses/ServerError"
/auth/login:
post:
tags: [Authentication]
summary: Login User
description: Authenticates a user and returns tokens.
operationId: loginUser
security: [] # No authentication required
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/UserInputRequired"
responses:
"200":
description: Login successful. Sets refreshToken cookie.
content:
application/json:
schema:
$ref: "#/components/schemas/LoginResponse"
"400": # Includes invalid credential check
$ref: "#/components/responses/BadRequestValidation"
"404": # Though validation might catch non-existing user first
$ref: "#/components/responses/NotFound"
"500":
$ref: "#/components/responses/ServerError"
/auth/refresh-token:
post:
tags: [Authentication]
summary: Refresh Access Token
description: Generates a new access token using the refresh token cookie.
operationId: refreshToken
security: [] # No bearer token needed, relies on cookie
parameters:
- $ref: "#/components/parameters/RefreshTokenCookie"
responses:
"200":
description: Access token refreshed successfully.
content:
application/json:
schema:
$ref: "#/components/schemas/AccessTokenResponse"
"400": # Missing/invalid cookie
$ref: "#/components/responses/BadRequestValidation"
"401": # Invalid/expired refresh token
$ref: "#/components/responses/Unauthorized"
"500":
$ref: "#/components/responses/ServerError"
/auth/logout:
post:
tags: [Authentication]
summary: Logout User
description: Invalidates the refresh token and clears the cookie. Requires both access and refresh tokens.
operationId: logoutUser
# security: uses default bearerAuth
parameters:
- $ref: "#/components/parameters/RefreshTokenCookie"
responses:
"200":
description: Logout successful. Clears refreshToken cookie.
content:
application/json:
schema:
type: object
properties:
message: { type: string }
example:
message: Logged out successfully
"400": # Missing/invalid cookie
$ref: "#/components/responses/BadRequestValidation"
"401": # Missing/invalid access or refresh token
$ref: "#/components/responses/Unauthorized"
"500":
$ref: "#/components/responses/ServerError"
# --- User Paths ---
/users/current:
get:
tags: [Users]
summary: Get Current User Profile
description: Retrieves the profile of the currently authenticated user.
operationId: getCurrentUser
# security: uses default bearerAuth
responses:
"200":
description: Current user profile data.
content:
application/json:
schema:
type: object
properties:
user:
$ref: "#/components/schemas/User"
"401":
$ref: "#/components/responses/Unauthorized"
"500":
$ref: "#/components/responses/ServerError"
put:
tags: [Users]
summary: Update Current User Profile
description: Updates the profile of the currently authenticated user.
operationId: updateCurrentUser
# security: uses default bearerAuth
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/UserUpdateInput"
responses:
"200":
description: User profile updated successfully.
content:
application/json:
schema:
type: object
properties:
user:
$ref: "#/components/schemas/User" # Returns the updated user
"400":
$ref: "#/components/responses/BadRequestValidation"
"401":
$ref: "#/components/responses/Unauthorized"
"404": # Should ideally not happen if authenticated
$ref: "#/components/responses/NotFound"
"500":
$ref: "#/components/responses/ServerError"
delete:
tags: [Users]
summary: Delete Current User Account
description: Deletes the account of the currently authenticated user and their associated data.
operationId: deleteCurrentUser
# security: uses default bearerAuth
responses:
"204":
$ref: "#/components/responses/NoContent"
"401":
$ref: "#/components/responses/Unauthorized"
"500":
$ref: "#/components/responses/ServerError"
/users/:
get:
tags: [Users]
summary: Get All Users (Admin)
description: Retrieves a paginated list of all users. Admin role required.
operationId: getAllUsers
# security: uses default bearerAuth (Implicitly checks role via middleware)
parameters:
- $ref: "#/components/parameters/LimitParam"
- $ref: "#/components/parameters/OffsetParam"
responses:
"200":
description: A list of users.
content:
application/json:
schema:
$ref: "#/components/schemas/PaginatedUsers"
"400":
$ref: "#/components/responses/BadRequestValidation" # For query params
"401":
$ref: "#/components/responses/Unauthorized"
"403": # If user is not admin
$ref: "#/components/responses/Forbidden"
"500":
$ref: "#/components/responses/ServerError"
/users/{userId}:
get:
tags: [Users]
summary: Get User by ID (Admin)
description: Retrieves profile information for a specific user. Admin role required.
operationId: getUserById
# security: uses default bearerAuth
parameters:
- $ref: "#/components/parameters/UserIdParam"
responses:
"200":
description: Specific user profile data.
content:
application/json:
schema:
type: object
properties:
user:
$ref: "#/components/schemas/User"
"400": # Invalid userId format
$ref: "#/components/responses/BadRequestValidation"
"401":
$ref: "#/components/responses/Unauthorized"
"403": # If user is not admin
$ref: "#/components/responses/Forbidden"
"404":
$ref: "#/components/responses/NotFound"
"500":
$ref: "#/components/responses/ServerError"
delete:
tags: [Users]
summary: Delete User by ID (Admin)
description: Deletes a specific user account and their associated data. Admin role required.
operationId: deleteUserById
# security: uses default bearerAuth
parameters:
- $ref: "#/components/parameters/UserIdParam"
responses:
"204":
$ref: "#/components/responses/NoContent"
"400": # Invalid userId format
$ref: "#/components/responses/BadRequestValidation"
"401":
$ref: "#/components/responses/Unauthorized"
"403": # If user is not admin
$ref: "#/components/responses/Forbidden"
"404": # User not found (though might return 204 even if not found depending on implementation)
$ref: "#/components/responses/NotFound"
"500":
$ref: "#/components/responses/ServerError"
# --- Blog Paths ---
/blogs/:
post:
tags: [Blogs]
summary: Create Blog Post (Admin)
description: Creates a new blog post. Requires banner image upload. Admin role required.
operationId: createBlog
# security: uses default bearerAuth
requestBody:
required: true
content:
multipart/form-data: # Specify multipart for file upload
schema:
$ref: "#/components/schemas/BlogInput"
encoding:
# Optional: Specify encoding for properties if needed, especially for file part
banner_image:
contentType: image/png, image/jpeg, image/webp
responses:
"201":
description: Blog post created successfully.
content:
application/json:
schema:
type: object
properties:
blog:
$ref: "#/components/schemas/Blog"
"400":
$ref: "#/components/responses/BadRequestValidation"
"401":
$ref: "#/components/responses/Unauthorized"
"403": # If user is not admin
$ref: "#/components/responses/Forbidden"
"413": # Payload Too Large
description: Uploaded file exceeds size limit.
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
example:
code: ValidationError
message: File size must be less than 2MB
"500":
$ref: "#/components/responses/ServerError"
get:
tags: [Blogs]
summary: Get All Blogs
description: Retrieves a paginated list of blogs. Admins see all; users see only 'published'. Sorted by creation date descending.
operationId: getAllBlogs
# security: uses default bearerAuth
parameters:
- $ref: "#/components/parameters/LimitParam"
- $ref: "#/components/parameters/OffsetParam"
responses:
"200":
description: A list of blogs.
content:
application/json:
schema:
$ref: "#/components/schemas/PaginatedBlogs"
"400":
$ref: "#/components/responses/BadRequestValidation" # For query params
"401":
$ref: "#/components/responses/Unauthorized"
"500":
$ref: "#/components/responses/ServerError"
/blogs/user/{userId}:
get:
tags: [Blogs]
summary: Get Blogs by User
description: Retrieves a paginated list of blogs by a specific user. Admins see all; users see only 'published'. Sorted by creation date descending.
operationId: getBlogsByUser
# security: uses default bearerAuth
parameters:
- $ref: "#/components/parameters/UserIdParam"
- $ref: "#/components/parameters/LimitParam"
- $ref: "#/components/parameters/OffsetParam"
responses:
"200":
description: A list of blogs by the specified user.
content:
application/json:
schema:
$ref: "#/components/schemas/PaginatedBlogs"
"400":
$ref: "#/components/responses/BadRequestValidation"
"401":
$ref: "#/components/responses/Unauthorized"
"500":
$ref: "#/components/responses/ServerError"
/blogs/{slug}:
get:
tags: [Blogs]
summary: Get Blog by Slug
description: Retrieves a single blog post by its unique slug. Regular users cannot view 'draft' posts.
operationId: getBlogBySlug
# security: uses default bearerAuth
parameters:
- $ref: "#/components/parameters/BlogSlugParam"
responses:
"200":
description: The requested blog post.
content:
application/json:
schema:
type: object
properties:
blog:
$ref: "#/components/schemas/Blog"
"400":
$ref: "#/components/responses/BadRequestValidation"
"401":
$ref: "#/components/responses/Unauthorized"
"403": # User attempts to access draft
$ref: "#/components/responses/Forbidden"
"404":
$ref: "#/components/responses/NotFound"
"500":
$ref: "#/components/responses/ServerError"
/blogs/{blogId}:
put:
tags: [Blogs]
summary: Update Blog Post (Admin)
description: Updates an existing blog post. Banner update optional. Admin role required (route security).
operationId: updateBlog
# security: uses default bearerAuth
parameters:
- $ref: "#/components/parameters/BlogIdParam"
requestBody:
content:
multipart/form-data:
schema:
$ref: "#/components/schemas/BlogUpdateInput"
encoding:
banner_image:
contentType: image/png, image/jpeg, image/webp
responses:
"200":
description: Blog post updated successfully.
content:
application/json:
schema:
type: object
properties:
blog:
$ref: "#/components/schemas/Blog"
"400":
$ref: "#/components/responses/BadRequestValidation"
"401":
$ref: "#/components/responses/Unauthorized"
"403": # If user is not admin (or potentially not author if check was active)
$ref: "#/components/responses/Forbidden"
"404":
$ref: "#/components/responses/NotFound"
"413": # Payload Too Large
description: Uploaded file exceeds size limit.
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorResponse"
"500":
$ref: "#/components/responses/ServerError"
delete:
tags: [Blogs]
summary: Delete Blog Post (Admin)
description: Deletes a blog post by ID. Also removes banner. Admin role required (route security).
operationId: deleteBlog
# security: uses default bearerAuth
parameters:
- $ref: "#/components/parameters/BlogIdParam"
responses:
"204":
$ref: "#/components/responses/NoContent"
"401":