Skip to content

Commit

Permalink
Merge pull request #173 from Black-Dot-2024/fix/RF58-Archivar-Proyecto
Browse files Browse the repository at this point in the history
Fix/rf58 archivar proyecto
  • Loading branch information
sebFlores02 authored May 11, 2024
2 parents e240658 + a1b241c commit 8038653
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "project" ADD COLUMN "is_archived" BOOLEAN NOT NULL DEFAULT false;
1 change: 1 addition & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ model project {
total_hours Decimal? @db.Decimal(8, 2)
periodicity String? @db.VarChar(256)
is_chargeable Boolean?
is_archived Boolean @default(false)
payed Boolean @default(false)
created_at DateTime @default(now()) @db.Timestamp(6)
updated_at DateTime? @updatedAt @db.Timestamp(6)
Expand Down
1 change: 1 addition & 0 deletions src/core/app/interfaces/project.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface UpdateProjectBody {
periodicity?: string | null;
area?: string | null;
isChargeable?: boolean | null;
isArchived?: boolean | null;
status: string;
totalHours?: Decimal | null;
payed?: boolean;
Expand Down
4 changes: 4 additions & 0 deletions src/core/app/services/__tests__/project.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ describe('ProjectService', () => {
endDate: new Date('2023-12-01T00:00:00.000Z'),
periodicity: '1 week',
isChargeable: true,
isArchived: false,
area: 'Client',
createdAt: new Date('2024-04-19T01:23:49.555Z'),
idCompany: clientId,
Expand Down Expand Up @@ -85,6 +86,7 @@ describe('ProjectService', () => {
endDate: new Date('2023-12-01T00:00:00.000Z'),
periodicity: ProjectPeriodicity.ONE_WEEK,
isChargeable: true,
isArchived: false,
area: SupportedDepartments.ACCOUNTING,
createdAt: new Date('2024-04-19T01:23:49.555Z'),
idCompany: clientUuid,
Expand All @@ -110,6 +112,7 @@ describe('ProjectService', () => {
endDate: new Date('2023-12-01T00:00:00.000Z'),
periodicity: '1 week',
isChargeable: true,
isArchived: false,
area: 'Client',
createdAt: new Date('2024-04-19T01:23:49.555Z'),
idCompany: randomUUID(),
Expand All @@ -126,6 +129,7 @@ describe('ProjectService', () => {
endDate: new Date('2023-12-01T00:00:00.000Z'),
periodicity: '1 week',
isChargeable: true,
isArchived: false,
area: 'Client',
createdAt: new Date('2024-04-19T01:23:49.555Z'),
idCompany: randomUUID(),
Expand Down
1 change: 1 addition & 0 deletions src/core/app/services/project.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ async function updateProject(body: UpdateProjectBody): Promise<ProjectEntity> {
area: body.area ?? project.area,
payed: body.payed,
isChargeable: body.isChargeable ?? project.isChargeable,
isArchived: body.isArchived ?? project.isArchived,
status: body.status ?? project.status,
createdAt: project.createdAt,
});
Expand Down
5 changes: 5 additions & 0 deletions src/core/domain/entities/project.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { Task } from './task.entity';
* @param totalHours?: Decimal - Project total hours (optional)
* @param periodicity?: string - Project periodicity (optional)
* @param isChargeable?: boolean - Determines whether the project is chargeable or not (optional)
* @param isArchived?: boolean - Determines whether the project can be archived or not (optional)
* @param area?: string - Project area (optional)
* @param createdAt: Date - Project creation date
* @param updatedAt?: Date - Project update date (optional)
Expand Down Expand Up @@ -70,6 +71,10 @@ export interface ProjectEntity {
* @param isChargeable: boolean - Determines whether the project is chargeable or not
*/
isChargeable?: boolean | null;
/**
* @param isArchived: boolean - Determines whether the project is chargeable or not
*/
isArchived?: boolean | null;
/**
* @param area: string - Project area
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export function mapProjectEntityFromDbModel(model: project): ProjectEntity {
totalHours: model.total_hours ? model.total_hours : undefined,
periodicity: model.periodicity,
isChargeable: model.is_chargeable,
isArchived: model.is_archived,
area: model.area ? model.area : undefined,
createdAt: model.created_at,
updatedAt: model.updated_at ? model.updated_at : undefined,
Expand Down
1 change: 1 addition & 0 deletions src/core/infra/repositories/project.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ async function updateProject(project: ProjectEntity): Promise<ProjectEntity> {
periodicity: project.periodicity,
area: project.area,
is_chargeable: project.isChargeable,
is_archived: project.isArchived ? project.isArchived : false,
status: project.status,
created_at: project.createdAt,
payed: project.payed,
Expand Down

0 comments on commit 8038653

Please sign in to comment.