Skip to content

Commit 88ba3df

Browse files
authored
Merge pull request #133 from topcoder-platform/engagements
Updates to allow Task managers to create payments -> dev
2 parents 8e6383f + dfa03f6 commit 88ba3df

File tree

7 files changed

+12
-3
lines changed

7 files changed

+12
-3
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ workflows:
7474
branches:
7575
only:
7676
- dev
77+
- engagements
7778
- 'build-prod':
7879
context: org-global
7980
filters:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ The API uses role-based access control with the following roles:
311311
- `User` - Regular authenticated users (withdrawals, view own data)
312312
- `PaymentAdmin` - Full administrative access
313313
- `PaymentEditor` - Edit payments and winnings
314+
- `TaskManager` - Create and manage engagement winnings
314315
- `PaymentViewer` - Read-only access to payment data
315316
- `M2M` - Machine-to-machine service access
316317

docs/ARCHITECTURE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Controllers handle HTTP requests and route them to appropriate services:
107107

108108
- User winnings CRUD operations
109109
- View personal winnings history
110-
- Requires: `User` role
110+
- Requires: `User` role for member endpoints; create winnings requires `PaymentAdmin`, `PaymentEditor`, or `TaskManager` roles
111111

112112
**WithdrawalController** (`/v5/finance/withdraw`)
113113

@@ -217,6 +217,7 @@ Controllers handle HTTP requests and route them to appropriate services:
217217
- `RolesGuard` - Role-based access control
218218
- `TokenValidatorMiddleware` - Token parsing and extraction
219219
- Supports both user JWT and M2M tokens
220+
- Roles include `User`, `PaymentAdmin`, `PaymentEditor`, `PaymentViewer`, and `TaskManager`
220221

221222
**Request Context**
222223

prisma/schema.prisma

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ enum winnings_category {
312312
CONTENT_CREATION_PAYMENT
313313
DIGITAL_RUN_V2_PAYMENT_TAXABLE
314314
DIGITAL_RUN_V2_TOP_PERFORMERS_PAYMENT_TAXABLE
315+
ENGAGEMENT_PAYMENT
315316
CONTEST_CHECKPOINT_PAYMENT
316317
CONTEST_PAYMENT
317318
MARATHON_MATCH_NON_TAXABLE_PAYMENT
@@ -329,5 +330,6 @@ enum winnings_category {
329330
enum winnings_type {
330331
PAYMENT
331332
REWARD
333+
ENGAGEMENT
332334
POINTS
333335
}

src/api/winnings/winnings.controller.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ export class WinningsController {
3030

3131
@Post()
3232
@AllowedM2mScope(M2mScope.CreatePayments)
33-
@Roles(Role.PaymentAdmin, Role.PaymentEditor)
33+
@Roles(Role.PaymentAdmin, Role.PaymentEditor, Role.TaskManager)
3434
@ApiOperation({
3535
summary: 'Create winning with payments.',
36-
description: 'User must have "create:payments" scope to access.',
36+
description:
37+
'User must have "create:payments" scope or Payment Admin, Payment Editor, or Task Manager role to access.',
3738
})
3839
@ApiBody({
3940
description: 'Winning request body',

src/core/auth/auth.constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export enum Role {
22
PaymentAdmin = 'Payment Admin',
33
PaymentEditor = 'Payment Editor',
44
PaymentViewer = 'Payment Viewer',
5+
TaskManager = 'Task Manager',
56
User = 'Topcoder User',
67
}
78

src/dto/winning.dto.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020

2121
export enum WinningsType {
2222
PAYMENT = 'PAYMENT',
23+
ENGAGEMENT = 'ENGAGEMENT',
2324
POINTS = 'POINTS',
2425
}
2526

@@ -85,6 +86,7 @@ export enum WinningsCategory {
8586
CONTENT_CREATION_PAYMENT = 'CONTENT_CREATION_PAYMENT',
8687
DIGITAL_RUN_V2_PAYMENT_TAXABLE = 'DIGITAL_RUN_V2_PAYMENT_TAXABLE',
8788
DIGITAL_RUN_V2_TOP_PERFORMERS_PAYMENT_TAXABLE = 'DIGITAL_RUN_V2_TOP_PERFORMERS_PAYMENT_TAXABLE',
89+
ENGAGEMENT_PAYMENT = 'ENGAGEMENT_PAYMENT',
8890
CONTEST_CHECKPOINT_PAYMENT = 'CONTEST_CHECKPOINT_PAYMENT',
8991
CONTEST_PAYMENT = 'CONTEST_PAYMENT',
9092
MARATHON_MATCH_NON_TAXABLE_PAYMENT = 'MARATHON_MATCH_NON_TAXABLE_PAYMENT',

0 commit comments

Comments
 (0)