diff --git a/backend/api.yaml b/backend/api.yaml index 8b3f9ef2..729d4030 100644 --- a/backend/api.yaml +++ b/backend/api.yaml @@ -136,6 +136,12 @@ paths: name: type: string example: Clancy Lion + pronouns: + type: string + example: They/Them + gender: + type: string + example: Male degree_name: type: string example: Computer Science @@ -185,6 +191,77 @@ paths: error: type: string example: Not logged in. + + /user/pronouns: + patch: + operationId: updateUserPronouns + description: Updates currently logged in user's pronouns. + tags: + - User + requestBody: + required: true + content: + application/json: + schema: + properties: + zid: + type: string + example: "z5123456" + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + message: + type: string + example: Successfully updated pronouns. + '401': + description: Not logged in. + content: + application/json: + schema: + properties: + error: + type: string + example: Not logged in. + /user/gender: + patch: + operationId: updateUserGender + description: Updates currently logged in user's gender. + tags: + - User + requestBody: + required: true + content: + application/json: + schema: + properties: + zid: + type: string + example: "z5123456" + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + message: + type: string + example: Successfully updated gender. + '401': + description: Not logged in. + content: + application/json: + schema: + properties: + error: + type: string + example: Not logged in. + + /user/zid: patch: operationId: updateUserZid @@ -256,6 +333,36 @@ paths: error: type: string example: Not logged in. + + /user/applications: + get: + operationId: getUserApplications + description: Returns info about applications made by currently logged in user. + tags: + - User + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + campaigns: + type: array + items: + $ref: '#/components/schemas/ApplicationDetails' + '401': + description: Not logged in. + content: + application/json: + schema: + properties: + error: + type: string + example: Not logged in. + + + /organisation: post: operationId: createOrganisation @@ -329,6 +436,15 @@ paths: created_at: type: string example: 2024-02-10T18:25:43.511Z + '401': + description: Not logged in. + content: + application/json: + schema: + properties: + error: + type: string + example: Not logged in. delete: operationId: deleteOrganisationById parameters: @@ -352,6 +468,15 @@ paths: message: type: string example: Successfully deleted organisation. + '401': + description: Not logged in. + content: + application/json: + schema: + properties: + error: + type: string + example: Not logged in. '403': description: User is not a super user. content: @@ -385,27 +510,17 @@ paths: campaigns: type: array items: - type: object - properties: - id: - type: integer - format: int64 - example: 6996987893965262849 - name: - type: string - example: 2024 Subcommittee Recruitment - cover_image: - type: string - example: 2d19617b-46fd-4927-9f53-77d69232ba5d - description: - type: string - example: Are you excited to make a difference? - starts_at: - type: string - example: 2024-03-15T18:25:43.511Z - ends_at: - type: string - example: 2024-04-15T18:25:43.511Z + $ref: '#/components/schemas/OrganisationCampaign' + '401': + description: Not logged in. + content: + application/json: + schema: + properties: + error: + type: string + example: Not logged in. + /organisation/{id}/logo: patch: operationId: updateOrganisationLogoById @@ -430,7 +545,7 @@ paths: upload_url: type: string description: Presigned S3 url to upload file. - example: https://presignedurldemo.s3.eu-west-2.amazonaws.com/6996987893965262849/2d19617b-46fd-4927-9f53-77d69232ba5d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJJWZ7B6WCRGMKFGQ%2F20180210%2Feu-west-2%2Fs3%2Faws4_request&X-Amz-Date=20180210T171315Z&X-Amz-Expires=1800&X-Amz-Signature=12b74b0788aa036bc7c3d03b3f20c61f1f91cc9ad8873e3314255dc479a25351&X-Amz-SignedHeaders=host + example: https://www.youtube.com/watch?v=dQw4w9WgXcQ '401': description: Not logged in. content: @@ -449,7 +564,8 @@ paths: error: type: string example: Unauthorized - /organisation/{id}/members: + + /organisation/{id}/member: get: operationId: getOrganisationMembersById parameters: @@ -540,7 +656,207 @@ paths: type: string example: Not logged in. '403': - description: User is not an organisation admin. + description: User is not an organisation admin. + content: + application/json: + schema: + properties: + error: + type: string + example: Unauthorized + delete: + operationId: deleteOrganisationMemberById + parameters: + - name: id + in: path + description: Organisation ID + required: true + schema: + type: integer + format: int64 + requestBody: + required: true + content: + application/json: + schema: + properties: + user_id: + type: integer + format: int64 + description: Specifies member for deletion in organistion. + tags: + - Organisation + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + message: + type: string + example: Successfully updated members. + '401': + description: Not logged in. + content: + application/json: + schema: + properties: + error: + type: string + example: Not logged in. + '403': + description: User is not an organisation admin. + content: + application/json: + schema: + properties: + error: + type: string + example: Unauthorized + + /organisation/{id}/admin: + get: + operationId: getOrganisationAdminsById + parameters: + - name: id + in: path + description: Organisation ID + required: true + schema: + type: integer + format: int64 + description: Returns list of admins of specified organisation. + tags: + - Organisation + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + members: + type: array + items: + type: object + properties: + id: + type: integer + format: int64 + example: 1541815603606036480 + name: + type: string + example: Clancy Lion + role: + type: string + example: Admin + '403': + description: User is not a SuperUser. + content: + application/json: + schema: + properties: + error: + type: string + example: Unauthorized + put: + operationId: updateOrganisationAdminsById + parameters: + - name: id + in: path + description: Organisation ID + required: true + schema: + type: integer + format: int64 + requestBody: + required: true + content: + application/json: + schema: + properties: + members: + type: array + uniqueItems: true + items: + type: integer + format: int64 + example: [1541815603606036480, 1541815603606036827, 1541815287306036429] + description: Specifies Admins for specified organistion. + tags: + - Organisation + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + message: + type: string + example: Successfully updated members. + '401': + description: Not logged in. + content: + application/json: + schema: + properties: + error: + type: string + example: Not logged in. + '403': + description: User is not a SuperUser. + content: + application/json: + schema: + properties: + error: + type: string + example: Unauthorized + delete: + operationId: deleteOrganisationAdminById + parameters: + - name: id + in: path + description: Organisation ID + required: true + schema: + type: integer + format: int64 + requestBody: + required: true + content: + application/json: + schema: + properties: + user_id: + type: integer + format: int64 + description: Specifies Admin for deletion in organistion. + tags: + - Organisation + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + message: + type: string + example: Successfully deleted Admin. + '401': + description: Not logged in. + content: + application/json: + schema: + properties: + error: + type: string + example: Not logged in. + '403': + description: User is not a SuperUser. content: application/json: schema: @@ -548,6 +864,7 @@ paths: error: type: string example: Unauthorized + /organisation/{id}/campaign: post: operationId: createCampaign @@ -805,7 +1122,7 @@ paths: upload_url: type: string description: Presigned S3 url to upload file. - example: https://presignedurldemo.s3.eu-west-2.amazonaws.com/6996987893965262849/2d19617b-46fd-4927-9f53-77d69232ba5d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJJWZ7B6WCRGMKFGQ%2F20180210%2Feu-west-2%2Fs3%2Faws4_request&X-Amz-Date=20180210T171315Z&X-Amz-Expires=1800&X-Amz-Signature=12b74b0788aa036bc7c3d03b3f20c61f1f91cc9ad8873e3314255dc479a25351&X-Amz-SignedHeaders=host + example: https://www.youtube.com/watch?v=dQw4w9WgXcQ '401': description: Not logged in. content: @@ -906,24 +1223,71 @@ paths: campaigns: type: array items: - type: object - properties: - name: - type: string - example: Chief Mouser - description: - type: string - example: Larry the cat gone missing! now we need someone else to handle the rat issues at 10th Downing st. - min_available: - type: int32 - example: 1 - max_available: - type: int32 - example: 3 - finalised: - type: boolean - description: Whether this role has been finalised (e.g. max avaliable number) - example: False + $ref: '#components/schemas/RoleDetails' + '401': + description: Not logged in. + content: + application/json: + schema: + properties: + error: + type: string + example: Not logged in. + '403': + description: User is not a Campaign Admin. + content: + application/json: + schema: + properties: + error: + type: string + example: Unauthorized + + /campaign/{id}/applications: + get: + operationId: getApplicationsById + parameters: + - name: id + in: path + description: campaign ID + required: true + schema: + type: integer + format: int64 + description: Returns info about all Applications in given Campaign. + tags: + - Campaign + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + applications: + type: array + items: + $ref: '#components/schemas/ApplicationDetails' + '401': + description: Not logged in. + content: + application/json: + schema: + properties: + error: + type: string + example: Not logged in. + '403': + description: User is not a Campaign Admin. + content: + application/json: + schema: + properties: + error: + type: string + example: Unauthorized + + /role/{id}: get: operationId: getRoleById @@ -934,7 +1298,7 @@ paths: required: true schema: type: integer - format: int32 + format: int64 description: Returns info about specified role. tags: - Role @@ -973,14 +1337,14 @@ paths: put: operationId: updateRoleById - parameters: + parameters: - name: id in: path description: Role ID required: true schema: type: integer - format: int32 + format: int64 description: Update a role given the role id. tags: - Role @@ -1017,6 +1381,15 @@ paths: message: type: string example: Successfully update organisation. + '401': + description: Not logged in. + content: + application/json: + schema: + properties: + error: + type: string + example: Not logged in. '403': description: User is not a Campaign Admin. content: @@ -1036,7 +1409,7 @@ paths: required: true schema: type: integer - format: int32 + format: int64 description: Deletes specified role. tags: - Role @@ -1050,6 +1423,15 @@ paths: message: type: string example: Successfully deleted role. + '401': + description: Not logged in. + content: + application/json: + schema: + properties: + error: + type: string + example: Not logged in. '403': description: User is not an admin of role's Campaign. content: @@ -1058,4 +1440,320 @@ paths: properties: error: type: string - example: Unauthorized \ No newline at end of file + example: Unauthorized + + /role/{id}/applications: + get: + operationId: getApplicationsByRoleID + parameters: + - name: id + in: path + description: Role ID + required: true + schema: + type: integer + format: int64 + description: Returns all applications to a specific role + tags: + - Role + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + applications: + type: array + items: + $ref: '#components/schemas/ApplicationDetails' + '401': + description: Not logged in. + content: + application/json: + schema: + properties: + error: + type: string + example: Not logged in. + '403': + description: User is not an Application Admin. + content: + application/json: + schema: + properties: + error: + type: string + example: Unauthorized + + /application/{id}: + get: + operationId: getApplicationByID + parameters: + - name: id + in: path + description: Application ID + required: true + schema: + type: integer + format: int64 + description: Returns an applications given its ID + tags: + - Application + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + application: + type: + $ref: '#components/schemas/ApplicationDetails' + '401': + description: Not logged in. + content: + application/json: + schema: + properties: + error: + type: string + example: Not logged in. + '403': + description: User is not an Application Admin. + content: + application/json: + schema: + properties: + error: + type: string + example: Unauthorized + + + /application/{id}/private: + put: + operationId: updateApplicationPrivateStatus + parameters: + - name: id + in: path + description: Application ID + required: true + schema: + type: integer + format: int64 + requestBody: + required: true + content: + application/json: + schema: + properties: + data: + type: + $ref: '#components/schemas/ApplicationStatus' + + description: Change Private Status of a specific Application + tags: + - Organisation + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + message: + type: string + example: Successfully updated Application Private Status. + '401': + description: Not logged in. + content: + application/json: + schema: + properties: + error: + type: string + example: Not logged in. + '403': + description: User is not an Application Admin. + content: + application/json: + schema: + properties: + error: + type: string + example: Unauthorized + + /application/{id}/status: + put: + operationId: updateApplicationStatus + parameters: + - name: id + in: path + description: Application ID + required: true + schema: + type: integer + format: int64 + requestBody: + required: true + content: + application/json: + schema: + properties: + data: + type: + $ref: '#components/schemas/ApplicationStatus' + + description: Change Status of a specific Application + tags: + - Organisation + responses: + '200': + description: OK + content: + application/json: + schema: + properties: + message: + type: string + example: Successfully updated Application Status. + '401': + description: Not logged in. + content: + application/json: + schema: + properties: + error: + type: string + example: Not logged in. + '403': + description: User is not an Application Admin. + content: + application/json: + schema: + properties: + error: + type: string + example: Unauthorized + +components: + schemas: + ApplicationStatus: + type: string + enum: + - Pending + - Rejected + - Successful + + OrganisationCampaign: + type: object + properties: + id: + type: integer + format: int64 + example: 6996987893965262849 + name: + type: string + example: 2024 Subcommittee Recruitment + cover_image: + type: string + example: 2d19617b-46fd-4927-9f53-77d69232ba5d + description: + type: string + example: Are you excited to make a difference? + starts_at: + type: string + example: 2024-03-15T18:25:43.511Z + ends_at: + type: string + example: 2024-04-15T18:25:43.511Z + + RoleDetails: + type: object + properties: + id: + type: integer + format: int64 + example: 7036987893965262849 + campaign_id: + type: integer + format: int64 + example: 1116987453965262849 + name: + type: string + example: Chief Mouser + description: + type: string + example: Larry the cat gone missing! now we need someone else to handle the rat issues at 10th Downing st. + min_available: + type: int32 + example: 1 + max_available: + type: int32 + example: 3 + finalised: + type: boolean + description: Whether this role has been finalised (e.g. max avaliable number) + example: False + + UserDetails: + type: object + properties: + id: + type: integer + format: int64 + example: 1541815603606036480 + email: + type: string + example: me@example.com + zid: + type: string + example: z5555555 + name: + type: string + example: Clancy Lion + pronouns: + type: string + example: They/Them + gender: + type: string + example: Male + degree_name: + type: string + example: Computer Science + degree_starting_year: + type: integer + example: 2024 + + ApplicationDetails: + type: object + properties: + id: + type: integer + format: int64 + example: 1541815603606036480 + campaign_id: + type: integer + format: int64 + example: 5141815603606036480 + user: + $ref: '#/components/schemas/UserDetails' + status: + $ref: '#/components/schemas/ApplicationStatus' + private_status: + $ref: '#/components/schemas/ApplicationStatus' + applied_roles: + type: array + items: + $ref: '#/components/schemas/ApplicationAppliedRoleDetails' + + ApplicationAppliedRoleDetails: + type: object + properties: + campaign_role_id: + type: integer + format: int64 + example: 1541815603606036480 + role_name: + type: String + example: UI/UX subcom \ No newline at end of file