|
1 | | -# Topcoder Billing Accounts & Clients API (NestJS + Prisma, CommonJS) |
| 1 | +# Topcoder Billing Accounts & Clients API (NestJS + Prisma) |
2 | 2 |
|
3 | | -**What you get:** |
4 | | -- NestJS project with CommonJS `tsconfig.json` |
| 3 | +**Project structure:** |
| 4 | +- NestJS project |
5 | 5 | - Prisma schema for Clients, Billing Accounts, Locked & Consumed amounts |
6 | 6 | - Endpoints: |
7 | | - - `GET /billing-accounts` (filter, sort, pagination, userId + clientId filters) |
8 | | - - `POST /billing-accounts` (Admin role or M2M scopes) |
| 7 | + - `GET /billing-accounts` |
| 8 | + - `POST /billing-accounts` |
9 | 9 | - `GET /billing-accounts/:billingAccountId` (includes locked/consumed arrays + budget totals) |
10 | 10 | - `PATCH /billing-accounts/:billingAccountId` |
11 | 11 | - `PATCH /billing-accounts/:billingAccountId/lock-amount` (0 amount = unlock) |
|
14 | 14 | - `GET /clients/:clientId` |
15 | 15 | - `PATCH /clients/:clientId` |
16 | 16 |
|
17 | | -**Auth** |
18 | | -- Express-style JWT middleware via `tc-core-library-js` attaches `req.authUser` |
19 | | -- Guards for Roles (e.g., `Administrator`) and Scopes (M2M) are provided. |
| 17 | +**Authorization** |
| 18 | +- JWT middleware via `tc-core-library-js` attaches `req.authUser` |
| 19 | +- Guards for Roles (e.g., `Administrator`) and M2M Scopes are provided. |
20 | 20 | - Configure env: `AUTH_SECRET` or `AUTH0_URL/AUDIENCE/ISSUER` as needed. |
21 | 21 |
|
22 | 22 | ## Quickstart |
|
25 | 25 | cp .env.example .env |
26 | 26 | # edit .env and set DATABASE_URL, auth vars, etc. |
27 | 27 |
|
28 | | -npm i |
29 | | -npm run prisma:generate |
30 | | -npm run prisma:migrate |
| 28 | +pnpm i |
| 29 | +pnpm run prisma:generate |
| 30 | +pnpm run prisma:migrate |
31 | 31 |
|
32 | | -npm run dev |
| 32 | +pnpm run dev |
33 | 33 | # or |
34 | | -npm run build && npm start |
| 34 | +pnpm run build && pnpm start |
35 | 35 | ``` |
36 | | - |
37 | | -> If you need integer IDs for billing accounts/clients, switch `id` fields in `prisma/schema.prisma` to `BigInt` and adjust DTOs accordingly. |
0 commit comments