POST /api/category HTTP/1.1
Content-Type: application/json
{
"name": "New Category",
"activated": true
}
POST /api/users/:id/categorize (admin only)
Description: Adds a specific user (identified by their ID) to a category (specified in the request body).
Request Body:
{
"category_id": "string"
}
Example request:
POST /api/users/123/categorize HTTP/1.1
Content-Type: application/json
{
"category_id": "456"
}
``` (where 123 is the user's ID and 456 is the category ID)
POST /api/users/:id/uncategorize (admin only)
Description: Removes a specific user (identified by their ID) from a category (specified in the request body).
Request Body: (Same structure as POST /api/users/:id/categorize)
Example request: (Same structure as POST /api/users/:id/categorize)
POST /api/users/me/change_password
Description: Changes the password of the currently logged-in user.
Response: (Successful registration response may include details about the newly created user)
PUT Endpoints
PUT /api/users/:id (admin only)
Description: Edits information about a specific user (identified by their ID).
Request Body:
{
"email": "string",
"username": "string"
}
``` (Only the properties you want to update need to be included)
Example request:
PUT /api/users/123 HTTP/1.1
Content-Type: application/json
{
"email": "updated_email@example.com"
}
``` (where 123 is the user's ID)
PUT /api/category/:id (admin only)
Description: Edits information about a specific category (identified by its ID).
Request Body: (Same structure as PUT /api/users/:id)
PUT /api/users/me
Description: Edits information about the currently logged-in user.
Request Body: (Same structure as PUT /api/users/:id)
DELETE Endpoints
DELETE /category/:id (admin only)
Description: Deletes a specific category (identified by its ID).
Running the Project
Prerequisites:
PostgreSQL: Ensure you have PostgreSQL installed and running on your system.
Database Creation: Create a new database for your project.
Steps:
Execute Schema:
Navigate to the project directory in your terminal.
Run the following command to execute the schema.sql file and create the necessary tables in your database:
psql -d <your_database_name> < schema.sql
Replace <your_database_name> with the actual name of the database you created.
Set Environment Variable:
Set the DB_SOURCE_NAME environment variable to your PostgreSQL connection string. This string contains information about your database server, username, password, and database name.