Skip to content
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

Add Columns To Organization Project Employee Entity #8165

Merged
merged 62 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
624f188
feat: project entity additional fields
GloireMutaliko21 Sep 8, 2024
dd4ea46
fix: update project create input
GloireMutaliko21 Sep 8, 2024
b891d9b
feat: add postgres migration
GloireMutaliko21 Sep 8, 2024
e62256b
feat: add sqlite migration
GloireMutaliko21 Sep 8, 2024
c5b5f23
feat: add mysql migration
GloireMutaliko21 Sep 8, 2024
541bbb2
feat: refact project employee relations and APIs
GloireMutaliko21 Sep 8, 2024
b7afb62
feat: update project API
GloireMutaliko21 Sep 8, 2024
f3efe50
fix: missing module injection
GloireMutaliko21 Sep 8, 2024
c9f2b68
feat: organization project migrations
GloireMutaliko21 Sep 8, 2024
8bddfa9
refact: postgres migration
GloireMutaliko21 Sep 9, 2024
f243ceb
refact: project sqlite migration
GloireMutaliko21 Sep 9, 2024
8487090
Merge branch 'develop' into feat/project-add-management-fields
rahul-rocket Sep 9, 2024
18b5e2e
feat: mysql migration and fix module mysql migrations
GloireMutaliko21 Sep 9, 2024
970b8e9
Merge branch 'feat/project-add-management-fields' of https://github.c…
GloireMutaliko21 Sep 9, 2024
165ae8d
fix: build issues models
GloireMutaliko21 Sep 9, 2024
c2ffea9
fix: removed unnecessary code
rahul-rocket Sep 9, 2024
dc139fd
Merge branch 'develop' into feat/project-add-management-fields
rahul-rocket Sep 9, 2024
4ae5d45
Merge branch 'develop' into feat/project-add-management-fields
rahul-rocket Sep 10, 2024
4bb3099
fix: updated organization project DTOs
rahul-rocket Sep 10, 2024
a26e1c9
Merge branch 'develop' into feat/project-add-management-fields
rahul-rocket Sep 10, 2024
be36eee
Merge branch 'develop' into feat/project-add-management-fields
rahul-rocket Sep 10, 2024
77903d5
fix: updated migration for organization project member & manager
rahul-rocket Sep 10, 2024
6f925c4
Merge branch 'develop' into feat/project-add-management-fields
rahul-rocket Sep 11, 2024
63cda25
Merge branch 'develop' into feat/project-add-management-fields
rahul-rocket Sep 12, 2024
6244ff5
Merge branch 'develop' into feat/project-add-management-fields
rahul-rocket Sep 12, 2024
4b49076
Merge branch 'develop' into feat/project-add-management-fields
rahul-rocket Sep 13, 2024
7520751
Merge branch 'develop' into feat/project-add-management-fields
rahul-rocket Sep 15, 2024
0e3021b
feat: add table migration for PostgreSQL
rahul-rocket Sep 16, 2024
fab13e1
fix: updated project/contact mutation according new project employee …
rahul-rocket Sep 16, 2024
e271cb5
Merge branch 'develop' into feat/project-add-management-fields
rahul-rocket Sep 16, 2024
64d1ae7
Merge branch 'develop' into feat/project-add-management-fields
rahul-rocket Sep 16, 2024
51b0808
fix(deepscan): removed unused import
rahul-rocket Sep 16, 2024
1044e57
Merge branch 'develop' into feat/project-add-management-fields
rahul-rocket Sep 16, 2024
ac4d4c6
fix: add table migration for PostgreSQL
rahul-rocket Sep 16, 2024
db97958
fix: add table migration for MySQL
rahul-rocket Sep 17, 2024
c0df2f0
fix: add table migration for MySQL
rahul-rocket Sep 17, 2024
3180cf0
fix: add table up migration for MySQL
rahul-rocket Sep 17, 2024
ee0d369
fix: add table down migration for MySQL
rahul-rocket Sep 17, 2024
aef663b
fix: add table down migration for MySQL
rahul-rocket Sep 17, 2024
5ca9f76
fix: add table down migration for MySQL
rahul-rocket Sep 17, 2024
d3ab069
fix: add table down migration for MySQL
rahul-rocket Sep 17, 2024
4048c09
fix: organization project employee table up/down migration for MySQL
rahul-rocket Sep 17, 2024
1ba19a3
fix: add table down migration for SQLite
rahul-rocket Sep 17, 2024
1076b3d
fix: add table upmigration for SQLite
rahul-rocket Sep 17, 2024
eb766b7
fix: add table upmigration for SQLite
rahul-rocket Sep 17, 2024
7be3e8c
fix: add table down migration for SQLite
rahul-rocket Sep 17, 2024
3f708a4
fix: updated tenant & organization filter
rahul-rocket Sep 17, 2024
fb684d2
Merge branch 'develop' into feat/project-add-management-fields
rahul-rocket Sep 17, 2024
48049eb
fix: modify table up/down migration for MySQL
rahul-rocket Sep 18, 2024
076b095
fix: modify table up migration for MySQL
rahul-rocket Sep 18, 2024
38399b6
fix: modify table up migration for MySQL
rahul-rocket Sep 18, 2024
4f692a9
feat: alter organization project employee table migration for sqlite
rahul-rocket Sep 18, 2024
aae4ceb
fix: logging for postgres
rahul-rocket Sep 18, 2024
376fb82
fix: organization project members seeder
rahul-rocket Sep 19, 2024
fea4f7c
fix: removed unnecessary console.log
rahul-rocket Sep 19, 2024
847c3af
fix: migration missing createdAt and updatedAt
rahul-rocket Sep 19, 2024
3a0659c
fix: updated ID,. tenantId and organizationId
rahul-rocket Sep 19, 2024
d6d8901
Update 1726509769379-AddColumnsToOrganizationProjectEmployeeEntity
rahul-rocket Sep 20, 2024
eb77326
Update 1726509769379-AddColumnsToOrganizationProjectEmployeeEntity
rahul-rocket Sep 22, 2024
700450c
Update 1726509769379-AddColumnsToOrganizationProjectEmployeeEntity
rahul-rocket Sep 22, 2024
89d28ff
fix(deepscan): accessed without null check prior
rahul-rocket Sep 22, 2024
6ad4eea
fix: updated isManager and assignedAt
rahul-rocket Sep 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/contracts/src/base-entity.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export interface IBaseEntityModel extends IBaseSoftDeleteEntityModel {

isActive?: boolean; // Indicates if the record is currently active
isArchived?: boolean; // Indicates if the record is archived
// archivedAt?: Date; // Date when the record was archived
}

// Common properties for entities associated with a tenant
Expand Down
1 change: 1 addition & 0 deletions packages/contracts/src/employee.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export interface IEmployee extends IBasePerTenantAndOrganizationEntityModel, ITa
organizationDepartments?: IOrganizationDepartment[];
organizationContacts?: IOrganizationContact[];
projects?: IOrganizationProject[];
projectDefaultAssignments?: IOrganizationProject[];
organizationPosition?: IOrganizationPosition;
skills?: ISkill[];
awards?: IEmployeeAward[];
Expand Down
27 changes: 25 additions & 2 deletions packages/contracts/src/organization-projects.model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IEmployee } from './employee.model';
import { IEmployee, IRelationalEmployee } from './employee.model';
import { IOrganizationContact, IRelationalOrganizationContact } from './organization-contact.model';
import { CrudActionEnum, ProjectBillingEnum, ProjectOwnerEnum } from './organization.model';
import { ITag } from './tag.model';
Expand All @@ -12,6 +12,8 @@ import { IRelationalImageAsset } from './image-asset.model';
import { IOrganizationTeam } from './organization-team.model';
import { CustomFieldsObject } from './shared-types';
import { IOrganizationProjectModule } from './organization-project-module.model';
import { TaskStatusEnum } from './task-status.model';
import { IRelationalRole } from './role.model';

export interface IRelationalOrganizationProject {
project?: IOrganizationProject;
Expand All @@ -36,6 +38,7 @@ export interface IOrganizationProject
currency: CurrenciesEnum;
members?: IEmployee[];
public: boolean;
status?: TaskStatusEnum; // Defines the project stage / progression / step
tags: ITag[];
owner: ProjectOwnerEnum;
tasks?: ITask[];
Expand All @@ -50,6 +53,8 @@ export interface IOrganizationProject
description?: string;
// the color of project which is used in UI
color?: string;
// The project icon used on UI
icon?: string;
// is project billable?
billable?: boolean;
// true if the project is flat rate, false if the project is time / materials billable
Expand All @@ -61,6 +66,12 @@ export interface IOrganizationProject
budgetType?: OrganizationProjectBudgetTypeEnum;
membersCount?: number;
imageUrl?: string;
// Default project assignee
defaultAssignee?: IEmployee;
defaultAssigneeId?: ID;
// automation
archiveTasksIn?: number; // Expressed in months, all completed (done) and canceled tasks related to the project will be auto-archived after the period reached
closeTasksIn?: number; // Expressed in months, all completed (done) and canceled tasks related to the project will be auto-closed after the period reached
}

export enum TaskListTypeEnum {
Expand Down Expand Up @@ -94,19 +105,25 @@ export interface IOrganizationProjectCreateInput
billing?: ProjectBillingEnum;
currency?: CurrenciesEnum;
members?: IEmployee[];
managers?: IOrganizationProjectEmployee[];
public?: boolean;
icon?: string;
tags?: ITag[];
owner?: ProjectOwnerEnum;
code?: string;
description?: string;
color?: string;
billable?: boolean;
billingFlat?: boolean;
status?: string;
status?: TaskStatusEnum;
openSource?: boolean;
projectUrl?: string;
openSourceProjectUrl?: string;
taskListType?: TaskListTypeEnum;
defaultAssignee?: IEmployee;
defaultAssigneeId?: ID;
archiveTasksIn?: number;
closeTasksIn?: number;
}

export interface IOrganizationProjectUpdateInput extends IOrganizationProjectCreateInput, IOrganizationProjectSetting {
Expand All @@ -117,3 +134,9 @@ export interface IOrganizationProjectStoreState {
project: IOrganizationProject;
action: CrudActionEnum;
}

export interface IOrganizationProjectEmployee
extends IBasePerTenantAndOrganizationEntityModel,
IRelationalOrganizationProject,
IRelationalEmployee,
IRelationalRole {}
23 changes: 15 additions & 8 deletions packages/core/src/core/entities/base.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
// MIT License, see https://github.com/xmlking/ngx-starter-kit/blob/develop/LICENSE
// Copyright (c) 2018 Sumanth Chinthagunta

import {
PrimaryGeneratedColumn,
UpdateDateColumn,
CreateDateColumn,
DeleteDateColumn
} from 'typeorm';
import { PrimaryGeneratedColumn, UpdateDateColumn, CreateDateColumn, DeleteDateColumn } from 'typeorm';
import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsBoolean, IsDateString, IsOptional } from 'class-validator';
import { SoftDeletable } from 'mikro-orm-soft-delete';
Expand Down Expand Up @@ -70,7 +65,7 @@ export abstract class BaseEntity extends SoftDeletableBaseEntity implements IBas
@CreateDateColumn() // TypeORM decorator for creation date
@Property({
// Automatically set the property value when entity gets created, executed during flush operation.
onCreate: () => new Date(), // Set creation date on record creation
onCreate: () => new Date() // Set creation date on record creation
})
createdAt?: Date;

Expand All @@ -85,7 +80,7 @@ export abstract class BaseEntity extends SoftDeletableBaseEntity implements IBas
// Automatically set the property value when entity gets created, executed during flush operation.
onCreate: () => new Date(), // Set at record creation
// Automatically update the property value every time entity gets updated, executed during flush operation.
onUpdate: () => new Date(), // Update every time the entity is changed
onUpdate: () => new Date() // Update every time the entity is changed
})
updatedAt?: Date;

Expand All @@ -110,4 +105,16 @@ export abstract class BaseEntity extends SoftDeletableBaseEntity implements IBas
@ColumnIndex()
@MultiORMColumn({ nullable: true, default: false }) // TypeORM and Mikro-ORM compatibility
isArchived?: boolean;

// Indicates the date when record was archived
// @ApiPropertyOptional({
// type: 'string',
// format: 'date-time',
// example: '2018-11-21T06:20:32.232Z'
// })
// @IsOptional()
// @IsDateString()
// @ColumnIndex()
// @MultiORMColumn({ nullable: true })
// archivedAt?: Date;
rahul-rocket marked this conversation as resolved.
Show resolved Hide resolved
}
2 changes: 2 additions & 0 deletions packages/core/src/core/entities/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ import {
OrganizationLanguage,
OrganizationPosition,
OrganizationProject,
OrganizationProjectEmployee,
OrganizationProjectModule,
OrganizationRecurringExpense,
OrganizationSprint,
Expand Down Expand Up @@ -216,6 +217,7 @@ export const coreEntities = [
OrganizationLanguage,
OrganizationPosition,
OrganizationProject,
OrganizationProjectEmployee,
OrganizationProjectModule,
OrganizationRecurringExpense,
OrganizationSprint,
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/core/entities/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export * from '../../organization-employment-type/organization-employment-type.e
export * from '../../organization-language/organization-language.entity';
export * from '../../organization-position/organization-position.entity';
export * from '../../organization-project/organization-project.entity';
export * from '../../organization-project/organization-project-employee.entity';
export * from '../../organization-project-module/organization-project-module.entity';
export * from '../../organization-recurring-expense/organization-recurring-expense.entity';
export * from '../../organization-sprint/organization-sprint.entity';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,6 @@ export class CreateProjectModuleTable1724929664505 implements MigrationInterface
await queryRunner.query(
`CREATE TABLE \`project_module_employee\` (\`organizationProjectModuleId\` varchar(36) NOT NULL, \`employeeId\` varchar(36) NOT NULL, INDEX \`IDX_e9fd7310fc93849b1d55e64d28\` (\`organizationProjectModuleId\`), INDEX \`IDX_18e428e909e48a4b7df43d7e01\` (\`employeeId\`), PRIMARY KEY (\`organizationProjectModuleId\`, \`employeeId\`)) ENGINE=InnoDB`
);
await queryRunner.query(`ALTER TABLE \`issue_type\` ADD \`isDefault\` tinyint NOT NULL DEFAULT 0`);
rahul-rocket marked this conversation as resolved.
Show resolved Hide resolved
await queryRunner.query(`ALTER TABLE \`task\` ADD \`projectModuleId\` varchar(255) NULL`);
await queryRunner.query(`CREATE INDEX \`IDX_579534d8e12f22d308d6bd5f42\` ON \`task\` (\`projectModuleId\`)`);
await queryRunner.query(
Expand Down Expand Up @@ -744,7 +743,6 @@ export class CreateProjectModuleTable1724929664505 implements MigrationInterface
);
await queryRunner.query(`DROP INDEX \`IDX_579534d8e12f22d308d6bd5f42\` ON \`task\``);
await queryRunner.query(`ALTER TABLE \`task\` DROP COLUMN \`projectModuleId\``);
await queryRunner.query(`ALTER TABLE \`issue_type\` DROP COLUMN \`isDefault\``);
await queryRunner.query(`DROP INDEX \`IDX_18e428e909e48a4b7df43d7e01\` ON \`project_module_employee\``);
await queryRunner.query(`DROP INDEX \`IDX_e9fd7310fc93849b1d55e64d28\` ON \`project_module_employee\``);
await queryRunner.query(`DROP TABLE \`project_module_employee\``);
Expand Down
Loading
Loading