You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: courses/backend/events-startup-project/requirements.md
+39-1Lines changed: 39 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ These requirements describe the overall functionality of the app. Some of these
22
22
-[x] 3.1 Users can add tickets to their shopping cart
23
23
-[ ] 3.2 Users can select ticket quantity when adding to cart
24
24
-[ ] 3.3 Items can be added, updated, or removed while in the cart
25
-
-[ ] 3.4 Cart is saved across the session (and beyond the session, if authenticated)
25
+
-[ ] 3.4 Cart is persisted in the backend for both authenticated and unauthenticated users
26
26
27
27
### 4. Checkout
28
28
@@ -62,3 +62,41 @@ You should use the technologies, skills, tools, and stack you've learned through
62
62
### API
63
63
64
64
We already have a very basic API in place, but it is missing many features that you will be required to implement. You can find the current API in the project template.
65
+
66
+
-[ ] API routes must be documented with Swagger / OpenAPI
67
+
-[ ] A Postman collection must be included for the implemented API
68
+
69
+
## Implementation Clarifications
70
+
71
+
These clarifications define the minimum expectations for this project. They are intended to remove ambiguity while still leaving room for implementation choices.
72
+
73
+
### Naming Guidance
74
+
75
+
- Because the program often prefers singular table names, avoid reserved SQL words by using more specific names where needed.
76
+
- For example, prefer names such as:
77
+
-`app_user` instead of `user`
78
+
-`customer_order` instead of `order`
79
+
- If you choose plural naming in your own schema, that is also acceptable as long as the schema is consistent and clear.
80
+
81
+
### Minimum API Expectations
82
+
83
+
- The public listing route should be `GET /api/events`.
84
+
- Search should be implemented through query parameters on the listing route, for example `GET /api/events?q=music&page=1&pageSize=20`.
85
+
- A separate `/search` route is not required.
86
+
-`PUT /api/cart/items/{itemId}` and `DELETE /api/cart/items/{itemId}` should identify a specific cart line, not the event itself.
87
+
- In the default project route design, `{itemId}` is a single cart line identifier.
88
+
- If a trainee intentionally chooses a composite-key cart-line design, the route shape should be adjusted accordingly and documented clearly.
89
+
- The cart line should store a reference to the related event.
90
+
91
+
### Cart and Checkout Simplifications
92
+
93
+
- The cart is backend-persisted in all cases.
94
+
- A cart may belong either to an authenticated user or to an unauthenticated user.
95
+
- A simple schema approach is to allow `cart.user_id` to be nullable until the cart is associated with a logged-in user.
96
+
- The project should enforce the rule that each authenticated user has at most one active cart.
97
+
- A database-level approach such as a unique constraint or partial unique index is recommended where supported by the chosen schema design.
98
+
- Trainees are not required to implement advanced race-condition handling beyond a reasonable database-backed solution for this course project.
99
+
- Ticket inventory is intentionally treated as unlimited in this backend project.
100
+
- Because inventory is unlimited, stock validation and overselling prevention are not required.
101
+
- During checkout, the minimum required atomic behavior is converting the active cart into an order and preventing further modification of that finalized order.
102
+
- Price snapshotting into the order data is recommended, but the exact checkout internals may be kept simple unless the implementation defines stricter business rules.
Copy file name to clipboardExpand all lines: courses/backend/events-startup-project/weekly-plan.md
+23-7Lines changed: 23 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
# Weekly Plan
2
2
3
3
This document outlines the expected weekly progress and milestones for completing the backend project.
4
-
The structure aligns with the Product Requirements Document (PRD), Shared API Contract, and Technical Specification.
4
+
The structure aligns with the Requirements document and the minimum API expectations documented in this project folder.
5
5
6
-
The goal is to progressively implement a fully functional, contract-compliant API with proper documentation, testing, and deployment.
6
+
The goal is to progressively implement a fully functional backend API with proper documentation, testing, and deployment.
7
7
8
8
---
9
9
@@ -19,10 +19,12 @@ Design and implement the foundational database schema for users and catalog enti
19
19
-[ ] Design ERD (v1) including:
20
20
-`user`
21
21
-`{domain}_item` (e.g. `event`)
22
+
-[ ] Naming hint: if you use singular table names, avoid reserved SQL words by choosing clearer names such as `app_user` instead of `user`
22
23
-[ ] Implement PostgreSQL schema with:
23
24
- Primary keys
24
25
- Foreign keys (where applicable)
25
26
- Proper constraints
27
+
-[ ] Start planning which relationships are required and which foreign keys may need to be optional, for example a cart that can exist before it is bound to a user
26
28
-[ ] Add seed data for:
27
29
- At least 1 test user
28
30
- Multiple catalog items
@@ -53,14 +55,22 @@ Finalize database structure to support cart, checkout, and order flows.
53
55
-`cart_item`
54
56
-`order`
55
57
-`order_item`
58
+
-[ ] Continue to avoid reserved SQL words in the schema, for example by using names such as `customer_order` instead of `order`
56
59
-[ ] Implement all foreign key relationships
57
-
-[ ] Enforce “one active cart per user” rule
60
+
-[ ] Design the cart so it can be persisted for both authenticated and unauthenticated users
61
+
-[ ] Decide which foreign keys and columns are required versus optional, for example whether `cart.user_id` is nullable until a cart is attached to an authenticated user
62
+
-[ ] Enforce “one active cart per authenticated user” rule
63
+
-[ ] Choose a cart-line key strategy:
64
+
- Project default: a simple single primary key such as `cartLineId`
65
+
- Alternative design: a composite key such as (`cartId`, `lineNo`)
66
+
-[ ] Design note: if you choose the alternative composite-key design, make sure your later endpoint design reflects it clearly
58
67
-[ ] Implement SQL queries for:
59
68
- Paginated item listing (`LIMIT`, sorting)
60
69
- Cart subtotal calculation
61
70
- Order totals snapshot logic
62
71
-[ ] Update ERD (v2)
63
72
-[ ] Add seed updates if needed
73
+
-[ ] Decide how the schema enforces one active cart per authenticated user
64
74
65
75
### Week 2 Outcome
66
76
@@ -81,9 +91,9 @@ Expose public catalog endpoints and implement initial API documentation.
81
91
-[ ] Set up Express application structure
82
92
-[ ] Connect application to PostgreSQL
83
93
-[ ] Implement public endpoints:
84
-
-`GET /api/{domain}` (paginated)
85
-
-`GET /api/{domain}/search`
86
-
-`GET /api/{domain}/{id}`
94
+
-`GET /api/events` (paginated)
95
+
-`GET /api/events/{id}`
96
+
-[ ] Support search through query parameters on `GET /api/events` (for example `?q=music&page=1&pageSize=20`)
87
97
-[ ] Implement pagination response format:
88
98
89
99
```json
@@ -129,6 +139,10 @@ Implement authentication and protected cart functionality.
129
139
-`GET /api/cart`
130
140
-`POST /api/cart/items`
131
141
-`PUT /api/cart/items/{itemId}`
142
+
-[ ] Treat `{itemId}` as the cart line identifier, not the catalog item identifier
143
+
-[ ] Project default: use the simple cart-line design with a single cart line id in routes such as `PUT /api/cart/items/{itemId}`
144
+
-[ ] Design note: if you intentionally choose the composite-key alternative from Week 2, your routes would typically become more explicit, for example `/api/carts/{cartId}/lines/{lineNo}`
145
+
-[ ] Support cart behavior for both guest and authenticated users using the backend-persisted cart model chosen in Week 2
0 commit comments