-
Notifications
You must be signed in to change notification settings - Fork 0
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 #52 from richard483/fix-1
fix username update validation, update contract schema, completed rat…
- Loading branch information
Showing
18 changed files
with
349 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
# User controller | ||
|
||
--- | ||
|
||
[UserRatingAverageCount](#userRatingAverageCount) | ||
|
||
## get user rating average&count (update authorized user) | ||
|
||
| Key | Description | | ||
| ------ | ------------- | | ||
| Method | `GET` | | ||
| Path | `/rating/averageCount/:userId` | | ||
|
||
### Success Response | ||
|
||
HTTP Code: 200 | ||
|
||
```json | ||
{ | ||
"status": true, | ||
"statusCode": 200, | ||
"data": { | ||
"_avg": { | ||
"ratingOf10": 6 | ||
}, | ||
"_count": { | ||
"ratingOf10": 4 | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### Invalid credential | ||
|
||
HTTP Code: 401 | ||
|
||
```json | ||
{ | ||
"status": true, | ||
"statusCode": 401, | ||
"data": { | ||
"access": "UNAUTHORIZED" | ||
} | ||
} | ||
``` | ||
|
||
### user not found | ||
|
||
HTTP Code: 200 | ||
|
||
```json | ||
{ | ||
"status": true, | ||
"statusCode": 200, | ||
"data": { | ||
"_avg": { | ||
"ratingOf10": null | ||
}, | ||
"_count": { | ||
"ratingOf10": 0 | ||
} | ||
} | ||
} | ||
|
||
``` | ||
|
||
--- | ||
|
||
# User controller | ||
|
||
--- | ||
|
||
[CreateUserRating](#createUserRating) | ||
|
||
## get user rating average&count (update authorized user) | ||
|
||
| Key | Description | | ||
| ------ | ------------- | | ||
| Method | `POST` | | ||
| Path | `/rating/craete` | | ||
|
||
### Request Body | ||
|
||
| Key | Type | | ||
| ---------- | ------ | | ||
| `userId` | String | | ||
| `recruiterUserId` | String | | ||
| `ratingOf10` | number | | ||
| `contractId` | String? | | ||
|
||
### Success Response | ||
|
||
HTTP Code: 200 | ||
|
||
```json | ||
{ | ||
"status": true, | ||
"statusCode": 200, | ||
"data": { | ||
"id": "de67c8bd-8637-4aa0-9983-31c602896672", | ||
"userId": "5c03f41e-5c18-4ef2-adf2-9ef560c34ca0", | ||
"recruiterUserId": "741c71e9-94dc-4ad8-98a6-9259c6b72f88", | ||
"ratingOf10": 9, | ||
"createdAt": "2024-01-15T16:16:41.196Z", | ||
"updatedAt": "2024-01-15T16:16:41.196Z" | ||
} | ||
} | ||
``` | ||
|
||
### Invalid credential | ||
|
||
HTTP Code: 401 | ||
|
||
```json | ||
{ | ||
"status": true, | ||
"statusCode": 401, | ||
"data": { | ||
"access": "UNAUTHORIZED" | ||
} | ||
} | ||
``` | ||
|
||
### invalid field | ||
|
||
HTTP Code: 400 | ||
|
||
```json | ||
{ | ||
"status": false, | ||
"statusCode": 400, | ||
"message": { | ||
"name": "PrismaClientKnownRequestError", | ||
"code": "P2003", | ||
"clientVersion": "5.7.1", | ||
"meta": { | ||
"modelName": "Rating", | ||
"field_name": "Rating_userId_fkey (index)" | ||
} | ||
}, | ||
"error": "BAD_REQUEST" | ||
} | ||
|
||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
6 changes: 6 additions & 0 deletions
6
prisma/migrations/20240115160307_updated_contract/migration.sql
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,6 @@ | ||
-- AlterTable | ||
ALTER TABLE "Contract" ADD COLUMN "ratingId" TEXT, | ||
ADD COLUMN "workSubmission" TEXT; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Contract" ADD CONSTRAINT "Contract_ratingId_fkey" FOREIGN KEY ("ratingId") REFERENCES "Rating"("id") ON DELETE SET NULL ON UPDATE CASCADE; |
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,51 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { IsNotEmpty, IsNumber, IsOptional, IsString } from 'class-validator'; | ||
|
||
export class ContractUpdateDto { | ||
@ApiProperty() | ||
@IsString() | ||
@IsNotEmpty({ | ||
message: 'MUST_NOT_BE_EMPTY', | ||
}) | ||
readonly id: string; | ||
|
||
@ApiProperty() | ||
@IsString() | ||
@IsOptional() | ||
readonly userId: string; | ||
|
||
@ApiProperty() | ||
@IsString() | ||
@IsOptional() | ||
readonly jobId: string; | ||
|
||
@ApiProperty() | ||
@IsString() | ||
@IsOptional() | ||
readonly title: string; | ||
|
||
@ApiProperty() | ||
@IsString() | ||
@IsOptional() | ||
readonly description: string; | ||
|
||
@ApiProperty() | ||
@IsNumber() | ||
@IsOptional() | ||
readonly paymentRate: number; | ||
|
||
@ApiProperty() | ||
@IsString() | ||
@IsOptional() | ||
readonly paymentRequestId?: string; | ||
|
||
@ApiProperty() | ||
@IsString() | ||
@IsOptional() | ||
readonly template?: string; | ||
|
||
@ApiProperty() | ||
@IsString() | ||
@IsOptional() | ||
readonly customField?: string; | ||
} |
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
Oops, something went wrong.