-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #223 from chingu-x/feature/solo-project-endpoints
Solo project GET all endpoint
- Loading branch information
Showing
21 changed files
with
623 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
key - a more user friendly name for sort field | ||
value - prisma sort field | ||
sorting is only supported for fields listed here | ||
*/ | ||
export const soloProjectSortMap: Map<string, string> = new Map( | ||
Object.entries({ | ||
status: "statusId", | ||
createdAt: "createdAt", | ||
updatedAt: "updatedAt", | ||
}), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Prisma } from "@prisma/client"; | ||
import { userSelectBasicWithSocial } from "@/global/selects/users.select"; | ||
|
||
export type SoloProjectWithPayload = Prisma.SoloProjectGetPayload<{ | ||
include: { | ||
user: { | ||
include: typeof userSelectBasicWithSocial; | ||
}; | ||
evaluator: { | ||
include: typeof userSelectBasicWithSocial; | ||
}; | ||
status: true; | ||
comments: true; | ||
responseGroup: { | ||
select: { | ||
responses: { | ||
include: { | ||
question: true; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Prisma } from "@prisma/client"; | ||
|
||
export type UserWithProfile = Prisma.UserGetPayload<{ | ||
include: { | ||
oAuthProfiles: { | ||
select: { | ||
provider: true; | ||
providerId: true; | ||
providerUserId: true; | ||
providerUsername: true; | ||
}; | ||
}; | ||
}; | ||
}>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// This pipe is used to set a default value for a parameter in a route handler. | ||
// Without the pipe, controller returns NaN for optional query, results in default value (in service files) not being applied | ||
|
||
import { | ||
ArgumentMetadata, | ||
BadRequestException, | ||
Injectable, | ||
PipeTransform, | ||
} from "@nestjs/common"; | ||
|
||
@Injectable() | ||
export class NonNegativeIntDefaultValuePipe implements PipeTransform { | ||
constructor(private readonly defaultValue: number) {} | ||
|
||
transform(value: string, metadata: ArgumentMetadata): any { | ||
const val = parseInt(value, 10); | ||
if (val < 0) | ||
throw new BadRequestException( | ||
`Invalid ${metadata.data} value. ${metadata.data} must be non negative.`, | ||
); | ||
return isNaN(val) ? this.defaultValue : val; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export class CreateSoloProjectDto {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { PartialType } from "@nestjs/swagger"; | ||
import { CreateSoloProjectDto } from "./create-solo-project.dto"; | ||
|
||
export class UpdateSoloProjectDto extends PartialType(CreateSoloProjectDto) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export class SoloProject {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Test, TestingModule } from "@nestjs/testing"; | ||
import { SoloProjectsController } from "./solo-projects.controller"; | ||
import { SoloProjectsService } from "./solo-projects.service"; | ||
|
||
describe("SoloProjectsController", () => { | ||
let controller: SoloProjectsController; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
controllers: [SoloProjectsController], | ||
providers: [SoloProjectsService], | ||
}).compile(); | ||
|
||
controller = module.get<SoloProjectsController>(SoloProjectsController); | ||
}); | ||
|
||
xit("should be defined", () => { | ||
expect(controller).toBeDefined(); | ||
}); | ||
}); |
Oops, something went wrong.