ShadowHokageForge / event-management-system

0 stars 0 forks source link

Event Service - Create API Spec #3

Closed SixPathsSage closed 1 month ago

SixPathsSage commented 1 month ago

Description:

Create a swagger spec for the below

  1. CRUD for Event
  2. CRUD for Comments
  3. Upload and Delete Event Photos
  4. View Event Photos
SixPathsSage commented 1 month ago
Swagger Spec

```yml openapi: 3.0.1 info: title: Event Management API description: API for managing events version: 1.0.0 paths: /event-management/api/events: post: tags: - Event API summary: Create a new event operationId: createEvent security: - bearerAuth: [] requestBody: description: Event details required: true content: application/json: schema: type: object properties: id: type: string format: uuid description: Unique identifier for the event name: type: string description: Name of the event event_info: type: object properties: from: type: string format: date-time description: Event start time to: type: string format: date-time description: Event end time is_recurring: type: boolean description: Indicates if the event is recurring recurring_on: type: array items: type: string description: Days the event repeats on (e.g., ["Monday", "Wednesday"]) recurring_till: type: string format: date-time description: Recurrence end date event_thumbnail_link: type: string description: Link for the event thumbnail is_online: type: boolean description: Indicates if the event is online event_link: type: string description: Link for the online event host_ids: type: array items: type: string format: uuid description: List of host UUIDs host_group_id: type: string format: uuid description: UUID of the host group details: type: string description: Dtails about the event tags: type: array items: type: string description: List of Tags speaker: type: string description: Event Speaker location: type: object properties: latitude: type: string description: Latitude of the event location longitude: type: string description: Longitude of the event location name: type: string description: Name of the event location address: type: string description: Address of the event location street: type: string description: Street name of the event location locality: type: string description: Locality of the event location city: type: string description: City of the event location state: type: string description: State of the event location country: type: string description: Country of the event location required: - id - name - event_info - is_online - host_ids responses: '201': description: Event successfully created '400': description: Invalid input '401': description: Unauthorized '403': description: Forbidden '500': description: Internal server error get: tags: - Event API summary: Get a list of events with pagination operationId: getEvents security: - bearerAuth: [] parameters: - name: page in: query required: true description: Page number (0-indexed) schema: type: integer example: 0 - name: page_size in: query required: true description: Number of items per page schema: type: integer example: 10 - name: eventType in: query required: false description: Filter by event type (e.g., online, offline, hybrid) schema: type: string example: online - name: startDate in: query required: false description: Filter events starting from this date schema: type: string format: date example: 2024-09-22 - name: endDate in: query required: false description: Filter events ending before this date schema: type: string format: date example: 2024-09-30 - name: search in: query required: false description: Search by event name or location schema: type: string example: Tech Conference responses: '200': description: A paginated list of events content: application/json: schema: type: object properties: events: type: array items: type: object properties: id: type: string format: uuid description: Unique identifier for the event name: type: string description: Name of the event event_timestamp: type: string format: date-time description: Timestamp of the event event_thumbnail_link: type: string description: Thumbnail image URL for the event is_online: type: boolean description: Whether the event is online event_link: type: string description: URL to the event attendees: type: integer format: int64 description: Number of attendees expected or registered host_group: type: string description: The group or organization hosting the event location: type: object properties: city: type: string description: City of the event location state: type: string description: State of the event location country: type: string description: Country of the event location total_items: type: integer format: int64 description: Total number of events page: type: integer format: int64 description: Current page number page_size: type: integer format: int64 description: Number of items per page '400': description: Invalid request '401': description: Unauthorized '403': description: Forbidden '404': description: No events found '500': description: Internal server error /event-management/api/events/{event-id}: get: tags: - Event API summary: Retrieve event by ID operationId: getEventById parameters: - name: event-id in: path required: true description: Unique identifier of the event schema: type: string format: uuid security: - bearerAuth: [] responses: '200': description: Event details retrieved successfully content: application/json: schema: type: object properties: id: type: string format: uuid description: Unique identifier for the event name: type: string description: Name of the event event_info: type: object properties: from: type: string format: date-time description: Event start time to: type: string format: date-time description: Event end time is_recurring: type: boolean description: Indicates if the event is recurring recurring_on: type: array items: type: string description: Days the event repeats on (e.g., ["Monday", "Wednesday"]) recurring_till: type: string format: date-time description: Recurrence end date event_thumbnail_link: type: string description: Link for the event thumbnail is_online: type: boolean description: Indicates if the event is online event_link: type: string description: Link for the online event host_name: type: array items: type: string description: List of host UUIDs host_group_id: type: string format: uuid description: UUID of the host group details: type: string description: Details about the event tags: type: array items: type: string description: List of Tags location: type: object properties: latitude: type: string description: Latitude of the event location longitude: type: string description: Longitude of the event location name: type: string description: Name of the event location address: type: string description: Address of the event location street: type: string description: Street name of the event location locality: type: string description: Locality of the event location city: type: string description: City of the event location state: type: string description: State of the event location country: type: string description: Country of the event location photos: type: array items: type: string description: List of photos path '400': description: Invalid event ID '401': description: Unauthorized '403': description: Forbidden '404': description: Event not found '500': description: Internal server error put: tags: - Event API summary: Create a new event operationId: updateEvent parameters: - name: event-id in: path required: true description: Unique identifier of the event schema: type: string format: uuid security: - bearerAuth: [] requestBody: description: Event details required: true content: application/json: schema: type: object properties: name: type: string description: Name of the event event_info: type: object properties: from: type: string format: date-time description: Event start time to: type: string format: date-time description: Event end time is_recurring: type: boolean description: Indicates if the event is recurring recurring_on: type: array items: type: string description: Days the event repeats on (e.g., ["Monday", "Wednesday"]) recurring_till: type: string format: date-time description: Recurrence end date event_thumbnail_link: type: string description: Link for the event thumbnail is_online: type: boolean description: Indicates if the event is online event_link: type: string description: Link for the online event host_ids: type: array items: type: string format: uuid description: List of host UUIDs host_group_id: type: string format: uuid description: UUID of the host group details: type: string description: Details about the event tags: type: array items: type: string description: List of Tags speaker: type: string description: Event Speaker location: type: object properties: latitude: type: string description: Latitude of the event location longitude: type: string description: Longitude of the event location name: type: string description: Name of the event location address: type: string description: Address of the event location street: type: string description: Street name of the event location locality: type: string description: Locality of the event location city: type: string description: City of the event location state: type: string description: State of the event location country: type: string description: Country of the event location required: - id - name - event_info - is_online - host_ids responses: '201': description: Event successfully created '400': description: Invalid input '401': description: Unauthorized '403': description: Forbidden '500': description: Internal server error delete: tags: - Event API summary: Retrieve event by ID operationId: DeleteEventById parameters: - name: event-id in: path required: true description: Unique identifier of the event schema: type: string format: uuid security: - bearerAuth: [] responses: '200': description: Event Details Delete successfully '400': description: Invalid event ID '401': description: Unauthorized '403': description: Forbidden '404': description: Event not found '500': description: Internal server error /event-management/api/events/{event-id}/upload-photos: patch: tags: - Event API summary: Create a new event operationId: uploadPhoto parameters: - name: event-id in: path required: true description: Unique identifier of the event schema: type: string format: uuid security: - bearerAuth: [] requestBody: description: Event details required: true content: application/json: schema: type: object properties: name: type: array items: type: string description: List of Photos responses: '201': description: Photos added successfully '400': description: Invalid input '401': description: Unauthorized '403': description: Forbidden '500': description: Internal server error /event-management/events/{event-id}/comments: post: tags: - Comments API summary: Add a comment to an event operationId: addEventComment parameters: - name: event-id in: path required: true description: ID of the event schema: type: string requestBody: required: true content: application/json: schema: type: object properties: comment: type: string example: "This is a comment." required: - comment security: - bearerAuth: [] responses: '201': description: Comment added successfully content: application/json: schema: type: object properties: id: type: string format: uuid comment: type: string user_id: type: string format: uuid commented_on: type: string format: date-time '400': description: Bad request, invalid input '401': description: Unauthorized, missing or invalid token '404': description: Event not found get: tags: - Comments API summary: Get comments for an event operationId: getEventComments parameters: - name: event-id in: path required: true description: ID of the event schema: type: string security: - bearerAuth: [] responses: '200': description: Successful response with a list of comments content: application/json: schema: type: object properties: comments: type: array items: type: object properties: id: type: string format: uuid user_id: type: string format: uuid user_avatar: type: string user_name: type: string comment: type: string commented_on: type: string format: date-time likes: type: integer format: int64 replies: type: array items: type: object properties: id: type: string format: uuid user_id: type: string format: uuid user_avatar: type: string user_name: type: string comment: type: string commented_on: type: string format: date-time likes: type: integer format: int64 total_items: type: integer format: int64 page: type: integer format: int64 page_size: type: integer format: int64 '401': description: Unauthorized, missing or invalid token '404': description: Event not found /event-management/events/{event-id}/comments/{comment-id}: delete: tags: - Comments API summary: Delete a comment from an event operationId: deleteEventComment parameters: - name: event-id in: path required: true description: ID of the event schema: type: string - name: comment-id in: path required: true description: ID of the comment to be deleted schema: type: string security: - bearerAuth: [] responses: '204': description: Comment deleted successfully, no content returned '400': description: Bad request, invalid event or comment ID '401': description: Unauthorized, missing or invalid token '404': description: Event or comment not found components: securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: JWT ```

SixPathsSage commented 1 month ago

@RudhraBharathy Please review the Swagger Spec for Events, Comments and Photos API

RudhraBharathy commented 1 month ago

Upon reviewing the Swagger API spec, I have some updates

Events API :

  1. PUT, DELETE, PATCH - need to change the description
  2. need event_entry_type like free/paid/none. this must be changed in all other APIs
  3. In the Retrieve event by ID API need host_image

Comments API:

  1. Need PUT method, if a user tries to update the comment
SixPathsSage commented 1 month ago

Events API :

1. PUT, DELETE, PATCH - need to change the description

This is a trivial issue, Will fix it.

2. need event_entry_type like free/paid/none. this must be changed in all other APIs

Currently for the MVP we are only supporting free events, Paid events are for future scope.

  1. In the Retrieve event by ID API need host_image This is accepted and will fix it.

Comments API:

1. Need PUT method, if a user tries to update the comment

We are not allowing users to update their comments.

SixPathsSage commented 1 month ago

@RudhraBharathy Please review the below changes

  1. Updated the review changes.
  2. Added some APIs
  3. Updated the response code and removed host group (not for this MVP).
Updated Swagger

```yml openapi: 3.0.1 info: title: Event Management API description: API for managing events version: 1.0.0 paths: /event-management/api/v1/events: post: tags: - Event API summary: Create a new event operationId: createEvent security: - bearerAuth: [] requestBody: description: Event details required: true content: application/json: schema: type: object properties: id: type: string format: uuid description: Unique identifier for the event name: type: string description: Name of the event event_info: type: object properties: from: type: string format: date-time description: Event start time to: type: string format: date-time description: Event end time event_thumbnail_link: type: string description: Link for the event thumbnail is_online: type: boolean description: Indicates if the event is online event_link: type: string description: Link for the online event host_ids: type: array items: type: string format: uuid description: List of host UUIDs details: type: string description: Details about the event tags: type: array items: type: string format: uuid description: List of Tags (Ids) location: type: object properties: latitude: type: string description: Latitude of the event location longitude: type: string description: Longitude of the event location name: type: string description: Name of the event location address: type: string description: Address of the event location street: type: string description: Street name of the event location locality: type: string description: Locality of the event location city: type: string description: City of the event location state: type: string description: State of the event location country: type: string description: Country of the event location required: - id - name - event_info - is_online - host_ids responses: '201': description: Event successfully created '400': description: Invalid Request '401': description: Unauthorized '403': description: Forbidden '404': description: Not Found '500': description: Internal server error get: tags: - Event API summary: Get a list of events with pagination operationId: getEvents security: - bearerAuth: [] parameters: - name: page in: query required: true description: Page number (0-indexed) schema: type: integer example: 0 - name: page_size in: query required: true description: Number of items per page schema: type: integer example: 10 - name: eventType in: query required: false description: Filter by event type (e.g., online, offline) schema: type: string example: online - name: startDate in: query required: false description: Filter events starting from this date schema: type: string format: date example: 2024-09-22 - name: endDate in: query required: false description: Filter events ending before this date schema: type: string format: date example: 2024-09-30 - name: search in: query required: false description: Search by event name or location schema: type: string example: Tech Conference responses: '200': description: A paginated list of events content: application/json: schema: type: object properties: events: type: array items: type: object properties: id: type: string format: uuid description: Unique identifier for the event name: type: string description: Name of the event event_timestamp: type: string format: date-time description: Timestamp of the event event_thumbnail_link: type: string description: Thumbnail image URL for the event is_online: type: boolean description: Indicates if the event is online event_link: type: string description: URL to the event attendees: type: integer format: int64 description: Number of attendees expected or registered location: type: object properties: city: type: string description: City of the event location state: type: string description: State of the event location country: type: string description: Country of the event location total_items: type: integer format: int64 description: Total number of events page: type: integer format: int64 description: Current page number page_size: type: integer format: int64 description: Number of items per page '400': description: Invalid Request '401': description: Unauthorized '403': description: Forbidden '404': description: Not Found '500': description: Internal server error /event-management/api/v1/events/{event-id}: get: tags: - Event API summary: Retrieve event by ID operationId: getEventById parameters: - name: event-id in: path required: true description: Unique identifier of the event schema: type: string format: uuid security: - bearerAuth: [] responses: '200': description: Event details retrieved successfully content: application/json: schema: type: object properties: id: type: string format: uuid description: Unique identifier for the event name: type: string description: Name of the event event_info: type: object properties: from: type: string format: date-time description: Event start time to: type: string format: date-time description: Event end time event_thumbnail_link: type: string description: Link for the event thumbnail is_online: type: boolean description: Indicates if the event is online event_link: type: string description: Link for the online event host_info: type: array items: properties: host_id: type: string format: uuid description: Id of the host host_name: type: string description: Name of the host host_avatar: type: string description: Avatar of the host description: List of host UUIDs details: type: string description: Details about the event tags: type: array items: type: object properties: id: type: string format: uuid description: Id of the tag name: type: string description: Name of the tag description: List of Tags location: type: object properties: latitude: type: string description: Latitude of the event location longitude: type: string description: Longitude of the event location name: type: string description: Name of the event location address: type: string description: Address of the event location street: type: string description: Street name of the event location locality: type: string description: Locality of the event location city: type: string description: City of the event location state: type: string description: State of the event location country: type: string description: Country of the event location photos: type: array items: type: object properties: id: type: string format: uuid description: Id of the photo url: type: string description: Path of the Photo description: List of photos '400': description: Invalid Request '401': description: Unauthorized '403': description: Forbidden '404': description: Not Found '500': description: Internal server error put: tags: - Event API summary: Update the event by ID operationId: updateEvent parameters: - name: event-id in: path required: true description: Unique identifier of the event schema: type: string format: uuid security: - bearerAuth: [] requestBody: description: Event details required: true content: application/json: schema: type: object properties: name: type: string description: Name of the event event_info: type: object properties: from: type: string format: date-time description: Event start time to: type: string format: date-time description: Event end time event_thumbnail_link: type: string description: Link for the event thumbnail is_online: type: boolean description: Indicates if the event is online event_link: type: string description: Link for the online event host_ids: type: array items: type: string format: uuid description: List of host UUIDs details: type: string description: Details about the event tags: type: array items: type: string description: List of Tags speaker: type: string description: Event Speaker location: type: object properties: latitude: type: string description: Latitude of the event location longitude: type: string description: Longitude of the event location name: type: string description: Name of the event location address: type: string description: Address of the event location street: type: string description: Street name of the event location locality: type: string description: Locality of the event location city: type: string description: City of the event location state: type: string description: State of the event location country: type: string description: Country of the event location required: - id - name - event_info - is_online - host_ids responses: '200': description: Event successfully updated '400': description: Invalid Request '401': description: Unauthorized '403': description: Forbidden '404': description: Not Found '500': description: Internal server error delete: tags: - Event API summary: Delete event by ID operationId: DeleteEventById parameters: - name: event-id in: path required: true description: Unique identifier of the event schema: type: string format: uuid security: - bearerAuth: [] responses: '200': description: Event Deleted successfully '400': description: Invalid Request '401': description: Unauthorized '403': description: Forbidden '404': description: Not Found '500': description: Internal server error /event-management/api/v1/events/{event-id}/upload-photos: patch: tags: - Event API summary: Upload event photos operationId: uploadPhoto parameters: - name: event-id in: path required: true description: Unique identifier of the event schema: type: string format: uuid security: - bearerAuth: [] requestBody: description: Photo details required: true content: application/json: schema: type: object properties: name: type: array items: type: string description: URL of photo description: List of Photos responses: '201': description: Photos added successfully '400': description: Invalid Request '401': description: Unauthorized '403': description: Forbidden '404': description: Not Found '500': description: Internal server error /event-management/api/v1/events/{event-id}/remove-photos: patch: tags: - Event API summary: Remove event photos operationId: removePhoto parameters: - name: event-id in: path required: true description: Unique identifier of the event schema: type: string format: uuid security: - bearerAuth: [] requestBody: description: Photo details required: true content: application/json: schema: type: object properties: name: type: array items: type: string format: uuid description: Id of the Photo description: List of Photos Id responses: '200': description: Photos Removed successfully '400': description: Invalid Request '401': description: Unauthorized '403': description: Forbidden '404': description: Not Found '500': description: Internal server error /event-management/api/v1/tags: get: tags: - Tag API summary: Get a list of Tags operationId: getTags security: - bearerAuth: [] responses: '200': description: List of Tags content: application/json: schema: type: object properties: tags: type: array items: type: object properties: id: type: string format: uuid description: Unique identifier for the tag name: type: string description: Name of the tag '400': description: Invalid Request '401': description: Unauthorized '403': description: Forbidden '404': description: Not Found '500': description: Internal server error /event-management/api/v1/events/{event-id}/comments: post: tags: - Comments API summary: Add a comment to an event operationId: addEventComment parameters: - name: event-id in: path required: true description: ID of the event schema: type: string requestBody: required: true content: application/json: schema: type: object properties: comment: type: string example: "This is a comment." required: - comment security: - bearerAuth: [] responses: '201': description: Comment added successfully content: application/json: schema: type: object properties: id: type: string format: uuid comment: type: string user_id: type: string format: uuid commented_on: type: string format: date-time '400': description: Invalid Request '401': description: Unauthorized '403': description: Forbidden '404': description: Not Found '500': description: Internal server error get: tags: - Comments API summary: Get comments for an event operationId: getEventComments parameters: - name: event-id in: path required: true description: ID of the event schema: type: string security: - bearerAuth: [] responses: '200': description: Successful response with a list of comments content: application/json: schema: type: object properties: comments: type: array items: type: object properties: id: type: string format: uuid user_id: type: string format: uuid user_avatar: type: string user_name: type: string comment: type: string commented_on: type: string format: date-time likes: type: integer format: int64 replies: type: array items: type: object properties: id: type: string format: uuid user_id: type: string format: uuid user_avatar: type: string user_name: type: string comment: type: string commented_on: type: string format: date-time likes: type: integer format: int64 total_items: type: integer format: int64 page: type: integer format: int64 page_size: type: integer format: int64 '400': description: Invalid Request '401': description: Unauthorized '403': description: Forbidden '404': description: Not Found '500': description: Internal server error /event-management/api/v1/events/{event-id}/comments/{comment-id}: delete: tags: - Comments API summary: Delete a comment operationId: deleteEventComment parameters: - name: event-id in: path required: true description: ID of the event schema: type: string - name: comment-id in: path required: true description: ID of the comment to be deleted schema: type: string security: - bearerAuth: [] responses: '200': description: Comment deleted successfully '400': description: Invalid Request '401': description: Unauthorized '403': description: Forbidden '404': description: Not Found '500': description: Internal server error /event-management/api/v1/events/{event-id}/comments/{comment-id}/like: patch: tags: - Comments API summary: Like a comment operationId: likeEventComment parameters: - name: event-id in: path required: true description: ID of the event schema: type: string - name: comment-id in: path required: true description: ID of the comment to be Liked schema: type: string security: - bearerAuth: [] responses: '200': description: Like addedd successfully '400': description: Invalid Request '401': description: Unauthorized '403': description: Forbidden '404': description: Not Found '500': description: Internal server error /event-management/api/v1/events/{event-id}/comments/{comment-id}/unlike: patch: tags: - Comments API summary: Unlike a comment operationId: unlikeEventComment parameters: - name: event-id in: path required: true description: ID of the event schema: type: string - name: comment-id in: path required: true description: ID of the comment to be Liked schema: type: string security: - bearerAuth: [] responses: '200': description: Unike addedd successfully '400': description: Invalid Request '401': description: Unauthorized '403': description: Forbidden '404': description: Not Found '500': description: Internal server error /event-management/api/v1/events/{event-id}/comments/{comment-id}/reply: post: tags: - Comments API summary: Reply to a comment operationId: addReply parameters: - name: event-id in: path required: true description: ID of the event schema: type: string - name: comment-id in: path required: true description: ID of the comment schema: type: string requestBody: required: true content: application/json: schema: type: object properties: comment: type: string example: "This is a reply." required: - comment security: - bearerAuth: [] responses: '201': description: Comment added successfully content: application/json: schema: type: object properties: id: type: string format: uuid comment: type: string user_id: type: string format: uuid commented_on: type: string format: date-time '400': description: Invalid Request '401': description: Unauthorized '403': description: Forbidden '404': description: Not Found '500': description: Internal server error /event-management/api/v1/events/{event-id}/reply/{reply-id}: delete: tags: - Comments API summary: Delete a reply operationId: deleteReply parameters: - name: event-id in: path required: true description: ID of the event schema: type: string - name: reply-id in: path required: true description: ID of the reply to be deleted schema: type: string security: - bearerAuth: [] responses: '200': description: Comment deleted successfully '400': description: Invalid Request '401': description: Unauthorized '403': description: Forbidden '404': description: Not Found '500': description: Internal server error /event-management/api/v1/events/{event-id}/reply/{reply-id}/like: patch: tags: - Comments API summary: Like a reply operationId: likeReply parameters: - name: event-id in: path required: true description: ID of the event schema: type: string - name: reply-id in: path required: true description: ID of the reply to be Liked schema: type: string security: - bearerAuth: [] responses: '200': description: Like addedd successfully '400': description: Invalid Request '401': description: Unauthorized '403': description: Forbidden '404': description: Not Found '500': description: Internal server error /event-management/api/v1/events/{event-id}/reply/{reply-id}/unlike: patch: tags: - Comments API summary: Unlike a reply operationId: unlikeEventComment parameters: - name: event-id in: path required: true description: ID of the event schema: type: string - name: reply-id in: path required: true description: ID of the reply to be Liked schema: type: string security: - bearerAuth: [] responses: '200': description: Unike addedd successfully '400': description: Invalid Request '401': description: Unauthorized '403': description: Forbidden '404': description: Not Found '500': description: Internal server error /event-management/api/v1/events/{event-id}/register: post: tags: - Attendee API summary: Register for event operationId: registerEvent parameters: - name: event-id in: path required: true description: Unique identifier of the event schema: type: string format: uuid security: - bearerAuth: [] responses: '201': description: Registered successfully '400': description: Invalid Request '401': description: Unauthorized '403': description: Forbidden '404': description: Not Found '500': description: Internal server error /event-management/api/v1/events/{event-id}/unregister: delete: tags: - Attendee API summary: Unregister for event operationId: unregisterEvent parameters: - name: event-id in: path required: true description: Unique identifier of the event schema: type: string format: uuid security: - bearerAuth: [] responses: '200': description: Unregistered successfully '400': description: Invalid Request '401': description: Unauthorized '403': description: Forbidden '404': description: Not Found '500': description: Internal server error components: securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: JWT ```

RudhraBharathy commented 1 month ago

@SixPathsSage upon reviewing the updated API Spec, this will be perfect for the MVP!!