Implement a feature to create an Event for a particular organization and store the event in the Event's table referencing the Organization by Id it is created for.
Acceptance Criteria
The endpoint should be accessible at /api/v1/:orgId/create_event
The endpoint should accept HTTP POST Request.
The endpoint allows authenticated users to create an event.
The endpoint allows only designated members of that organization to create an event.
It returns a 201 status code on successful creation of an event.
It returns a 404 status code if the organization is not found or has been deactivated.
It returns a 400 status code when the request data is invalid.
It returns a 401 status code if the user is not authenticated or designated to create an event.
Purpose
Allows verified organizations to create events for the members in their organization.
Requirements
Create a database schema to store events.
Develope API for creating events for an organization.
Events are connected (linked) to an organization and the user that created it.
Ensure data validation before storing to database.
Handle error exception and return appropriate status code.
Data Schema
Database schema for storing events.
CREATE TABLE EventsTable (
id VARCHAR(255) PRIMARY KEY DEFAULT uuid_generate_v4(),
user_id INT REFERENCES users(id),
organisation_id INT REFERENCES organisations(id),
event_name VARCHAR(255),
event_description TEXT,
event_location VARCHAR(255),
event_expiry DATE,
event_time TIME,
event_date DATE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
Description
Implement a feature to create an Event for a particular organization and store the event in the Event's table referencing the Organization by Id it is created for.
Acceptance Criteria
/api/v1/:orgId/create_event
POST
Request.201
status code on successful creation of an event.404
status code if the organization is not found or has been deactivated.400
status code when the request data is invalid.401
status code if the user is not authenticated or designated to create an event.Purpose
Allows verified organizations to create events for the members in their organization.
Requirements
Data Schema
Database schema for storing events.
API Endpoint
Request Body
Response Body
Error Response
Expected Outcome
Designated users for an organization should be able to create event(s) for their organization members.
Tasks
Testing