-
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.
- Loading branch information
1 parent
b360a8d
commit c2d3081
Showing
10 changed files
with
187 additions
and
34 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 |
---|---|---|
@@ -1,5 +1,31 @@ | ||
import { PartialType } from '@nestjs/mapped-types'; | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { Status, Tag } from '@prisma/client'; | ||
import { Transform } from 'class-transformer'; | ||
import { IsString } from 'class-validator'; | ||
|
||
export class CreateJobDto {} | ||
|
||
export class UpdateJobDto extends PartialType(CreateJobDto) {} | ||
|
||
export class JobQueryDto { | ||
@ApiProperty({ required: false }) | ||
@IsString() | ||
search: string; | ||
|
||
@ApiProperty({ required: false }) | ||
@IsString() | ||
tag: Tag; | ||
|
||
@ApiProperty({ required: false }) | ||
@IsString() | ||
status: Status; | ||
|
||
@ApiProperty({ required: false }) | ||
@Transform(({ value }) => new Date(value).getTime()) | ||
startDate: Date; | ||
|
||
@ApiProperty({ required: false }) | ||
@Transform(({ value }) => new Date(value).getTime()) | ||
endDate: Date; | ||
} |
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,18 @@ | ||
import { faker } from '@faker-js/faker'; | ||
import { Status } from '@prisma/client'; | ||
|
||
const estimations = []; | ||
const status = Object.values(Status); | ||
|
||
for (let i = 0; i < 10; i ++) { | ||
const j = i + 1 | ||
estimations.push({ | ||
id: j, | ||
title: faker.lorem.word(), | ||
document: faker.system.commonFileName('pdf'), | ||
status: faker.helpers.arrayElement(status), | ||
jobId: j, | ||
}) | ||
} | ||
|
||
export { estimations }; |
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
21 changes: 21 additions & 0 deletions
21
server/src/models/migrations/20230901063422_add_estimation_model/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,21 @@ | ||
-- CreateEnum | ||
CREATE TYPE "Status" AS ENUM ('NOT_YET_CREATED', 'MAKING', 'APPROVED', 'SENT_TO_CUSTOMER', 'CLOSED'); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Estimation" ( | ||
"id" SERIAL NOT NULL, | ||
"title" TEXT NOT NULL, | ||
"document" TEXT NOT NULL, | ||
"status" "Status" NOT NULL, | ||
"jobId" INTEGER NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
|
||
CONSTRAINT "Estimation_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "Estimation_jobId_key" ON "Estimation"("jobId"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Estimation" ADD CONSTRAINT "Estimation_jobId_fkey" FOREIGN KEY ("jobId") REFERENCES "Job"("id") ON DELETE RESTRICT 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