-
Notifications
You must be signed in to change notification settings - Fork 581
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into fix/project-module-table
- Loading branch information
Showing
12 changed files
with
949 additions
and
108 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,19 +1,30 @@ | ||
import { IBasePerTenantAndOrganizationEntityModel, ID } from './base-entity.model'; | ||
import { IUser } from './user.model'; | ||
import { ActorTypeEnum, IBasePerTenantAndOrganizationEntityModel, ID, OmitFields } from './base-entity.model'; | ||
import { IEmployeeEntityInput } from './employee.model'; | ||
|
||
export interface IReaction extends IBasePerTenantAndOrganizationEntityModel { | ||
/** | ||
* Reaction entity interface | ||
*/ | ||
export interface IReaction extends IBasePerTenantAndOrganizationEntityModel, IEmployeeEntityInput { | ||
entity: ReactionEntityEnum; | ||
entityId: ID; // Indicate the ID of entity record reaction related to | ||
emoji: string; | ||
creator?: IUser; | ||
creatorId?: ID; // The reaction's employee author ID | ||
actorType?: ActorTypeEnum; // Will be stored as 0 or 1 in DB | ||
} | ||
|
||
/** | ||
* Reaction entity enum | ||
*/ | ||
export enum ReactionEntityEnum { | ||
Comment = 'Comment', | ||
Task = 'Task' | ||
} | ||
|
||
export interface IReactionCreateInput extends Omit<IReaction, 'creatorId'> {} | ||
/** | ||
* Reaction create input interface | ||
*/ | ||
export interface IReactionCreateInput extends OmitFields<IReaction, 'employee' | 'employeeId'> {} | ||
|
||
export interface IReactionUpdateInput extends Pick<IReaction, 'emoji'> {} | ||
/** | ||
* Reaction update input interface | ||
*/ | ||
export interface IReactionUpdateInput extends IBasePerTenantAndOrganizationEntityModel, Pick<IReaction, 'emoji'> {} |
95 changes: 95 additions & 0 deletions
95
packages/core/src/lib/database/migrations/1739264215793-AlterReactionTableUsingEmployeeId.ts
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,95 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
import * as chalk from 'chalk'; | ||
import { DatabaseTypeEnum } from '@gauzy/config'; | ||
|
||
export class AlterReactionTableUsingEmployeeId1739264215793 implements MigrationInterface { | ||
name = 'AlterReactionTableUsingEmployeeId1739264215793'; | ||
|
||
/** | ||
* Up Migration | ||
* | ||
* @param queryRunner | ||
*/ | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
console.log(chalk.yellow(this.name + ' start running!')); | ||
|
||
switch (queryRunner.connection.options.type) { | ||
case DatabaseTypeEnum.sqlite: | ||
case DatabaseTypeEnum.betterSqlite3: | ||
await this.sqliteUpQueryRunner(queryRunner); | ||
break; | ||
case DatabaseTypeEnum.postgres: | ||
await this.postgresUpQueryRunner(queryRunner); | ||
break; | ||
case DatabaseTypeEnum.mysql: | ||
await this.mysqlUpQueryRunner(queryRunner); | ||
break; | ||
default: | ||
throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); | ||
} | ||
} | ||
|
||
/** | ||
* Down Migration | ||
* | ||
* @param queryRunner | ||
*/ | ||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
switch (queryRunner.connection.options.type) { | ||
case DatabaseTypeEnum.sqlite: | ||
case DatabaseTypeEnum.betterSqlite3: | ||
await this.sqliteDownQueryRunner(queryRunner); | ||
break; | ||
case DatabaseTypeEnum.postgres: | ||
await this.postgresDownQueryRunner(queryRunner); | ||
break; | ||
case DatabaseTypeEnum.mysql: | ||
await this.mysqlDownQueryRunner(queryRunner); | ||
break; | ||
default: | ||
throw Error(`Unsupported database: ${queryRunner.connection.options.type}`); | ||
} | ||
} | ||
|
||
/** | ||
* PostgresDB Up Migration | ||
* | ||
* @param queryRunner | ||
*/ | ||
public async postgresUpQueryRunner(queryRunner: QueryRunner): Promise<any> {} | ||
|
||
/** | ||
* PostgresDB Down Migration | ||
* | ||
* @param queryRunner | ||
*/ | ||
public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise<any> {} | ||
|
||
/** | ||
* SqliteDB and BetterSQlite3DB Up Migration | ||
* | ||
* @param queryRunner | ||
*/ | ||
public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise<any> {} | ||
|
||
/** | ||
* SqliteDB and BetterSQlite3DB Down Migration | ||
* | ||
* @param queryRunner | ||
*/ | ||
public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise<any> {} | ||
|
||
/** | ||
* MySQL Up Migration | ||
* | ||
* @param queryRunner | ||
*/ | ||
public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise<any> {} | ||
|
||
/** | ||
* MySQL Down Migration | ||
* | ||
* @param queryRunner | ||
*/ | ||
public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise<any> {} | ||
} |
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.