Skip to content

Commit

Permalink
Added support for group posts controls (#315)
Browse files Browse the repository at this point in the history
* Added support for group post controls

* Changed nullable field properties on non-nullables

---------

Co-authored-by: Veerce <[email protected]>
  • Loading branch information
Tresvian and Veerce authored Apr 23, 2024
1 parent 08322f7 commit bec9a23
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 0 deletions.
4 changes: 4 additions & 0 deletions openapi/components/paths.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@
$ref: "./paths/groups.yaml#/paths/~1groups~1{groupId}~1members~1{userId}~1roles~1{groupRoleId}"
"/groups/{groupId}/permissions":
$ref: "./paths/groups.yaml#/paths/~1groups~1{groupId}~1permissions"
"/groups/{groupId}/posts":
$ref: "./paths/groups.yaml#/paths/~1groups~1{groupId}~1posts"
"/groups/{groupId}/posts/{notificationId}":
$ref: "./paths/groups.yaml#/paths/~1groups~1{groupId}~1posts~1{notificationId}"
"/groups/{groupId}/requests":
$ref: "./paths/groups.yaml#/paths/~1groups~1{groupId}~1requests"
"/groups/{groupId}/requests/{userId}":
Expand Down
62 changes: 62 additions & 0 deletions openapi/components/paths/groups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,68 @@ paths:
$ref: ../responses/groups/GroupNotFoundError.yaml
security:
- authCookie: []
'/groups/{groupId}/posts':
parameters:
- $ref: ../parameters.yaml#/groupId
get:
summary: Get posts from a Group
description: Get posts from a Group
operationId: getGroupPost
tags:
- groups
parameters:
- $ref: ../parameters.yaml#/number
- $ref: ../parameters.yaml#/offset
- schema:
type: boolean
in: query
name: publicOnly
description: See public posts only.
responses:
'200':
$ref: ../responses/groups/GroupPostResponse.yaml
'401':
$ref: ../responses/MissingCredentialsError.yaml
security:
- authCookie: []
post:
summary: Create a post in a Group
description: Create a post in a Group.
operationId: addGroupPost
tags:
- groups
requestBody:
required: true
content:
application/json:
schema:
$ref: ../requests/CreateGroupPostRequest.yaml
responses:
'200':
$ref: ../responses/groups/GroupPostResponse.yaml
'401':
$ref: ../responses/MissingCredentialsError.yaml
security:
- authCookie: []
'/groups/{groupId}/posts/{notificationId}':
parameters:
- $ref: ../parameters.yaml#/groupId
- $ref: ../parameters.yaml#/notificationId
delete:
summary: Delete a Group post
description: Delete a Group post
operationId: deleteGroupPost
tags:
- groups
responses:
'200':
$ref: ../responses/groups/DeleteGroupPostResponse.yaml
'401':
$ref: ../responses/MissingCredentialsError.yaml
'404':
$ref: ../responses/groups/DeleteGroupPostResponse.yaml
security:
- authCookie: []
'/groups/{groupId}/requests':
parameters:
- $ref: ../parameters.yaml#/groupId
Expand Down
29 changes: 29 additions & 0 deletions openapi/components/requests/CreateGroupPostRequest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
title: CreateGroupPostRequest
type: object
properties:
title:
type: string
description: Post title
minLength: 1
example: "Event is starting soon!"
text:
type: string
description: Post text
minLength: 1
example: "Come join us for the event!"
imageId:
$ref: ../schemas/FileID.yaml
sendNotification:
type: boolean
description: Send notification to group members.
default: false
example: false
roleIds:
$ref: ../schemas/GroupRoleIDList.yaml
visibility:
$ref: ../schemas/GroupPostVisibility.yaml
required:
- title
- text
- sendNotification
- visibility
11 changes: 11 additions & 0 deletions openapi/components/responses/groups/DeleteGroupPostResponse.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
description: Response after deleting a group post.
content:
application/json:
schema:
$ref: ../../schemas/Success.yaml
examples:
Deleted Group Post:
value:
success:
message: Group Post was deleted!
status_code: 200
5 changes: 5 additions & 0 deletions openapi/components/responses/groups/GroupPostResponse.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
description: Returns a GroupPost object.
content:
application/json:
schema:
$ref: ../../schemas/GroupPost.yaml
32 changes: 32 additions & 0 deletions openapi/components/schemas/GroupPost.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
title: GroupPost
type: object
properties:
id:
$ref: ./NotificationID.yaml
groupId:
$ref: ./GroupID.yaml
authorId:
$ref: ./UserID.yaml
editorId:
$ref: ./UserID.yaml
nullable: true
visibility:
$ref: ./GroupPostVisibility.yaml
roleId:
$ref: ./GroupRoleIDList.yaml
title:
type: string
text:
type: string
imageId:
$ref: ./FileID.yaml
nullable: true
imageUrl:
type: string
nullable: true
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
6 changes: 6 additions & 0 deletions openapi/components/schemas/GroupPostVisibility.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
example: public
title: GroupPostVisibility
type: string
enum:
- group
- public

0 comments on commit bec9a23

Please sign in to comment.