-
Couldn't load subscription status.
- Fork 1
V6 -> dev #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V6 -> dev #106
Changes from 39 commits
c670fca
99c18b7
9dfe7b3
52ef701
3148ae5
eb8f9f7
e0323e4
70a0cef
90723b9
cd7df02
41d75cc
cc7edf3
49c4dbe
9a03280
2312fde
1f2a1fe
06cc6ec
307eb89
ccce086
dfacc2c
686991d
eca223e
aecfeb8
c4ee0fe
de47623
eaabcb2
92a90df
dd9b090
bd3a8b2
5f2367e
ab66bce
7441a43
fe52f0a
62b571b
54f823d
d7d3012
668d89f
703b781
b9bfb17
8669b20
8e5835f
a47cee7
d0dd104
e97e88c
8882254
69a4c1b
65efd48
41b4914
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| /* | ||
| Warnings: | ||
| - You are about to drop the `reward` table. If the table is not empty, all the data it contains will be lost. | ||
| */ | ||
| -- DropForeignKey | ||
| ALTER TABLE "reward" DROP CONSTRAINT "reward_winnings_id_fkey"; | ||
|
|
||
| -- DropTable | ||
| DROP TABLE "reward"; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /* | ||
| Warnings: | ||
| - You are about to drop the `payoneer_payment_method` table. If the table is not empty, all the data it contains will be lost. | ||
| - You are about to drop the `paypal_payment_method` table. If the table is not empty, all the data it contains will be lost. | ||
| */ | ||
| -- DropForeignKey | ||
| ALTER TABLE "payoneer_payment_method" DROP CONSTRAINT "fk_payoneer_user_payment_method"; | ||
|
|
||
| -- DropForeignKey | ||
| ALTER TABLE "paypal_payment_method" DROP CONSTRAINT "fk_paypal_user_payment_method"; | ||
|
|
||
| -- DropTable | ||
| DROP TABLE "payoneer_payment_method"; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
|
|
||
| -- DropTable | ||
| DROP TABLE "paypal_payment_method"; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| CREATE TABLE "challenge_lock" ( | ||
| "id" SERIAL PRIMARY KEY, | ||
| "external_id" VARCHAR(255) NOT NULL UNIQUE, | ||
| "lock_time" TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| "error" TEXT | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| ); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,45 +103,11 @@ model payment_releases { | |
| payment_method payment_method @relation(fields: [payment_method_id], references: [payment_method_id], onDelete: NoAction, onUpdate: NoAction) | ||
| } | ||
|
|
||
| model payoneer_payment_method { | ||
| id Int @id @default(autoincrement()) | ||
| user_payment_method_id String? @db.Uuid | ||
| user_id String @unique @db.VarChar(80) | ||
| payee_id String @db.VarChar(50) | ||
| payoneer_id String? @db.VarChar(50) | ||
| user_payment_methods user_payment_methods? @relation(fields: [user_payment_method_id], references: [id], onDelete: Cascade, onUpdate: NoAction, map: "fk_payoneer_user_payment_method") | ||
| } | ||
|
|
||
| model paypal_payment_method { | ||
| id Int @id @default(autoincrement()) | ||
| user_payment_method_id String? @db.Uuid | ||
| user_id String @unique @db.VarChar(80) | ||
| email String? @db.VarChar(150) | ||
| payer_id String? @db.VarChar(50) | ||
| country_code String? @db.VarChar(2) | ||
| user_payment_methods user_payment_methods? @relation(fields: [user_payment_method_id], references: [id], onDelete: Cascade, onUpdate: NoAction, map: "fk_paypal_user_payment_method") | ||
| } | ||
|
|
||
| model reward { | ||
| reward_id String @id @default(dbgenerated("uuid_generate_v4()")) @db.Uuid | ||
| winnings_id String @db.Uuid | ||
| points Int? | ||
| title String? @db.VarChar(255) | ||
| description String? | ||
| reference Json? | ||
| attributes Json? | ||
| created_at DateTime? @default(now()) @db.Timestamp(6) | ||
| updated_at DateTime? @default(now()) @db.Timestamp(6) | ||
| winnings winnings @relation(fields: [winnings_id], references: [winning_id], onDelete: NoAction, onUpdate: NoAction) | ||
| } | ||
|
|
||
| model user_payment_methods { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| id String @id @default(dbgenerated("uuid_generate_v4()")) @db.Uuid | ||
| user_id String @db.VarChar(80) | ||
| payment_method_id Int | ||
| status payment_method_status? @default(OTP_PENDING) | ||
| payoneer_payment_method payoneer_payment_method[] | ||
| paypal_payment_method paypal_payment_method[] | ||
| trolley_payment_method trolley_recipient[] | ||
| payment_method payment_method @relation(fields: [payment_method_id], references: [payment_method_id], onDelete: NoAction, onUpdate: NoAction, map: "fk_user_payment_method") | ||
|
|
||
|
|
@@ -172,7 +138,6 @@ model winnings { | |
| updated_at DateTime? @default(now()) @db.Timestamp(6) | ||
| audit audit[] | ||
| payment payment[] | ||
| reward reward[] | ||
| origin origin? @relation(fields: [origin_id], references: [origin_id], onDelete: NoAction, onUpdate: NoAction) | ||
|
|
||
| @@index([category, created_at(sort: Desc)], map: "idx_winnings_category_created_at") | ||
|
|
@@ -223,6 +188,13 @@ model trolley_recipient_payment_method { | |
| trolley_recipient trolley_recipient @relation(fields: [trolley_recipient_id], references: [id], onDelete: Cascade, onUpdate: NoAction, map: "fk_trolley_recipient_trolley_recipient_payment_method") | ||
| } | ||
|
|
||
| model challenge_lock { | ||
| id Int @id @default(autoincrement()) | ||
| external_id String @unique @db.VarChar(255) | ||
| lock_time DateTime @default(now()) @db.Timestamp(6) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| error String? @db.Text | ||
| } | ||
|
|
||
| enum verification_status { | ||
| ACTIVE | ||
| INACTIVE | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import { | ||
| Controller, | ||
| Get, | ||
| Param, | ||
| Query, | ||
| Req, | ||
| } from '@nestjs/common'; | ||
| import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger'; | ||
| import { AllowedM2mScope, Roles, User } from 'src/core/auth/decorators'; | ||
| import { M2mScope, Role } from 'src/core/auth/auth.constants'; | ||
| import { UserInfo } from 'src/dto/user.type'; | ||
| import { ChallengePaymentsService } from './challenge-payments.service'; | ||
|
|
||
| @ApiTags('Payments') | ||
| @Controller('/challenge-payments') | ||
| @ApiBearerAuth() | ||
| export class ChallengePaymentsController { | ||
| constructor( | ||
| private readonly challengePaymentsService: ChallengePaymentsService, | ||
| ) {} | ||
|
|
||
| @Get('/:challengeId') | ||
| @AllowedM2mScope(M2mScope.ReadPayments, M2mScope.CreatePayments) | ||
| @Roles(Role.PaymentAdmin, Role.PaymentEditor, Role.PaymentViewer, Role.User) | ||
| @ApiOperation({ | ||
| summary: | ||
| 'List payments (winnings) for a challenge with role-aware filtering', | ||
| }) | ||
| async getChallengePayments( | ||
| @Param('challengeId') challengeId: string, | ||
| @Query('winnerOnly') winnerOnly: string | undefined, | ||
| @User() user: UserInfo, | ||
| @Req() req: any, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| ) { | ||
| return this.challengePaymentsService.listChallengePayments({ | ||
| challengeId, | ||
| requestUserId: user?.id, | ||
| isMachineToken: Boolean(req?.m2mTokenScope), | ||
| winnerOnly: (winnerOnly || '').toLowerCase() === 'true', | ||
| auth0User: req?.auth0User, | ||
| }); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { Module } from '@nestjs/common'; | ||
| import { ChallengePaymentsController } from './challenge-payments.controller'; | ||
| import { ChallengePaymentsService } from './challenge-payments.service'; | ||
| import { TopcoderModule } from 'src/shared/topcoder/topcoder.module'; | ||
|
|
||
| @Module({ | ||
| imports: [TopcoderModule], | ||
| controllers: [ChallengePaymentsController], | ||
| providers: [ChallengePaymentsService], | ||
| }) | ||
| export class ChallengePaymentsModule {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[❗❗
correctness]Renaming
TOPCODER_API_BASE_URLtoTOPCODER_API_V5_BASE_URLimproves clarity by specifying the API version. Ensure that all references to the old variable name are updated throughout the codebase to prevent runtime errors.