- Project Overview
- Tech Stack
- Installation Guide
- Database Models
- 4.1 User
- 4.2 Colour
- 4.3 Collection
- 4.4 ColourCollection
- 4.5 Comment
- Endpoints
- 5.1 Colour Endpoints
- 5.2 User Endpoints
This project is a backend API for managing colour-related data, including users, collections, and comments. It is built using ASP.NET Core and EF Core, connected to a PostgreSQL database. The API provides endpoints for CRUD operations on users, colours, collections, and comments, with support for associating colours with collections and users.
- Backend: ASP.NET Core
- Database: PostgreSQL
- ORM: Entity Framework Core
- API Documentation: Swagger
- CORS: Configured to allow requests from the frontend
{
"id": 1,
"hex": "#FF5733"
}id(int): Unique identifierhex(string): Hexadecimal color code
{
"id": 1,
"name": "John Doe",
"email": "john@example.com",
"createdAt": "2024-01-15T10:30:00Z"
}id(int): Unique identifiername(string): User's full nameemail(string): User's email addresscreatedAt(datetime): Account creation timestamp
{
"id": 1,
"type": "palette",
"isPublic": true,
"userId": 1,
"name": "Summer Vibes",
"description": "Warm and bright colors",
"createdAt": "2024-01-20T15:45:00Z"
}id(int): Unique identifiertype(string): Collection typeisPublic(bool): Visibility flaguserId(int): Creator's user IDname(string): Collection namedescription(string): Optional descriptioncreatedAt(datetime): Collection creation timestamp
{
"id": 1,
"colourId": 5,
"collectionId": 3,
"order": 2
}id(int): Unique identifiercolourId(int): Referenced color IDcollectionId(int): Referenced collection IDorder(int): Color placement order
{
"id": 1,
"userId": 2,
"collectionId": 1,
"content": "Love these colors!",
"createdAt": "2024-01-22T09:15:00Z"
}id(int): Unique identifieruserId(int): Commenter's user IDcollectionId(int): Commented collection IDcontent(string): Comment textcreatedAt(datetime): Comment timestamp
- Description: Retrieve all colors
- Parameters: None
- Response:
[
{"id": 1, "hex": "#FF5733"},
{"id": 2, "hex": "#33FF57"}
]- Status Codes:
- 200 OK: Successful retrieval
- 500 Internal Server Error: Unexpected error
- Description: Retrieve specific color by ID
- Parameters:
id(path parameter, integer): Color's unique identifier
- Response:
{"id": 1, "hex": "#FF5733"}- Status Codes:
- 200 OK: Color found
- 404 Not Found: Color doesn't exist
- Description: Create a new color
- Request Body:
{"hex": "#4433FF"}- Response:
{"id": 3, "hex": "#4433FF"}- Status Codes:
- 201 Created: Color successfully added
- 400 Bad Request: Invalid input
- 500 Internal Server Error: Unexpected error
- Description: Retrieve all users
- Parameters: None
- Response:
[
{"id": 1, "name": "John Doe", "email": "john@example.com"},
{"id": 2, "name": "Jane Smith", "email": "jane@example.com"}
]- Status Codes:
- 200 OK: Successful retrieval
- 500 Internal Server Error: Unexpected error
- Description: Retrieve specific user by ID
- Parameters:
id(path parameter, integer): User's unique identifier
- Response:
{"id": 1, "name": "John Doe", "email": "john@example.com"}- Status Codes:
- 200 OK: User found
- 404 Not Found: User doesn't exist
- Description: Create a new user
- Request Body:
{
"name": "Alice Johnson",
"email": "alice@example.com",
"hash": "hashedpassword123"
}- Response:
{
"id": 3,
"name": "Alice Johnson",
"email": "alice@example.com"
}- Status Codes:
- 201 Created: User successfully added
- 400 Bad Request: Invalid input
- 500 Internal Server Error: Unexpected error