Skip to content

Commit 356e039

Browse files
authored
Update README.md
1 parent 635e74a commit 356e039

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,71 @@ Automates getting coffee and snacks for tired devs
33

44

55
<img src="https://imgur.com/tsIoR7w.png" alt="feed-a-dev logo" width="200px"/>
6+
# API Endpoints
7+
8+
## Auth Routes
9+
| Method | Endpoint | Description | Auth Required | Request Body |
10+
|--------|----------|-------------|---------------|--------------|
11+
| POST | `/register` | Register new user (developer) | No | `{ "username": string, "password": string, "role": "developer" }` |
12+
| POST | `/register` | Register new user (project manager) | No | `{ "username": string, "password": string, "role": "project_manager" }` |
13+
| POST | `/login` | Authenticate user and get JWT | No | `{ "username": string, "password": string }` |
14+
15+
## Snack Routes
16+
| Method | Endpoint | Description | Auth Required | Request Body |
17+
|--------|----------|-------------|---------------|--------------|
18+
| POST | `/snack` | Create new snack | Yes | `{ "name": string, "category": string, "price": decimal, "image_url": string }` |
19+
| PATCH | `/snack/{id}` | Update snack (owner/admin) | Yes | `{ "name"?: string, "category"?: string, "price"?: decimal, "image_url"?: string }` |
20+
| DELETE | `/snack/{id}` | Delete snack (owner/admin) | Yes | None |
21+
| GET | `/snacks` | List snacks (filtered by role) | Yes | None |
22+
23+
## Relationship Routes
24+
| Method | Endpoint | Description | Auth Required | Request Body |
25+
|--------|----------|-------------|---------------|--------------|
26+
| POST | `/invite-pm` | Developer invites PM | Yes | `{ "project_manager_id": integer }` |
27+
| PATCH | `/respond-to-invite/{id}` | PM accepts/rejects invite | Yes | `{ "status": "accepted" \| "rejected" }` |
28+
| GET | `/my-developers` | PM lists accepted developers | Yes | None |
29+
30+
## Authentication
31+
Use Bearer token in Authorization header:
32+
```
33+
Authorization: Bearer <jwt_token>
34+
```
35+
36+
## Response Types
37+
38+
### User
39+
```typescript
40+
{
41+
id: number
42+
username: string
43+
role: "developer" | "project_manager" | "admin"
44+
created_at: string
45+
updated_at: string
46+
}
47+
```
48+
49+
### Snack
50+
```typescript
51+
{
52+
id: number
53+
name: string
54+
category: string
55+
price: decimal
56+
image_url: string
57+
created_at: string
58+
updated_at: string
59+
user_id: number
60+
}
61+
```
62+
63+
### Relationship
64+
```typescript
65+
{
66+
id: number
67+
developer_id: number
68+
project_manager_id: number
69+
status: "pending" | "accepted" | "rejected"
70+
created_at: string
71+
updated_at: string
72+
}
73+
```

0 commit comments

Comments
 (0)