Repository: ever-co/ever-gauzy
Pull request #8838: [Fix] Alter "RequestApproval" Entity Table
Author: login: rahul-rocket
Created: 2025-03-04T08:07:43Z | Merged: 2025-03-04T09:08:15Z

# PR

- [x] Have you followed the [contributing guidelines](https://github.com/ever-co/ever-gauzy/blob/master/.github/CONTRIBUTING.md)?
- [x] Have you explained what your changes do, and why they add value?

**Please note: we will close your PR without comment if you do not check the boxes above and provide ALL requested information.**

---


<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **Refactor**
	- Updated approvals display to show clearer creator information.
	- Streamlined workflows for equipment sharing, request approvals, and time off requests, resulting in smoother operations.
	- Enhanced entity creation processes by ensuring creator's ID is set before saving.
	- Improved clarity and efficiency in handling request approvals and time off requests.
- **Chore**
	- Standardized API route definitions for improved consistency.
	- Enhanced database migration processes to ensure reliable data handling.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->


Diff:
diff --git a/apps/gauzy/src/app/pages/approvals/approvals.component.ts b/apps/gauzy/src/app/pages/approvals/approvals.component.ts
index 8c9e3ecc8e4..10b6bfda8b9 100644
--- a/apps/gauzy/src/app/pages/approvals/approvals.component.ts
+++ b/apps/gauzy/src/app/pages/approvals/approvals.component.ts
@@ -10,7 +10,6 @@ import { NbDialogService } from '@nebular/theme';
 import { pluck } from 'underscore';
 import {
 	ComponentLayoutStyleEnum,
-	IApprovalsData,
 	IOrganization,
 	IRequestApproval,
 	RequestApprovalStatusTypesEnum
@@ -41,7 +40,6 @@ export class ApprovalsComponent extends PaginationFilterBaseComponent implements
 	public settingsSmartTable: object;
 	public loading: boolean;
 	public selectedRequestApproval: IRequestApproval;
-	public listApprovals: IApprovalsData[] = [];
 	public disableButton = true;
 	public smartTableSource = new LocalDataSource();
 	public hasEditPermission = false;
@@ -239,14 +237,13 @@ export class ApprovalsComponent extends PaginationFilterBaseComponent implements
 						instance.value = cell.getRawValue();
 					}
 				},
-				createdByName: {
+				createdByUser: {
 					title: this.getTranslation('APPROVAL_REQUEST_PAGE.CREATED_BY'),
 					type: 'custom',
 					isFilterable: false,
 					renderComponent: CreatedByUserComponent<IRequestApproval>,
 					componentInitFunction: (instance: CreatedByUserComponent<IRequestApproval>, cell: Cell) => {
 						instance.rowData = cell.getRow().getData();
-						instance.value = cell.getRawValue();
 					}
 				},
 				createdAt: {
diff --git a/packages/contracts/src/lib/equipment-sharing.model.ts b/packages/contracts/src/lib/equipment-sharing.model.ts
index 8c9d95157ca..e487606e0dc 100644
--- a/packages/contracts/src/lib/equipment-sharing.model.ts
+++ b/packages/contracts/src/lib/equipment-sharing.model.ts
@@ -36,7 +36,7 @@ export interface IEquipmentSharingCreateInput extends IBaseEquipmentSharing {
 }
 
 // Update input can simply extend the create input.
-export interface IEquipmentSharingUpdateInput extends IEquipmentSharingCreateInput {}
+export interface IEquipmentSharingUpdateInput extends Partial<IEquipmentSharingCreateInput> {}
 
 export enum EquipmentSharingStatusEnum {
 	REQUESTED = 'REQUESTED',
diff --git a/packages/contracts/src/lib/request-approval.model.ts b/packages/contracts/src/lib/request-approval.model.ts
index 38c8e1dd0c8..a6e5add7b76 100644
--- a/packages/contracts/src/lib/request-approval.model.ts
+++ b/packages/contracts/src/lib/request-approval.model.ts
@@ -1,40 +1,10 @@
-import { IBasePerTenantAndOrganizationEntityModel } from './base-entity.model';
+import { IBasePerTenantAndOrganizationEntityModel, ID } from './base-entity.model';
 import { IRequestApprovalEmployee } from './request-approval-employee.model';
 import { IEmployee } from './employee.model';
 import { IOrganizationTeam } from './organization-team.model';
 import { IRequestApprovalTeam } from './request-approval-team.model';
-import { IApprovalPolicy } from './approval-policy.model';
-import { ITag } from './tag.model';
-
-export interface IRequestApproval extends IBasePerTenantAndOrganizationEntityModel {
-	name: string;
-	status: number;
-	createdBy: string;
-	createdByName: string;
-	min_count: number;
-	requestId: string;
-	requestType: string;
-	approvalPolicy: IApprovalPolicy;
-	approvalPolicyId: string;
-	employeeApprovals?: IRequestApprovalEmployee[];
-	teamApprovals?: IRequestApprovalTeam[];
-	tags?: ITag[];
-	employees?: IEmployee[];
-	teams?: IOrganizationTeam[];
-}
-
-export interface IRequestApprovalCreateInput extends IBasePerTenantAndOrganizationEntityModel {
-	id?: string;
-	employeeApprovals?: IRequestApprovalEmployee[];
-	teamApprovals?: IRequestApprovalTeam[];
-	teams?: IOrganizationTeam[];
-	employees?: IEmployee[];
-	name?: string;
-	min_count?: number;
-	status?: number;
-	approvalPolicyId?: string;
-	tags?: ITag[];
-}
+import { ApprovalPolicyTypesStringEnum, IApprovalPolicy } from './approval-policy.model';
+import { ITaggable } from './tag.model';
 
 export enum RequestApprovalStatusTypesEnum {
 	REQUESTED = 1,
@@ -48,11 +18,28 @@ export const RequestApprovalStatus = {
 	REFUSED: 3
 };
 
-export interface IRequestApprovalFindInput extends IBasePerTenantAndOrganizationEntityModel {
-	id?: string;
+export interface IBaseRequestApprovalProperties extends IBasePerTenantAndOrganizationEntityModel {
+	name: string;
+	min_count: number;
+	approvalPolicyId?: ID;
+	approvalPolicy?: IApprovalPolicy;
+}
+
+interface IRequestApprovalAssociations extends ITaggable {
+	employeeApprovals?: IRequestApprovalEmployee[];
+	teamApprovals?: IRequestApprovalTeam[];
+	employees?: IEmployee[];
+	teams?: IOrganizationTeam[];
+}
+
+export interface IRequestApproval extends IBaseRequestApprovalProperties, IRequestApprovalAssociations {
+	status: number;
+	requestId: ID;
+	requestType: ApprovalPolicyTypesStringEnum;
 }
 
-export interface IApprovalsData {
-	icon: string;
-	title: string;
+export interface IRequestApprovalCreateInput extends IBaseRequestApprovalProperties, IRequestApprovalAssociations {
+	status?: number;
 }
+
+export interface IRequestApprovalFindInput extends IBasePerTenantAndOrganizationEntityModel {}
diff --git a/packages/core/src/lib/database/migrations/1741071424998-AlterRequestApprovalEntityTable.ts b/packages/core/src/lib/database/migrations/1741071424998-AlterRequestApprovalEntityTable.ts
new file mode 100644
index 00000000000..8830632dda2
--- /dev/null
+++ b/packages/core/src/lib/database/migrations/1741071424998-AlterRequestApprovalEntityTable.ts
@@ -0,0 +1,403 @@
+import { MigrationInterface, QueryRunner } from 'typeorm';
+import * as chalk from 'chalk';
+import { DatabaseTypeEnum } from '@gauzy/config';
+
+export class AlterRequestApprovalEntityTable1741071424998 implements MigrationInterface {
+	name = 'AlterRequestApprovalEntityTable1741071424998';
+
+	/**
+	 * 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> {
+		// Step 1: Copy data from "createdBy" to "createdByUserId"
+		console.log('Step 1: Copying data from createdBy to createdByUserId');
+		await queryRunner.query(`UPDATE "request_approval" SET "createdByUserId" = "createdBy"::uuid`);
+
+		// Step 2: Drop the old "createdBy" column.
+		console.log('Step 2: Dropping column createdBy');
+		await queryRunner.query(`ALTER TABLE "request_approval" DROP COLUMN "createdBy"`);
+
+		// Step 3: Drop the old "createdByName" column.
+		console.log('Step 3: Dropping column createdByName');
+		await queryRunner.query(`ALTER TABLE "request_approval" DROP COLUMN "createdByName"`);
+	}
+
+	/**
+	 * PostgresDB Down Migration
+	 *
+	 * @param queryRunner
+	 */
+	public async postgresDownQueryRunner(queryRunner: QueryRunner): Promise<any> {
+		// Step 1: Re-add the "createdByName" column.
+		console.log('Step 1: Adding column createdByName');
+		await queryRunner.query(`ALTER TABLE "request_approval" ADD "createdByName" character varying`);
+
+		// Step 2: Re-add the "createdBy" column.
+		console.log('Step 2: Adding column createdBy');
+		await queryRunner.query(`ALTER TABLE "request_approval" ADD "createdBy" character varying`);
+
+		// Step 3: Copy data from "createdByUserId" to "createdBy", casting UUID to text.
+		console.log('Step 3: Copying data from createdByUserId to createdBy with casting to text');
+		await queryRunner.query(`UPDATE "request_approval" SET "createdBy" = "createdByUserId"::text`);
+	}
+
+	/**
+	 * SqliteDB and BetterSQlite3DB Up Migration
+	 *
+	 * @param queryRunner
+	 */
+	public async sqliteUpQueryRunner(queryRunner: QueryRunner): Promise<any> {
+		// Step 1: Drop existing indexes.
+		console.log('Step 1: Dropping existing indexes');
+		await queryRunner.query(`DROP INDEX "IDX_d383e220a98ca0c1413bc00e0d"`);
+		await queryRunner.query(`DROP INDEX "IDX_95a94c342eb56b844616d6bb29"`);
+		await queryRunner.query(`DROP INDEX "IDX_26bb3420001d31337393ed05bc"`);
+		await queryRunner.query(`DROP INDEX "IDX_c63fafc733ff8ab37dede8ffec"`);
+		await queryRunner.query(`DROP INDEX "IDX_8343741e7929043b2a7de89f73"`);
+		await queryRunner.query(`DROP INDEX "IDX_9feaa23ed7bc47d51315e304bb"`);
+		await queryRunner.query(`DROP INDEX "IDX_db152600f88a9a4888df0b626e"`);
+		await queryRunner.query(`DROP INDEX "IDX_c77295d7f5d6086c815de3c120"`);
+		await queryRunner.query(`DROP INDEX "IDX_2cfc197cc78c994f77574af388"`);
+
+		// Step 2: Create temporary table.
+		console.log('Step 2: Creating "temporary_request_approval" table');
+		await queryRunner.query(`
+			CREATE TABLE "temporary_request_approval" (
+				"id" varchar PRIMARY KEY NOT NULL,
+				"createdAt" datetime NOT NULL DEFAULT (datetime('now')),
+				"updatedAt" datetime NOT NULL DEFAULT (datetime('now')),
+				"tenantId" varchar,
+				"organizationId" varchar,
+				"name" varchar NOT NULL,
+				"status" integer,
+				"min_count" integer,
+				"requestId" varchar,
+				"requestType" varchar,
+				"approvalPolicyId" varchar,
+				"isActive" boolean DEFAULT (1),
+				"isArchived" boolean DEFAULT (0),
+				"deletedAt" datetime,
+				"archivedAt" datetime,
+				"createdByUserId" varchar,
+				"updatedByUserId" varchar,
+				"deletedByUserId" varchar,
+				CONSTRAINT "FK_d383e220a98ca0c1413bc00e0d2" FOREIGN KEY ("deletedByUserId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
+				CONSTRAINT "FK_95a94c342eb56b844616d6bb29e" FOREIGN KEY ("createdByUserId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
+				CONSTRAINT "FK_26bb3420001d31337393ed05bc3" FOREIGN KEY ("approvalPolicyId") REFERENCES "approval_policy" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
+				CONSTRAINT "FK_8343741e7929043b2a7de89f739" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
+				CONSTRAINT "FK_9feaa23ed7bc47d51315e304bb5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
+				CONSTRAINT "FK_2cfc197cc78c994f77574af3887" FOREIGN KEY ("updatedByUserId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
+			)
+		`);
+
+		// Step 3: Copy data from the old table to the temporary table and update the createdByUserId.
+		console.log('Step 3: Copying data to "temporary_request_approval" and updating the createdByUserId');
+		await queryRunner.query(`
+			UPDATE "temporary_request_approval"
+			SET "createdByUserId" = (
+				SELECT "createdBy"
+				FROM "request_approval"
+				WHERE "request_approval"."id" = "temporary_request_approval"."id"
+			)
+		`);
+
+		// Step 4: Copy data from the old table to the temporary table.
+		console.log('Step 4: Copying data from "request_approval" to "temporary_request_approval"');
+		await queryRunner.query(`
+			INSERT INTO "temporary_request_approval" (
+			  "id",
+				"createdAt",
+				"updatedAt",
+				"tenantId",
+				"organizationId",
+				"name",
+				"status",
+				"min_count",
+				"requestId",
+				"requestType",
+				"approvalPolicyId",
+				"isActive",
+				"isArchived",
+				"deletedAt",
+				"archivedAt",
+				"createdByUserId",
+				"updatedByUserId",
+				"deletedByUserId"
+			)
+			SELECT
+				"id",
+				"createdAt",
+				"updatedAt",
+				"tenantId",
+				"organizationId",
+				"name",
+				"status",
+				"min_count",
+				"requestId",
+				"requestType",
+				"approvalPolicyId",
+				"isActive",
+				"isArchived",
+				"deletedAt",
+				"archivedAt",
+				"createdByUserId",
+				"updatedByUserId",
+				"deletedByUserId"
+			FROM "request_approval"
+		`);
+
+		// Step 5: Drop the original request_approval table.
+		console.log('Step 5: Dropping original "request_approval" table');
+		await queryRunner.query(`DROP TABLE "request_approval"`);
+
+		// Step 6: Rename temporary_request_approval to request_approval.
+		console.log('Step 6: Renaming "temporary_request_approval" to "request_approval"');
+		await queryRunner.query(`ALTER TABLE "temporary_request_approval" RENAME TO "request_approval"`);
+
+		// Step 7: Recreate indexes on the new request_approval table.
+		console.log('Step 7: Recreating indexes on "request_approval"');
+		await queryRunner.query(
+			`CREATE INDEX "IDX_d383e220a98ca0c1413bc00e0d" ON "request_approval" ("deletedByUserId") `
+		);
+		await queryRunner.query(
+			`CREATE INDEX "IDX_95a94c342eb56b844616d6bb29" ON "request_approval" ("createdByUserId") `
+		);
+		await queryRunner.query(
+			`CREATE INDEX "IDX_26bb3420001d31337393ed05bc" ON "request_approval" ("approvalPolicyId") `
+		);
+		await queryRunner.query(`CREATE INDEX "IDX_c63fafc733ff8ab37dede8ffec" ON "request_approval" ("name") `);
+		await queryRunner.query(
+			`CREATE INDEX "IDX_8343741e7929043b2a7de89f73" ON "request_approval" ("organizationId") `
+		);
+		await queryRunner.query(`CREATE INDEX "IDX_9feaa23ed7bc47d51315e304bb" ON "request_approval" ("tenantId") `);
+		await queryRunner.query(`CREATE INDEX "IDX_db152600f88a9a4888df0b626e" ON "request_approval" ("isActive") `);
+		await queryRunner.query(`CREATE INDEX "IDX_c77295d7f5d6086c815de3c120" ON "request_approval" ("isArchived") `);
+		await queryRunner.query(
+			`CREATE INDEX "IDX_2cfc197cc78c994f77574af388" ON "request_approval" ("updatedByUserId") `
+		);
+	}
+
+	/**
+	 * SqliteDB and BetterSQlite3DB Down Migration
+	 *
+	 * @param queryRunner
+	 */
+	public async sqliteDownQueryRunner(queryRunner: QueryRunner): Promise<any> {
+		// Step 1: Drop existing indexes.
+		console.log('Step 1: Dropping existing indexes');
+		await queryRunner.query(`DROP INDEX "IDX_2cfc197cc78c994f77574af388"`);
+		await queryRunner.query(`DROP INDEX "IDX_c77295d7f5d6086c815de3c120"`);
+		await queryRunner.query(`DROP INDEX "IDX_db152600f88a9a4888df0b626e"`);
+		await queryRunner.query(`DROP INDEX "IDX_9feaa23ed7bc47d51315e304bb"`);
+		await queryRunner.query(`DROP INDEX "IDX_8343741e7929043b2a7de89f73"`);
+		await queryRunner.query(`DROP INDEX "IDX_c63fafc733ff8ab37dede8ffec"`);
+		await queryRunner.query(`DROP INDEX "IDX_26bb3420001d31337393ed05bc"`);
+		await queryRunner.query(`DROP INDEX "IDX_95a94c342eb56b844616d6bb29"`);
+		await queryRunner.query(`DROP INDEX "IDX_d383e220a98ca0c1413bc00e0d"`);
+
+		// Step 2: Rename the current request_approval table to temporary_request_approval.
+		console.log('Step 2: Renaming "request_approval" to "temporary_request_approval"');
+		await queryRunner.query(`ALTER TABLE "request_approval" RENAME TO "temporary_request_approval"`);
+
+		// Step 3: Create the new request_approval table with legacy columns re-added.
+		console.log('Step 3: Creating new "request_approval" table with legacy columns');
+		await queryRunner.query(`
+			CREATE TABLE "request_approval" (
+				"id" varchar PRIMARY KEY NOT NULL,
+				"createdAt" datetime NOT NULL DEFAULT (datetime('now')),
+				"updatedAt" datetime NOT NULL DEFAULT (datetime('now')),
+				"tenantId" varchar,
+				"organizationId" varchar,
+				"name" varchar NOT NULL,
+				"status" integer,
+				"createdBy" varchar,
+				"createdByName" varchar,
+				"min_count" integer,
+				"requestId" varchar,
+				"requestType" varchar,
+				"approvalPolicyId" varchar,
+				"isActive" boolean DEFAULT (1),
+				"isArchived" boolean DEFAULT (0),
+				"deletedAt" datetime,
+				"archivedAt" datetime,
+				"createdByUserId" varchar,
+				"updatedByUserId" varchar,
+				"deletedByUserId" varchar,
+				CONSTRAINT "FK_d383e220a98ca0c1413bc00e0d2" FOREIGN KEY ("deletedByUserId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
+				CONSTRAINT "FK_95a94c342eb56b844616d6bb29e" FOREIGN KEY ("createdByUserId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
+				CONSTRAINT "FK_26bb3420001d31337393ed05bc3" FOREIGN KEY ("approvalPolicyId") REFERENCES "approval_policy" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
+				CONSTRAINT "FK_8343741e7929043b2a7de89f739" FOREIGN KEY ("organizationId") REFERENCES "organization" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
+				CONSTRAINT "FK_9feaa23ed7bc47d51315e304bb5" FOREIGN KEY ("tenantId") REFERENCES "tenant" ("id") ON DELETE CASCADE ON UPDATE NO ACTION,
+				CONSTRAINT "FK_2cfc197cc78c994f77574af3887" FOREIGN KEY ("updatedByUserId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
+			)
+		`);
+
+		// Step 4: Copy data from the old table to the temporary table and update the createdByUserId.
+		console.log('Step 4: Copying data to "temporary_request_approval" and updating the createdByUserId');
+		await queryRunner.query(`
+			UPDATE "request_approval"
+			SET "createdBy" = (
+				SELECT "createdByUserId"
+				FROM "temporary_request_approval"
+				WHERE "temporary_request_approval"."id" = "request_approval"."id"
+			)
+		`);
+
+		// Step 5: Copy data from the temporary_request_approval table into the new request_approval table.
+		console.log('Step 5: Copying data from "temporary_request_approval" to new "request_approval"');
+		await queryRunner.query(`
+			INSERT INTO "request_approval" (
+				"id",
+				"createdAt",
+				"updatedAt",
+				"tenantId",
+				"organizationId",
+				"name",
+				"status",
+				"min_count",
+				"requestId",
+				"requestType",
+				"approvalPolicyId",
+				"isActive",
+				"isArchived",
+				"deletedAt",
+				"archivedAt",
+				"createdByUserId",
+				"updatedByUserId",
+				"deletedByUserId"
+			)
+			SELECT
+				"id",
+				"createdAt",
+				"updatedAt",
+				"tenantId",
+				"organizationId",
+				"name",
+				"status",
+				"min_count",
+				"requestId",
+				"requestType",
+				"approvalPolicyId",
+				"isActive",
+				"isArchived",
+				"deletedAt",
+				"archivedAt",
+				"createdByUserId",
+				"updatedByUserId",
+				"deletedByUserId"
+			FROM "temporary_request_approval"
+		`);
+
+		// Step 6: Drop the temporary_request_approval table.
+		console.log('Step 6: Dropping "temporary_request_approval" table');
+		await queryRunner.query(`DROP TABLE "temporary_request_approval"`);
+
+		// Step 7: Recreate indexes on the new request_approval table.
+		console.log('Step 7: Recreating indexes on "request_approval"');
+		await queryRunner.query(
+			`CREATE INDEX "IDX_2cfc197cc78c994f77574af388" ON "request_approval" ("updatedByUserId") `
+		);
+		await queryRunner.query(`CREATE INDEX "IDX_c77295d7f5d6086c815de3c120" ON "request_approval" ("isArchived") `);
+		await queryRunner.query(`CREATE INDEX "IDX_db152600f88a9a4888df0b626e" ON "request_approval" ("isActive") `);
+		await queryRunner.query(`CREATE INDEX "IDX_9feaa23ed7bc47d51315e304bb" ON "request_approval" ("tenantId") `);
+		await queryRunner.query(
+			`CREATE INDEX "IDX_8343741e7929043b2a7de89f73" ON "request_approval" ("organizationId") `
+		);
+		await queryRunner.query(`CREATE INDEX "IDX_c63fafc733ff8ab37dede8ffec" ON "request_approval" ("name") `);
+		await queryRunner.query(
+			`CREATE INDEX "IDX_26bb3420001d31337393ed05bc" ON "request_approval" ("approvalPolicyId") `
+		);
+		await queryRunner.query(
+			`CREATE INDEX "IDX_95a94c342eb56b844616d6bb29" ON "request_approval" ("createdByUserId") `
+		);
+		await queryRunner.query(
+			`CREATE INDEX "IDX_d383e220a98ca0c1413bc00e0d" ON "request_approval" ("deletedByUserId") `
+		);
+	}
+
+	/**
+	 * MySQL Up Migration
+	 *
+	 * @param queryRunner
+	 */
+	public async mysqlUpQueryRunner(queryRunner: QueryRunner): Promise<any> {
+		// Step 1: Copy data from "createdBy" to "createdByUserId"
+		console.log('Step 1: Copying data from createdBy to createdByUserId');
+		await queryRunner.query(`UPDATE \`request_approval\` SET \`createdByUserId\` = \`createdBy\``);
+
+		// Step 2: Drop the "createdBy" column
+		console.log('Step 2: Dropping column createdBy');
+		await queryRunner.query(`ALTER TABLE \`request_approval\` DROP COLUMN \`createdBy\``);
+
+		// Step 3: Drop the "createdByName" column
+		console.log('Step 3: Dropping column createdByName');
+		await queryRunner.query(`ALTER TABLE \`request_approval\` DROP COLUMN \`createdByName\``);
+	}
+
+	/**
+	 * MySQL Down Migration
+	 *
+	 * @param queryRunner
+	 */
+	public async mysqlDownQueryRunner(queryRunner: QueryRunner): Promise<any> {
+		// Step 1: Adding column "createdByName"
+		console.log('Step 1: Adding column "createdByName"');
+		await queryRunner.query(`ALTER TABLE \`request_approval\` ADD \`createdByName\` varchar(255) NULL`);
+
+		// Step 2: Adding column "createdBy"
+		console.log('Step 2: Adding column "createdBy"');
+		await queryRunner.query(`ALTER TABLE \`request_approval\` ADD \`createdBy\` varchar(255) NULL`);
+
+		// Step 3: Copy data from "createdByUserId" to "createdBy"
+		console.log('Step 3: Copy data from "createdByUserId" to "createdBy"');
+		await queryRunner.query(`UPDATE \`request_approval\` SET \`createdBy\` = \`createdByUserId\``);
+	}
+}
diff --git a/packages/core/src/lib/equipment-sharing/commands/equipment-sharing.create.command.ts b/packages/core/src/lib/equipment-sharing/commands/equipment-sharing.create.command.ts
index 0367c7e7e25..45ce7c46256 100644
--- a/packages/core/src/lib/equipment-sharing/commands/equipment-sharing.create.command.ts
+++ b/packages/core/src/lib/equipment-sharing/commands/equipment-sharing.create.command.ts
@@ -4,5 +4,5 @@ import { ID, IEquipmentSharingCreateInput } from '@gauzy/contracts';
 export class EquipmentSharingCreateCommand implements ICommand {
 	static readonly type = '[EquipmentSharing] Create';
 
-	constructor(public readonly organizationId: ID, public readonly entity: IEquipmentSharingCreateInput) {}
+	constructor(public readonly organizationId: ID, public readonly input: IEquipmentSharingCreateInput) {}
 }
diff --git a/packages/core/src/lib/equipment-sharing/commands/equipment-sharing.update.command.ts b/packages/core/src/lib/equipment-sharing/commands/equipment-sharing.update.command.ts
index 0113acd3a67..3f546f440aa 100644
--- a/packages/core/src/lib/equipment-sharing/commands/equipment-sharing.update.command.ts
+++ b/packages/core/src/lib/equipment-sharing/commands/equipment-sharing.update.command.ts
@@ -4,5 +4,5 @@ import { ID, IEquipmentSharingUpdateInput } from '@gauzy/contracts';
 export class EquipmentSharingUpdateCommand implements ICommand {
 	static readonly type = '[EquipmentSharing] Update';
 
-	constructor(public readonly id: ID, public readonly equipmentSharing: IEquipmentSharingUpdateInput) {}
+	constructor(public readonly id: ID, public readonly input: IEquipmentSharingUpdateInput) {}
 }
diff --git a/packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.create.handler.ts b/packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.create.handler.ts
index ce80065edfc..5f4456d9c76 100644
--- a/packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.create.handler.ts
+++ b/packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.create.handler.ts
@@ -1,17 +1,16 @@
 import { ICommandHandler, CommandHandler } from '@nestjs/cqrs';
 import { RequestApprovalStatusTypesEnum, ApprovalPolicyTypesStringEnum } from '@gauzy/contracts';
+import { RequestContext } from '../../../core/context';
+import { RequestApprovalService } from '../../../request-approval/request-approval.service';
 import { EquipmentSharing } from '../../equipment-sharing.entity';
 import { EquipmentSharingCreateCommand } from '../equipment-sharing.create.command';
-import { RequestApproval } from '../../../request-approval/request-approval.entity';
-import { RequestContext } from '../../../core/context';
-import { TypeOrmRequestApprovalRepository } from '../../../request-approval/repository/type-orm-request-approval.repository';
 import { EquipmentSharingService } from '../../equipment-sharing.service';
 
 @CommandHandler(EquipmentSharingCreateCommand)
 export class EquipmentSharingCreateHandler implements ICommandHandler<EquipmentSharingCreateCommand> {
 	constructor(
-		private readonly typeOrmRequestApprovalRepository: TypeOrmRequestApprovalRepository,
-		private readonly equipmentSharingService: EquipmentSharingService
+		private readonly _equipmentSharingService: EquipmentSharingService,
+		private readonly _requestApprovalService: RequestApprovalService
 	) {}
 
 	/**
@@ -21,29 +20,34 @@ export class EquipmentSharingCreateHandler implements ICommandHandler<EquipmentS
 	 * @returns A promise that resolves to the newly created EquipmentSharing record.
 	 */
 	public async execute(command: EquipmentSharingCreateCommand): Promise<EquipmentSharing> {
+		// Get current user ID and tenant ID from the request context.
+		const createdByUserId = RequestContext.currentUserId();
+		const tenantId = RequestContext.currentTenantId();
+
 		// Destructure the equipment sharing data from the command.
-		const { organizationId, entity } = command;
-		// Get current user details once to avoid multiple calls.
-		const currentUser = RequestContext.currentUser();
-		// Set the creator of the equipment sharing record using the current user ID.
-		entity.createdByUserId = RequestContext.currentUserId();
-		// Create the equipment sharing record.
-		entity.organizationId = organizationId;
-		const equipmentSharingSaved = await this.equipmentSharingService.create(entity);
+		const { organizationId, input } = command;
+		const { name } = input;
 
-		// Build the request approval record for the created equipment sharing.
-		const requestApproval = new RequestApproval();
-		requestApproval.requestId = equipmentSharingSaved.id;
-		requestApproval.requestType = ApprovalPolicyTypesStringEnum.EQUIPMENT_SHARING;
-		requestApproval.status = equipmentSharingSaved.status ?? RequestApprovalStatusTypesEnum.REQUESTED;
-		requestApproval.createdBy = currentUser.id;
-		requestApproval.createdByName = currentUser.name;
-		requestApproval.name = entity.name;
-		requestApproval.min_count = 1;
+		// Create the equipment sharing record.
+		const equipmentSharing = await this._equipmentSharingService.create({
+			...input,
+			organizationId,
+			tenantId,
+			createdByUserId
+		});
 
-		// Save the request approval record.
-		await this.typeOrmRequestApprovalRepository.save(requestApproval);
+		// Create the request approval record for the created equipment sharing.
+		await this._requestApprovalService.create({
+			name,
+			requestId: equipmentSharing.id,
+			requestType: ApprovalPolicyTypesStringEnum.EQUIPMENT_SHARING,
+			status: equipmentSharing.status ?? RequestApprovalStatusTypesEnum.REQUESTED,
+			min_count: 1,
+			organizationId,
+			tenantId,
+			createdByUserId
+		});
 
-		return equipmentSharingSaved;
+		return equipmentSharing;
 	}
 }
diff --git a/packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.status.handler.ts b/packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.status.handler.ts
index 7aa6d63ce7b..a1b35a675ec 100644
--- a/packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.status.handler.ts
+++ b/packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.status.handler.ts
@@ -1,15 +1,15 @@
 import { ICommandHandler, CommandHandler } from '@nestjs/cqrs';
 import { NotFoundException } from '@nestjs/common';
 import { IEquipmentSharing } from '@gauzy/contracts';
+import { RequestApprovalService } from '../../../request-approval/request-approval.service';
 import { EquipmentSharingStatusCommand } from '../equipment-sharing.status.command';
-import { TypeOrmRequestApprovalRepository } from '../../../request-approval/repository/type-orm-request-approval.repository';
 import { EquipmentSharingService } from '../../equipment-sharing.service';
 
 @CommandHandler(EquipmentSharingStatusCommand)
 export class EquipmentSharingStatusHandler implements ICommandHandler<EquipmentSharingStatusCommand> {
 	constructor(
-		private readonly typeOrmRequestApprovalRepository: TypeOrmRequestApprovalRepository,
-		private readonly equipmentSharingService: EquipmentSharingService
+		private readonly _equipmentSharingService: EquipmentSharingService,
+		private readonly _requestApprovalService: RequestApprovalService
 	) {}
 
 	/**
@@ -23,8 +23,8 @@ export class EquipmentSharingStatusHandler implements ICommandHandler<EquipmentS
 
 		// Retrieve the equipment sharing record and its associated request approval concurrently.
 		const [equipmentSharing, requestApproval] = await Promise.all([
-			this.equipmentSharingService.findOneByIdString(id),
-			this.typeOrmRequestApprovalRepository.findOneBy({ requestId: id })
+			this._equipmentSharingService.findOneByIdString(id),
+			this._requestApprovalService.findOneByWhereOptions({ requestId: id })
 		]);
 
 		// If the equipment sharing record is not found, throw an exception.
@@ -32,16 +32,14 @@ export class EquipmentSharingStatusHandler implements ICommandHandler<EquipmentS
 			throw new NotFoundException('Equipment Sharing not found');
 		}
 
-		// Update the equipment sharing status.
-		equipmentSharing.status = status;
+		if (!requestApproval) {
+			throw new NotFoundException('Request Approval not found');
+		}
 
 		// If a corresponding request approval exists, update its status as well.
-		if (requestApproval) {
-			requestApproval.status = status;
-			await this.typeOrmRequestApprovalRepository.save(requestApproval);
-		}
+		await this._requestApprovalService.update({ requestId: id }, { status });
 
 		// Persist and return the updated equipment sharing record.
-		return await this.equipmentSharingService.update(id, equipmentSharing);
+		return await this._equipmentSharingService.update(id, { status });
 	}
 }
diff --git a/packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.update.handler.ts b/packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.update.handler.ts
index 3d2788de423..1e2e9a8e3ab 100644
--- a/packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.update.handler.ts
+++ b/packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.update.handler.ts
@@ -1,17 +1,16 @@
 import { ICommandHandler, CommandHandler } from '@nestjs/cqrs';
 import { RequestApprovalStatusTypesEnum } from '@gauzy/contracts';
-import { EquipmentSharing } from '../../equipment-sharing.entity';
-import { RequestApproval } from '../../../request-approval/request-approval.entity';
 import { RequestContext } from '../../../core/context';
+import { RequestApprovalService } from '../../../request-approval/request-approval.service';
+import { EquipmentSharing } from '../../equipment-sharing.entity';
 import { EquipmentSharingUpdateCommand } from '../equipment-sharing.update.command';
-import { TypeOrmRequestApprovalRepository } from '../../../request-approval/repository/type-orm-request-approval.repository';
 import { EquipmentSharingService } from '../../equipment-sharing.service';
 
 @CommandHandler(EquipmentSharingUpdateCommand)
 export class EquipmentSharingUpdateHandler implements ICommandHandler<EquipmentSharingUpdateCommand> {
 	constructor(
-		private readonly typeOrmRequestApprovalRepository: TypeOrmRequestApprovalRepository,
-		private readonly equipmentSharingService: EquipmentSharingService
+		private readonly _equipmentSharingService: EquipmentSharingService,
+		private readonly _requestApprovalService: RequestApprovalService
 	) {}
 
 	/**
@@ -21,34 +20,29 @@ export class EquipmentSharingUpdateHandler implements ICommandHandler<EquipmentS
 	 * @returns A promise that resolves to the updated EquipmentSharing record.
 	 */
 	public async execute(command: EquipmentSharingUpdateCommand): Promise<EquipmentSharing> {
-		const { id, equipmentSharing } = command;
+		// Get the current tenant ID and current user ID from the request context.
+		const createdByUserId = RequestContext.currentUserId();
 
-		const currentUser = RequestContext.currentUser();
-		const tenantId = RequestContext.currentTenantId();
+		const { id, input } = command;
 
 		// Delete the existing Equipment Sharing record and its associated Request Approval concurrently.
 		await Promise.all([
-			this.equipmentSharingService.delete(id),
-			this.typeOrmRequestApprovalRepository.delete({ requestId: id })
+			this._equipmentSharingService.delete(id),
+			this._requestApprovalService.delete({ requestId: id })
 		]);
 
 		// Save the updated Equipment Sharing record.
-		equipmentSharing.tenantId = tenantId;
-		const equipmentSharingSaved = await this.equipmentSharingService.create(equipmentSharing);
-
-		// Create a new Request Approval record for the updated Equipment Sharing.
-		const requestApproval = new RequestApproval();
-		requestApproval.requestId = equipmentSharingSaved.id;
-		requestApproval.status = equipmentSharingSaved.status ?? RequestApprovalStatusTypesEnum.REQUESTED;
-		requestApproval.createdBy = currentUser.id;
-		requestApproval.createdByName = currentUser.name;
-		requestApproval.name = equipmentSharing.name;
-		requestApproval.min_count = 1;
-		requestApproval.tenantId = tenantId;
-
-		// Save the new Request Approval.
-		await this.typeOrmRequestApprovalRepository.save(requestApproval);
-
-		return equipmentSharingSaved;
+		const equipmentSharing = await this._equipmentSharingService.create(input);
+
+		// Create a new request approval record for the updated equipment sharing.
+		await this._requestApprovalService.create({
+			requestId: equipmentSharing.id,
+			status: equipmentSharing.status ?? RequestApprovalStatusTypesEnum.REQUESTED,
+			createdByUserId,
+			name: equipmentSharing.name,
+			min_count: 1
+		});
+
+		return equipmentSharing;
 	}
 }
diff --git a/packages/core/src/lib/request-approval/request-approval.entity.ts b/packages/core/src/lib/request-approval/request-approval.entity.ts
index 74835a804f5..77642a6c510 100644
--- a/packages/core/src/lib/request-approval/request-approval.entity.ts
+++ b/packages/core/src/lib/request-approval/request-approval.entity.ts
@@ -5,21 +5,18 @@
   - Request Approval table has the one to many relationships to RequestApprovalEmployee table
   - Request Approval table has the many to many relationships to the Employee table through the RequestApprovalEmployee table.
 */
-import {
-	RelationId,
-	JoinColumn,
-	JoinTable
-} from 'typeorm';
+import { RelationId, JoinColumn, JoinTable } from 'typeorm';
+import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
+import { IsString, IsNotEmpty, IsNumber, IsEnum, IsOptional, IsUUID, IsObject } from 'class-validator';
 import {
 	IRequestApproval,
 	ApprovalPolicyTypesStringEnum,
 	IApprovalPolicy,
 	IRequestApprovalEmployee,
 	IRequestApprovalTeam,
-	ITag
+	ITag,
+	ID
 } from '@gauzy/contracts';
-import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
-import { IsString, IsNotEmpty, IsNumber, IsEnum } from 'class-validator';
 import {
 	ApprovalPolicy,
 	RequestApprovalEmployee,
@@ -27,94 +24,92 @@ import {
 	Tag,
 	TenantOrganizationBaseEntity
 } from '../core/entities/internal';
-import { ColumnIndex, MultiORMColumn, MultiORMEntity, MultiORMManyToMany, MultiORMManyToOne, MultiORMOneToMany } from './../core/decorators/entity';
+import {
+	ColumnIndex,
+	MultiORMColumn,
+	MultiORMEntity,
+	MultiORMManyToMany,
+	MultiORMManyToOne,
+	MultiORMOneToMany
+} from './../core/decorators/entity';
 import { MikroOrmRequestApprovalRepository } from './repository/mikro-orm-request-approval.repository';
 
 @MultiORMEntity('request_approval', { mikroOrmRepository: () => MikroOrmRequestApprovalRepository })
 export class RequestApproval extends TenantOrganizationBaseEntity implements IRequestApproval {
 	@ApiProperty({ type: () => String })
-	@IsString()
 	@IsNotEmpty()
+	@IsString()
 	@ColumnIndex()
 	@MultiORMColumn()
 	name: string;
 
-	@ApiProperty({ type: () => Number })
+	@ApiPropertyOptional({ type: () => Number })
+	@IsOptional()
 	@IsNumber()
 	@MultiORMColumn({ nullable: true })
 	status: number;
 
-	@ApiProperty({ type: () => String, readOnly: true })
-	@IsString()
-	@MultiORMColumn({ nullable: true })
-	createdBy: string;
-
-	@ApiProperty({ type: () => String })
-	@IsString()
-	@MultiORMColumn({ nullable: true })
-	createdByName: string;
-
-	@ApiProperty({ type: () => Number })
+	@ApiPropertyOptional({ type: () => Number })
+	@IsOptional()
 	@IsNumber()
 	@MultiORMColumn({ nullable: true })
 	min_count: number;
 
-	@ApiProperty({ type: () => String, readOnly: true })
+	@ApiPropertyOptional({ type: () => String })
 	@IsString()
 	@MultiORMColumn({ nullable: true })
-	requestId: string;
+	requestId: ID;
 
-	@ApiProperty({ type: () => String, enum: ApprovalPolicyTypesStringEnum })
+	@ApiPropertyOptional({ type: () => String, enum: ApprovalPolicyTypesStringEnum })
+	@IsOptional()
 	@IsEnum(ApprovalPolicyTypesStringEnum)
 	@MultiORMColumn({ nullable: true })
-	requestType: string;
+	requestType: ApprovalPolicyTypesStringEnum;
 
 	/*
 	|--------------------------------------------------------------------------
 	| @ManyToOne
 	|--------------------------------------------------------------------------
 	*/
-
 	/**
-	*  ApprovalPolicy
-	*/
-	@ApiProperty({ type: () => ApprovalPolicy })
+	 * The approval policy associated with this request approval.
+	 */
+	@ApiPropertyOptional({ type: () => ApprovalPolicy })
+	@IsOptional()
+	@IsObject()
 	@MultiORMManyToOne(() => ApprovalPolicy, {
-		nullable: true,
-		onDelete: 'CASCADE'
+		nullable: true, // Indicates if relation column value can be nullable or not.
+		onDelete: 'CASCADE' // Database cascade action on delete.
 	})
 	@JoinColumn()
-	approvalPolicy: IApprovalPolicy;
+	approvalPolicy?: IApprovalPolicy;
 
-	@ApiProperty({ type: () => String })
+	/**
+	 * The ID for the associated approval policy.
+	 */
+	@ApiPropertyOptional({ type: () => String })
+	@IsOptional()
+	@IsUUID()
 	@RelationId((it: RequestApproval) => it.approvalPolicy)
-	@IsString()
 	@ColumnIndex()
 	@MultiORMColumn({ nullable: true, relationId: true })
-	approvalPolicyId: string;
+	approvalPolicyId?: ID;
 
 	/*
 	|--------------------------------------------------------------------------
 	| @OneToMany
 	|--------------------------------------------------------------------------
 	*/
-
 	/**
-	 * RequestApprovalEmployee
+	 * The employees associated with this request approval.
 	 */
-	@ApiPropertyOptional({ type: () => RequestApprovalEmployee, isArray: true })
-	@MultiORMOneToMany(() => RequestApprovalEmployee, (employeeApprovals) => employeeApprovals.requestApproval, {
-		cascade: true
-	})
+	@MultiORMOneToMany(() => RequestApprovalEmployee, (it) => it.requestApproval, { cascade: true })
 	employeeApprovals?: IRequestApprovalEmployee[];
 
 	/**
-	 * RequestApprovalTeam
+	 * The teams associated with this request approval.
 	 */
-	@ApiPropertyOptional({ type: () => RequestApprovalTeam, isArray: true })
-	@MultiORMOneToMany(() => RequestApprovalTeam, (teamApprovals) => teamApprovals.requestApproval, {
-		cascade: true
-	})
+	@MultiORMOneToMany(() => RequestApprovalTeam, (it) => it.requestApproval, { cascade: true })
 	teamApprovals?: IRequestApprovalTeam[];
 
 	/*
@@ -122,17 +117,17 @@ export class RequestApproval extends TenantOrganizationBaseEntity implements IRe
 	| @ManyToMany
 	|--------------------------------------------------------------------------
 	*/
-	@ApiPropertyOptional({ type: () => RequestApprovalTeam, isArray: true })
-	@MultiORMManyToMany(() => Tag, (tag) => tag.requestApprovals, {
+	/**
+	 * The tags associated with this request approval.
+	 */
+	@MultiORMManyToMany(() => Tag, (it) => it.requestApprovals, {
 		onUpdate: 'CASCADE',
 		onDelete: 'CASCADE',
 		owner: true,
 		pivotTable: 'tag_request_approval',
 		joinColumn: 'requestApprovalId',
-		inverseJoinColumn: 'tagId',
-	})
-	@JoinTable({
-		name: 'tag_request_approval'
+		inverseJoinColumn: 'tagId'
 	})
+	@JoinTable({ name: 'tag_request_approval' })
 	tags?: ITag[];
 }
diff --git a/packages/core/src/lib/request-approval/request-approval.seed.ts b/packages/core/src/lib/request-approval/request-approval.seed.ts
index d3078a334d9..1ce0d9f1600 100644
--- a/packages/core/src/lib/request-approval/request-approval.seed.ts
+++ b/packages/core/src/lib/request-approval/request-approval.seed.ts
@@ -22,7 +22,12 @@ const approvalTypes = [
 	'Health Meal'
 ];
 
-
+/**
+ *
+ * @param dataSource
+ * @param defaultData
+ * @returns
+ */
 export const createDefaultRequestApprovalEmployee = async (
 	dataSource: DataSource,
 	defaultData: {
@@ -33,26 +38,23 @@ export const createDefaultRequestApprovalEmployee = async (
 ): Promise<void> => {
 	const requestApprovals: RequestApproval[] = [];
 	if (!defaultData.approvalPolicies) {
-		console.warn(
-			'Warning: Approval Policies not found, Request Approval Employee  will not be created'
-		);
+		console.warn('Warning: Approval Policies not found, Request Approval Employee  will not be created');
 		return;
 	}
 
 	for await (const org of defaultData.orgs) {
-
 		const requestApproval = new RequestApproval();
 		requestApproval.name = faker.helpers.arrayElement(approvalTypes);
 		requestApproval.status = faker.number.int({ min: 1, max: 3 });
 		requestApproval.approvalPolicy = faker.helpers.arrayElement(defaultData.approvalPolicies);
 		requestApproval.min_count = faker.number.int({ min: 1, max: 56 });
-		requestApproval.createdBy = faker.helpers.arrayElement(defaultData.employees).id;
-
 
 		const requestApprovalEmployees: RequestApprovalEmployee[] = [];
 		for await (const employee of faker.helpers.arrayElements(defaultData.employees, 5)) {
 			const defaultRequestApprovalEmployee = new RequestApprovalEmployee();
-			defaultRequestApprovalEmployee.requestApprovalId = faker.helpers.arrayElement(defaultData.approvalPolicies).id;
+			defaultRequestApprovalEmployee.requestApprovalId = faker.helpers.arrayElement(
+				defaultData.approvalPolicies
+			).id;
 			defaultRequestApprovalEmployee.employee = employee;
 			defaultRequestApprovalEmployee.status = faker.number.int(99);
 			defaultRequestApprovalEmployee.tenant = org.tenant;
@@ -65,8 +67,7 @@ export const createDefaultRequestApprovalEmployee = async (
 		requestApprovals.push(requestApproval);
 	}
 	await dataSource.manager.save(requestApprovals);
-}
-
+};
 
 export const createRandomRequestApproval = async (
 	dataSource: DataSource,
@@ -87,20 +88,16 @@ export const createRandomRequestApproval = async (
 					tenantId,
 					organizationId: organization.id
 				}
-			}
-			);
+			});
 			for (let i = 0; i < noOfRequestsPerOrganizations; i++) {
 				const tenantPolicy = faker.helpers.arrayElement(policies);
-				const specificEmployees = employees
-					.sort(() => Math.random() - Math.random())
-					.slice(0, 3);
+				const specificEmployees = employees.sort(() => Math.random() - Math.random()).slice(0, 3);
 
 				const requestApproval = new RequestApproval();
 				requestApproval.name = faker.helpers.arrayElement(approvalTypes);
 				requestApproval.status = faker.number.int({ min: 1, max: 3 });
 				requestApproval.approvalPolicy = tenantPolicy;
 				requestApproval.min_count = faker.number.int({ min: 1, max: 56 });
-				requestApproval.createdBy = faker.helpers.arrayElement(specificEmployees).id;
 
 				const requestApprovalEmployees: RequestApprovalEmployee[] = [];
 				for await (const employee of specificEmployees) {
@@ -112,7 +109,6 @@ export const createRandomRequestApproval = async (
 					requestApprovalEmployees.push(raEmployees);
 				}
 				requestApproval.employeeApprovals = requestApprovalEmployees;
-
 				requestApproval.tenant = tenant;
 				requestApproval.organization = organization;
 				requestApprovals.push(requestApproval);
@@ -120,10 +116,5 @@ export const createRandomRequestApproval = async (
 		}
 	}
 
-	await dataSource
-		.createQueryBuilder()
-		.insert()
-		.into(RequestApproval)
-		.values(requestApprovals)
-		.execute();
+	await dataSource.createQueryBuilder().insert().into(RequestApproval).values(requestApprovals).execute();
 };
diff --git a/packages/core/src/lib/request-approval/request-approval.service.ts b/packages/core/src/lib/request-approval/request-approval.service.ts
index 8e98965d60c..d2b8a142510 100644
--- a/packages/core/src/lib/request-approval/request-approval.service.ts
+++ b/packages/core/src/lib/request-approval/request-approval.service.ts
@@ -112,13 +112,14 @@ export class RequestApprovalService extends TenantAwareCrudService<RequestApprov
 		relations: string[],
 		findInput?: IRequestApprovalFindInput
 	): Promise<IPagination<IRequestApproval>> {
+		// Get the current tenant ID and current user ID from the request context.
+		const currentUserId = RequestContext.currentUserId();
 		const tenantId = RequestContext.currentTenantId();
-		const currentUser = RequestContext.currentUser();
 
 		const { organizationId } = findInput;
 		const result = await this.typeOrmRepository.find({
 			where: {
-				createdBy: currentUser.id,
+				createdByUserId: currentUserId,
 				organizationId,
 				tenantId
 			}
@@ -152,55 +153,61 @@ export class RequestApprovalService extends TenantAwareCrudService<RequestApprov
 		return { items: result, total: result.length };
 	}
 
+	/**
+	 * Creates a RequestApproval record.
+	 *
+	 * @param entity - The input data to create a RequestApproval.
+	 * @returns The saved RequestApproval entity.
+	 */
 	async createRequestApproval(entity: IRequestApprovalCreateInput): Promise<RequestApproval> {
+		// Get the current tenant ID and current user ID from the request context.
 		const tenantId = RequestContext.currentTenantId();
+		const currentUserId = RequestContext.currentUserId();
+
 		const requestApproval = new RequestApproval();
 		requestApproval.status = RequestApprovalStatusTypesEnum.REQUESTED;
 		requestApproval.approvalPolicyId = entity.approvalPolicyId;
-		requestApproval.createdBy = RequestContext.currentUser().id;
-		requestApproval.createdByName = RequestContext.currentUser().name;
+		requestApproval.createdByUserId = currentUserId;
 		requestApproval.name = entity.name;
 		requestApproval.min_count = entity.min_count;
 		requestApproval.tags = entity.tags;
 		requestApproval.organizationId = entity.organizationId;
 		requestApproval.tenantId = tenantId;
-		if (entity.employeeApprovals) {
+
+		if (entity.employeeApprovals?.length) {
 			const employees: IEmployee[] = await this.typeOrmEmployeeRepository.find({
-				where: {
-					id: In(entity.employeeApprovals)
-				}
+				where: { id: In(entity.employeeApprovals) }
 			});
-			const requestApprovalEmployees: IRequestApprovalEmployee[] = [];
-			employees.forEach((employee: IEmployee) => {
-				const raEmployees = new RequestApprovalEmployee();
-				raEmployees.employeeId = employee.id;
-				raEmployees.organizationId = entity.organizationId;
-				raEmployees.tenantId = tenantId;
-				raEmployees.status = RequestApprovalStatusTypesEnum.REQUESTED;
-				requestApprovalEmployees.push(raEmployees);
+
+			requestApproval.employeeApprovals = employees.map((employee) => {
+				const requestApprovalEmployee = new RequestApprovalEmployee();
+				requestApprovalEmployee.employeeId = employee.id;
+				requestApprovalEmployee.organizationId = entity.organizationId;
+				requestApprovalEmployee.tenantId = tenantId;
+				requestApprovalEmployee.status = RequestApprovalStatusTypesEnum.REQUESTED;
+				return requestApprovalEmployee;
 			});
-			requestApproval.employeeApprovals = requestApprovalEmployees;
 		}
-		if (entity.teams) {
+
+		if (entity.teams?.length) {
 			const teams: IOrganizationTeam[] = await this.typeOrmOrganizationTeamRepository.find({
-				where: {
-					id: In(entity.teams)
-				}
+				where: { id: In(entity.teams) }
 			});
-			const requestApprovalTeams: RequestApprovalTeam[] = [];
-			teams.forEach((team) => {
-				const raTeam = new RequestApprovalTeam();
-				raTeam.teamId = team.id;
-				raTeam.team = team;
-				raTeam.status = RequestApprovalStatusTypesEnum.REQUESTED;
-				raTeam.organizationId = entity.organizationId;
-				raTeam.tenantId = tenantId;
-				requestApprovalTeams.push(raTeam);
+
+			requestApproval.teamApprovals = teams.map((team) => {
+				const requestApprovalTeam = new RequestApprovalTeam();
+				requestApprovalTeam.teamId = team.id;
+				requestApprovalTeam.team = team;
+				requestApprovalTeam.status = RequestApprovalStatusTypesEnum.REQUESTED;
+				requestApprovalTeam.organizationId = entity.organizationId;
+				requestApprovalTeam.tenantId = tenantId;
+				return requestApprovalTeam;
 			});
-			requestApproval.teamApprovals = requestApprovalTeams;
 		}
+
 		return this.typeOrmRepository.save(requestApproval);
 	}
+
 	async updateRequestApproval(id: string, entity: IRequestApprovalCreateInput): Promise<RequestApproval> {
 		const tenantId = RequestContext.currentTenantId();
 		const requestApproval = await this.typeOrmRepository.findOneBy({
@@ -265,6 +272,7 @@ export class RequestApprovalService extends TenantAwareCrudService<RequestApprov
 			});
 			requestApproval.teamApprovals = requestApprovalTeams;
 		}
+
 		return this.typeOrmRepository.save(requestApproval);
 	}
 
diff --git a/packages/core/src/lib/time-off-request/commands/handlers/time-off.create.handler.ts b/packages/core/src/lib/time-off-request/commands/handlers/time-off.create.handler.ts
index 5bd67c95553..228a5af1559 100644
--- a/packages/core/src/lib/time-off-request/commands/handlers/time-off.create.handler.ts
+++ b/packages/core/src/lib/time-off-request/commands/handlers/time-off.create.handler.ts
@@ -1,47 +1,51 @@
+import { HttpException, HttpStatus } from '@nestjs/common';
 import { ICommandHandler, CommandHandler } from '@nestjs/cqrs';
-import { BadRequestException } from '@nestjs/common';
 import {
 	StatusTypesMapRequestApprovalEnum,
 	ApprovalPolicyTypesStringEnum,
 	RequestApprovalStatusTypesEnum
 } from '@gauzy/contracts';
 import { TimeOffRequest } from '../../time-off-request.entity';
-import { RequestApproval } from '../../../request-approval/request-approval.entity';
+import { RequestApprovalService } from '../../../request-approval/request-approval.service';
 import { TimeOffCreateCommand } from '../time-off.create.command';
-import { RequestContext } from '../../../core/context';
-import { TypeOrmRequestApprovalRepository } from '../../../request-approval/repository/type-orm-request-approval.repository';
-import { TypeOrmTimeOffRequestRepository } from '../../repository/type-orm-time-off-request.repository';
+import { TimeOffRequestService } from '../../time-off-request.service';
 
 @CommandHandler(TimeOffCreateCommand)
 export class TimeOffCreateHandler implements ICommandHandler<TimeOffCreateCommand> {
 	constructor(
-		private readonly typeOrmTimeOffRequestRepository: TypeOrmTimeOffRequestRepository,
-		private readonly typeOrmRequestApprovalRepository: TypeOrmRequestApprovalRepository
+		private readonly _timeOffRequestService: TimeOffRequestService,
+		private readonly _requestApprovalService: RequestApprovalService
 	) {}
 
-	public async execute(command?: TimeOffCreateCommand): Promise<TimeOffRequest> {
+	/**
+	 * Executes the time off update command.
+	 *
+	 * @param command - The command containing the time off request data.
+	 * @returns The saved TimeOffRequest entity.
+	 */
+	public async execute(command: TimeOffCreateCommand): Promise<TimeOffRequest> {
+		const { input } = command;
 		try {
-			const { timeOff } = command;
-			const request = new TimeOffRequest();
-			Object.assign(request, timeOff);
+			// Create the request approval record for the created equipment sharing.
+			const timeOffRequest = await this._timeOffRequestService.create(input);
 
-			const timeOffRequestSaved = await this.typeOrmTimeOffRequestRepository.save(request);
+			// Create the request approval record for the created equipment sharing.
+			await this._requestApprovalService.create({
+				requestId: timeOffRequest.id,
+				requestType: ApprovalPolicyTypesStringEnum.TIME_OFF,
+				status: timeOffRequest.status
+					? StatusTypesMapRequestApprovalEnum[timeOffRequest.status]
+					: RequestApprovalStatusTypesEnum.REQUESTED,
+				name: 'Request time off',
+				min_count: 1
+			});
 
-			const requestApproval = new RequestApproval();
-			requestApproval.requestId = timeOffRequestSaved.id;
-			requestApproval.requestType = ApprovalPolicyTypesStringEnum.TIME_OFF;
-			requestApproval.status = timeOffRequestSaved.status
-				? StatusTypesMapRequestApprovalEnum[timeOffRequestSaved.status]
-				: RequestApprovalStatusTypesEnum.REQUESTED;
-			requestApproval.createdBy = RequestContext.currentUser().id;
-			requestApproval.createdByName = RequestContext.currentUser().name;
-			requestApproval.name = 'Request time off';
-			requestApproval.min_count = 1;
-
-			await this.typeOrmRequestApprovalRepository.save(requestApproval);
-			return timeOffRequestSaved;
-		} catch (err) {
-			throw new BadRequestException(err);
+			return timeOffRequest;
+		} catch (error) {
+			throw new HttpException(
+				`Error while creating time off request: ${error.message}`,
+				HttpStatus.INTERNAL_SERVER_ERROR
+			);
 		}
 	}
 }
diff --git a/packages/core/src/lib/time-off-request/commands/handlers/time-off.update.handler.ts b/packages/core/src/lib/time-off-request/commands/handlers/time-off.update.handler.ts
index 7dd7b7b1f64..81f0ea27c55 100644
--- a/packages/core/src/lib/time-off-request/commands/handlers/time-off.update.handler.ts
+++ b/packages/core/src/lib/time-off-request/commands/handlers/time-off.update.handler.ts
@@ -1,44 +1,54 @@
 import { ICommandHandler, CommandHandler } from '@nestjs/cqrs';
-import { BadRequestException } from '@nestjs/common';
+import { HttpException, HttpStatus } from '@nestjs/common';
 import { StatusTypesMapRequestApprovalEnum, RequestApprovalStatusTypesEnum } from '@gauzy/contracts';
 import { TimeOffRequest } from '../../time-off-request.entity';
-import { RequestApproval } from '../../../request-approval/request-approval.entity';
-import { RequestContext } from '../../../core/context';
 import { TimeOffUpdateCommand } from '../time-off.update.command';
-import { TypeOrmTimeOffRequestRepository } from '../../repository/type-orm-time-off-request.repository';
-import { TypeOrmRequestApprovalRepository } from '../../../request-approval/repository/type-orm-request-approval.repository';
+import { RequestApprovalService } from '../../../request-approval/request-approval.service';
+import { TimeOffRequestService } from '../../time-off-request.service';
 
 @CommandHandler(TimeOffUpdateCommand)
 export class TimeOffUpdateHandler implements ICommandHandler<TimeOffUpdateCommand> {
 	constructor(
-		private readonly typeOrmTimeOffRequestRepository: TypeOrmTimeOffRequestRepository,
-		private readonly typeOrmRequestApprovalRepository: TypeOrmRequestApprovalRepository
+		private readonly _requestApprovalService: RequestApprovalService,
+		private readonly _timeOffRequestService: TimeOffRequestService
 	) {}
 
-	public async execute(command?: TimeOffUpdateCommand): Promise<TimeOffRequest> {
-		try {
-			const { id, timeOff } = command;
-			await this.typeOrmTimeOffRequestRepository.delete(id);
-
-			const timeOffRequestSaved = await this.typeOrmTimeOffRequestRepository.save(timeOff);
+	/**
+	 * Updates an existing time off request by deleting the old record, saving a new one,
+	 * and updating its associated approval record.
+	 *
+	 * @param command - An object containing the identifier of the existing request and the new time off data.
+	 * @returns A promise that resolves to the newly saved TimeOffRequest.
+	 */
+	public async execute(command: TimeOffUpdateCommand): Promise<TimeOffRequest> {
+		const { id, input } = command;
 
-			await this.typeOrmRequestApprovalRepository.delete({ requestId: id });
+		try {
+			// Delete the existing time off request and its associated request approval concurrently.
+			await Promise.all([
+				this._timeOffRequestService.delete(id),
+				this._requestApprovalService.delete({ requestId: id })
+			]);
 
-			const requestApproval = new RequestApproval();
-			requestApproval.requestId = timeOffRequestSaved.id;
-			requestApproval.status = timeOffRequestSaved.status
-				? StatusTypesMapRequestApprovalEnum[timeOffRequestSaved.status]
-				: RequestApprovalStatusTypesEnum.REQUESTED;
-			requestApproval.createdBy = RequestContext.currentUser().id;
-			requestApproval.createdByName = RequestContext.currentUser().name;
-			requestApproval.name = 'Request time off';
-			requestApproval.min_count = 1;
+			// Save the new time off request.
+			const timeOffRequest = await this._timeOffRequestService.create(input);
 
-			await this.typeOrmRequestApprovalRepository.save(requestApproval);
+			// Create a new request approval record for the updated time off request.
+			await this._requestApprovalService.create({
+				requestId: timeOffRequest.id,
+				status: timeOffRequest.status
+					? StatusTypesMapRequestApprovalEnum[timeOffRequest.status]
+					: RequestApprovalStatusTypesEnum.REQUESTED,
+				name: 'Request time off',
+				min_count: 1
+			});
 
-			return timeOffRequestSaved;
-		} catch (err) {
-			throw new BadRequestException(err);
+			return timeOffRequest;
+		} catch (error) {
+			throw new HttpException(
+				`Error while updating time off request: ${error.message}`,
+				HttpStatus.INTERNAL_SERVER_ERROR
+			);
 		}
 	}
 }
diff --git a/packages/core/src/lib/time-off-request/commands/time-off.create.command.ts b/packages/core/src/lib/time-off-request/commands/time-off.create.command.ts
index 62899ce095a..418a592f5ee 100644
--- a/packages/core/src/lib/time-off-request/commands/time-off.create.command.ts
+++ b/packages/core/src/lib/time-off-request/commands/time-off.create.command.ts
@@ -4,5 +4,5 @@ import { TimeOffRequest } from '../time-off-request.entity';
 export class TimeOffCreateCommand implements ICommand {
 	static readonly type = '[TimeOff] Create';
 
-	constructor(public readonly timeOff: TimeOffRequest) {}
+	constructor(public readonly input: TimeOffRequest) {}
 }
diff --git a/packages/core/src/lib/time-off-request/commands/time-off.update.command.ts b/packages/core/src/lib/time-off-request/commands/time-off.update.command.ts
index 04ad214e7f6..6ebbc4a0634 100644
--- a/packages/core/src/lib/time-off-request/commands/time-off.update.command.ts
+++ b/packages/core/src/lib/time-off-request/commands/time-off.update.command.ts
@@ -1,11 +1,9 @@
 import { ICommand } from '@nestjs/cqrs';
+import { ID } from '@gauzy/contracts';
 import { TimeOffRequest } from '../time-off-request.entity';
 
 export class TimeOffUpdateCommand implements ICommand {
 	static readonly type = '[TimeOff] update';
 
-	constructor(
-		public readonly id: string,
-		public readonly timeOff: TimeOffRequest
-	) {}
+	constructor(public readonly id: ID, public readonly input: TimeOffRequest) {}
 }
diff --git a/packages/core/src/lib/time-off-request/time-off-request.controller.ts b/packages/core/src/lib/time-off-request/time-off-request.controller.ts
index 19f0a413def..b8387c6ce4b 100644
--- a/packages/core/src/lib/time-off-request/time-off-request.controller.ts
+++ b/packages/core/src/lib/time-off-request/time-off-request.controller.ts
@@ -32,7 +32,7 @@ export class TimeOffRequestController extends CrudController<TimeOffRequest> {
 	}
 
 	@Permissions(PermissionsEnum.ALL_ORG_VIEW, PermissionsEnum.TIME_OFF_VIEW)
-	@Get('pagination')
+	@Get('/pagination')
 	@UseValidationPipe({ transform: true })
 	async pagination(@Query() options: PaginationParams<TimeOffRequest>): Promise<IPagination<ITimeOffRequest>> {
 		return await this.timeOffRequestService.pagination(options);
@@ -58,7 +58,7 @@ export class TimeOffRequestController extends CrudController<TimeOffRequest> {
 	@UseGuards(RoleGuard)
 	@Roles(RolesEnum.SUPER_ADMIN, RolesEnum.ADMIN)
 	@Permissions(PermissionsEnum.ALL_ORG_EDIT, PermissionsEnum.TIME_OFF_EDIT)
-	@Put('approval/:id')
+	@Put('/approval/:id')
 	async timeOffRequestApproved(@Param('id', UUIDValidationPipe) id: ID): Promise<ITimeOffRequest> {
 		return this.commandBus.execute(new TimeOffStatusCommand(id, StatusTypesEnum.APPROVED));
 	}
@@ -83,7 +83,7 @@ export class TimeOffRequestController extends CrudController<TimeOffRequest> {
 	@UseGuards(RoleGuard)
 	@Roles(RolesEnum.SUPER_ADMIN, RolesEnum.ADMIN)
 	@Permissions(PermissionsEnum.ALL_ORG_EDIT, PermissionsEnum.TIME_OFF_EDIT)
-	@Put('denied/:id')
+	@Put('/denied/:id')
 	async timeOffRequestDenied(@Param('id', UUIDValidationPipe) id: ID): Promise<ITimeOffRequest> {
 		return this.commandBus.execute(new TimeOffStatusCommand(id, StatusTypesEnum.DENIED));
 	}
@@ -105,7 +105,7 @@ export class TimeOffRequestController extends CrudController<TimeOffRequest> {
 		description: 'Record not found'
 	})
 	@Permissions(PermissionsEnum.ALL_ORG_VIEW, PermissionsEnum.TIME_OFF_VIEW)
-	@Get()
+	@Get('/')
 	async findAll(@Query('data', ParseJsonPipe) data: any): Promise<IPagination<ITimeOffRequest>> {
 		const { relations, findInput } = data;
 		return await this.timeOffRequestService.getAllTimeOffRequests(relations, findInput);
@@ -126,7 +126,7 @@ export class TimeOffRequestController extends CrudController<TimeOffRequest> {
 	@HttpCode(HttpStatus.ACCEPTED)
 	@UseGuards(PermissionGuard)
 	@Permissions(PermissionsEnum.ALL_ORG_EDIT, PermissionsEnum.TIME_OFF_ADD)
-	@Post()
+	@Post('/')
 	async create(@Body() entity: ITimeOffCreateInput): Promise<ITimeOffRequest> {
 		return await this.timeOffRequestService.create(entity);
 	}
@@ -150,7 +150,7 @@ export class TimeOffRequestController extends CrudController<TimeOffRequest> {
 	})
 	@HttpCode(HttpStatus.ACCEPTED)
 	@Permissions(PermissionsEnum.ALL_ORG_EDIT, PermissionsEnum.TIME_OFF_DELETE)
-	@Put(':id')
+	@Put('/:id')
 	async update(
 		@Param('id', UUIDValidationPipe) id: ID,
 		@Body() entity: ITimeOffUpdateInput
diff --git a/packages/core/src/lib/time-off-request/time-off-request.entity.ts b/packages/core/src/lib/time-off-request/time-off-request.entity.ts
index 7d7f2cb68d6..03add167654 100644
--- a/packages/core/src/lib/time-off-request/time-off-request.entity.ts
+++ b/packages/core/src/lib/time-off-request/time-off-request.entity.ts
@@ -1,7 +1,4 @@
-import {
-	JoinColumn,
-	RelationId
-} from 'typeorm';
+import { JoinColumn, RelationId } from 'typeorm';
 import {
 	IEmployee,
 	ITimeOff as ITimeOffRequest,
@@ -10,26 +7,19 @@ import {
 	IImageAsset as IDocumentAsset
 } from '@gauzy/contracts';
 import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
+import { IsString, IsEnum, IsOptional, IsDate, IsBoolean, IsUUID } from 'class-validator';
+import { Employee, ImageAsset, TenantOrganizationBaseEntity, TimeOffPolicy } from '../core/entities/internal';
 import {
-	IsString,
-	IsEnum,
-	IsOptional,
-	IsDate,
-	IsBoolean,
-	IsUUID
-} from 'class-validator';
-import {
-	Employee,
-	ImageAsset,
-	TenantOrganizationBaseEntity,
-	TimeOffPolicy
-} from '../core/entities/internal';
-import { ColumnIndex, MultiORMColumn, MultiORMEntity, MultiORMManyToMany, MultiORMManyToOne } from './../core/decorators/entity';
+	ColumnIndex,
+	MultiORMColumn,
+	MultiORMEntity,
+	MultiORMManyToMany,
+	MultiORMManyToOne
+} from './../core/decorators/entity';
 import { MikroOrmTimeOffRequestRepository } from './repository/mikro-orm-time-off-request.repository';
 
 @MultiORMEntity('time_off_request', { mikroOrmRepository: () => MikroOrmTimeOffRequestRepository })
 export class TimeOffRequest extends TenantOrganizationBaseEntity implements ITimeOffRequest {
-
 	@ApiPropertyOptional({ type: () => String })
 	@IsOptional()
 	@IsString()
@@ -68,7 +58,6 @@ export class TimeOffRequest extends TenantOrganizationBaseEntity implements ITim
 	@MultiORMColumn({ nullable: true, default: false })
 	isHoliday?: boolean;
 
-
 	/*
 	|--------------------------------------------------------------------------
 	| @ManyToOne
diff --git a/packages/core/src/lib/time-off-request/time-off-request.service.ts b/packages/core/src/lib/time-off-request/time-off-request.service.ts
index 704f3abc64a..77f03b23566 100644
--- a/packages/core/src/lib/time-off-request/time-off-request.service.ts
+++ b/packages/core/src/lib/time-off-request/time-off-request.service.ts
@@ -30,35 +30,42 @@ export class TimeOffRequestService extends TenantAwareCrudService<TimeOffRequest
 		super(typeOrmTimeOffRequestRepository, mikroOrmTimeOffRequestRepository);
 	}
 
+	/**
+	 * Creates a new time off request and its associated approval record.
+	 *
+	 * @param entity - The input data for creating a time off request.
+	 * @returns A promise that resolves to the saved TimeOffRequest.
+	 * @throws {BadRequestException} If any error occurs during the creation process.
+	 */
 	async create(entity: ITimeOffCreateInput): Promise<TimeOffRequest> {
-		try {
-			const request = new TimeOffRequest();
-			Object.assign(request, entity);
+		const request = new TimeOffRequest();
+		Object.assign(request, entity);
 
-			const tenantId = RequestContext.currentTenantId();
-			const currentUser = RequestContext.currentUser();
+		// Retrieve tenant and user context.
+		const tenantId = RequestContext.currentTenantId();
+		const currentUserId = RequestContext.currentUserId();
 
-			const timeOffRequest = await this.typeOrmRepository.save(request);
+		// Save the time off request first.
+		const timeOffRequest = await this.typeOrmRepository.save(request);
 
-			const requestApproval = new RequestApproval();
-			requestApproval.requestId = timeOffRequest.id;
-			requestApproval.requestType = ApprovalPolicyTypesStringEnum.TIME_OFF;
-			requestApproval.status = timeOffRequest.status
-				? StatusTypesMapRequestApprovalEnum[timeOffRequest.status]
-				: RequestApprovalStatusTypesEnum.REQUESTED;
+		// Prepare the request approval record using the new request's id.
+		const requestApproval = new RequestApproval();
+		requestApproval.requestId = timeOffRequest.id;
+		requestApproval.requestType = ApprovalPolicyTypesStringEnum.TIME_OFF;
+		requestApproval.status = timeOffRequest.status
+			? StatusTypesMapRequestApprovalEnum[timeOffRequest.status]
+			: RequestApprovalStatusTypesEnum.REQUESTED;
+		requestApproval.createdByUserId = currentUserId;
+		requestApproval.name = 'Request time off';
+		requestApproval.min_count = 1;
+		requestApproval.organizationId = timeOffRequest.organizationId;
+		requestApproval.tenantId = tenantId;
 
-			requestApproval.createdBy = currentUser.id;
-			requestApproval.createdByName = currentUser.name;
-			requestApproval.name = 'Request time off';
-			requestApproval.min_count = 1;
-			requestApproval.organizationId = timeOffRequest.organizationId;
-			requestApproval.tenantId = tenantId;
+		// Save the request approval record. Using Promise.all here allows you to
+		// concurrently run other independent asynchronous operations if needed.
+		await this.typeOrmRequestApprovalRepository.save(requestApproval);
 
-			await this.typeOrmRequestApprovalRepository.save(requestApproval);
-			return timeOffRequest;
-		} catch (err) {
-			throw new BadRequestException(err);
-		}
+		return timeOffRequest;
 	}
 
 	async getAllTimeOffRequests(
@@ -106,9 +113,7 @@ export class TimeOffRequestService extends TenantAwareCrudService<TimeOffRequest
 				id,
 				...timeOffRequest
 			});
-		} catch (error) {
-			throw new BadRequestException(error);
-		}
+		} catch (error) {}
 	}
 
 	async updateStatusTimeOffByAdmin(id: string, status: string): Promise<TimeOffRequest> {
diff --git a/packages/core/src/lib/time-off-request/time-off-request.subscriber.ts b/packages/core/src/lib/time-off-request/time-off-request.subscriber.ts
index fb69c5573a1..97b11defe85 100644
--- a/packages/core/src/lib/time-off-request/time-off-request.subscriber.ts
+++ b/packages/core/src/lib/time-off-request/time-off-request.subscriber.ts
@@ -1,6 +1,7 @@
 import { EventSubscriber } from 'typeorm';
-import { TimeOffRequest } from './time-off-request.entity';
+import { RequestContext } from '../core/context';
 import { BaseEntityEventSubscriber } from '../core/entities/subscribers/base-entity-event.subscriber';
+import { TimeOffRequest } from './time-off-request.entity';
 
 @EventSubscriber()
 export class TimeOffRequestSubscriber extends BaseEntityEventSubscriber<TimeOffRequest> {
@@ -28,4 +29,20 @@ export class TimeOffRequestSubscriber extends BaseEntityEventSubscriber<TimeOffR
 			console.error('TimeOffRequestSubscriber: An error occurred during the afterEntityLoad process:', error);
 		}
 	}
+
+	/**
+	 * Called before an TimeOffRequest entity is inserted into the database. This method sets the
+	 * creator ID, generates a slug for the profile link, and assigns a default logo if necessary.
+	 *
+	 * @param entity The TimeOffRequest entity about to be created.
+	 * @returns {Promise<void>} A promise that resolves when the pre-insertion processing is complete.
+	 */
+	async beforeEntityCreate(entity: TimeOffRequest): Promise<void> {
+		try {
+			// Assign the current user's ID as the creator
+			entity.createdByUserId = RequestContext.currentUserId();
+		} catch (error) {
+			console.error('TimeOffRequestSubscriber: An error occurred during the beforeEntityCreate process:', error);
+		}
+	}
 }


Reviews:
user: login: coderabbitai[bot]
body: **Actionable comments posted: 6**

<details>
<summary>🧹 Nitpick comments (9)</summary><blockquote>

<details>
<summary>packages/contracts/src/lib/equipment-sharing.model.ts (1)</summary><blockquote>

`39-39`: **Improved API flexibility with partial update model.**

The change to make `IEquipmentSharingUpdateInput` extend `Partial<IEquipmentSharingCreateInput>` instead of the full `IEquipmentSharingCreateInput` is a significant improvement. This allows clients to specify only the fields they want to update rather than requiring all fields to be present in update operations.

This change follows best practices for REST API update operations and will make the API more user-friendly by enabling partial updates.


Consider adding a comment that explains the rationale behind using the Partial type wrapper, similar to the existing comment on line 38. For example:

```diff
// Update input can simply extend the create input.
+// We use Partial to make all properties optional for update operations
export interface IEquipmentSharingUpdateInput extends Partial<IEquipmentSharingCreateInput> {}
```

</blockquote></details>
<details>
<summary>packages/core/src/lib/request-approval/request-approval.service.ts (2)</summary><blockquote>

`177-188`: **DRY principle opportunity **  
The logic for creating `employeeApprovals` mirrors the `teamApprovals` block below. Extracting a common helper method would reduce duplication and make maintenance easier.

---

`192-204`: **Duplicate pattern with teamApprovals **  
Similar to the employee approvals logic, consider abstracting this section into a reusable function to improve readability and consistency.

</blockquote></details>
<details>
<summary>packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.update.handler.ts (1)</summary><blockquote>

`34-36`: **Consider using update instead of delete-then-create.**

The current implementation deletes and recreates the record, which can be inefficient. Consider using an update operation instead, especially if the record has relationships that might be lost during deletion.


```diff
-// Save the updated Equipment Sharing record.
-const equipmentSharing = await this._equipmentSharingService.create(input);
+// Update the existing Equipment Sharing record.
+const equipmentSharing = await this._equipmentSharingService.update(id, input);
```

</blockquote></details>
<details>
<summary>packages/core/src/lib/time-off-request/commands/handlers/time-off.create.handler.ts (3)</summary><blockquote>

`17-18`: **Constructor injection**  
The constructor now injects two services, `_timeOffRequestService` and `_requestApprovalService`, which is aligned with best practices. Ensure you document any potential side effects when injecting additional dependencies in the future to keep dependency complexity under control.

---

`21-26`: **Doc block mismatch**  
Although this block declares “Executes the time off update command,” the class name and context indicate it's handling a create command. Update the doc block for clarity.  


```diff
- * Executes the time off update command.
+ * Executes the time off create command.
```

---

`27-45`: **Inconsistent comment references & missing error handling**  
1. Lines 30 and 33 mention “equipment sharing” instead of “time off request.” Update these references for clarity.  
2. The previous code had a try/catch block that threw a `BadRequestException` on failure. Consider reintroducing or centralizing error handling to gracefully manage unexpected conditions.  


```diff
- // Create the request approval record for the created equipment sharing.
+ // Create the request approval record for the created time off request.
```

</blockquote></details>
<details>
<summary>packages/contracts/src/lib/request-approval.model.ts (1)</summary><blockquote>

`35-38`: **Using numeric type for status**  
The `status: number` property, combined with `RequestApprovalStatusTypesEnum`, might be confusing to new contributors. Consider strongly typing `status` directly to the enum or clarifying the numeric representation in JSDoc to reduce ambiguity.

</blockquote></details>
<details>
<summary>packages/core/src/lib/database/migrations/1741071424998-AlterRequestApprovalEntityTable.ts (1)</summary><blockquote>

`92-227`: **SQLite approach with temporary tables**  
Using a temporary table to restructure columns is a proven method for SQLite. Consider wrapping index-drop statements with `IF EXISTS` to avoid errors if indexes are missing. Otherwise, the approach is thorough and consistent with prior migrations.

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 63918e4c866ea4a07a5c9ac29365dc035e6c7cd7 and 07679cfdea6c1c9d1b017d0f7565b4438c335a4a.

</details>

<details>
<summary>📒 Files selected for processing (20)</summary>

* `apps/gauzy/src/app/pages/approvals/approvals.component.ts` (1 hunks)
* `packages/contracts/src/lib/equipment-sharing.model.ts` (1 hunks)
* `packages/contracts/src/lib/request-approval.model.ts` (2 hunks)
* `packages/core/src/lib/database/migrations/1741071424998-AlterRequestApprovalEntityTable.ts` (1 hunks)
* `packages/core/src/lib/equipment-sharing/commands/equipment-sharing.create.command.ts` (1 hunks)
* `packages/core/src/lib/equipment-sharing/commands/equipment-sharing.update.command.ts` (1 hunks)
* `packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.create.handler.ts` (2 hunks)
* `packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.status.handler.ts` (2 hunks)
* `packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.update.handler.ts` (2 hunks)
* `packages/core/src/lib/request-approval/request-approval.entity.ts` (1 hunks)
* `packages/core/src/lib/request-approval/request-approval.seed.ts` (5 hunks)
* `packages/core/src/lib/request-approval/request-approval.service.ts` (3 hunks)
* `packages/core/src/lib/time-off-request/commands/handlers/time-off.create.handler.ts` (1 hunks)
* `packages/core/src/lib/time-off-request/commands/handlers/time-off.update.handler.ts` (1 hunks)
* `packages/core/src/lib/time-off-request/commands/time-off.create.command.ts` (1 hunks)
* `packages/core/src/lib/time-off-request/commands/time-off.update.command.ts` (1 hunks)
* `packages/core/src/lib/time-off-request/time-off-request.controller.ts` (6 hunks)
* `packages/core/src/lib/time-off-request/time-off-request.entity.ts` (2 hunks)
* `packages/core/src/lib/time-off-request/time-off-request.service.ts` (2 hunks)
* `packages/core/src/lib/time-off-request/time-off-request.subscriber.ts` (2 hunks)

</details>

<details>
<summary>✅ Files skipped from review due to trivial changes (2)</summary>

* packages/core/src/lib/time-off-request/time-off-request.entity.ts
* packages/core/src/lib/time-off-request/time-off-request.controller.ts

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🧠 Learnings (1)</summary>

<details>
<summary>packages/core/src/lib/database/migrations/1741071424998-AlterRequestApprovalEntityTable.ts (2)</summary>

```
Learnt from: rahul-rocket
PR: ever-co/ever-gauzy#8834
File: packages/core/src/lib/database/migrations/1740999625643-AlterEntitySubscriptionEntityTable.ts:59-60
Timestamp: 2025-03-03T13:02:02.322Z
Learning: The migration 'AlterEntitySubscriptionEntityTable1740999625643' is specifically designed to only work with SQLite databases, not with PostgreSQL or MySQL.
```

```
Learnt from: rahul-rocket
PR: ever-co/ever-gauzy#8800
File: packages/core/src/lib/database/migrations/1740146592586-AlterOrganizationProjectModuleEntityTable.ts:0-0
Timestamp: 2025-02-24T05:26:43.208Z
Learning: SQLite and MySQL migration implementations for the Task entity table alterations will be added in subsequent commits. This is an intentional decision to implement the changes incrementally.
```

</details>

</details>

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (3)</summary>

* GitHub Check: Codacy Static Code Analysis
* GitHub Check: test
* GitHub Check: build

</details>

<details>
<summary>🔇 Additional comments (60)</summary><blockquote>

<details>
<summary>packages/core/src/lib/equipment-sharing/commands/equipment-sharing.create.command.ts (1)</summary>

`7-7`: **Parameter naming change improves clarity and consistency.**

Changing the parameter name from `entity` to `input` is a good improvement as it more accurately reflects the purpose of the parameter as input data for the command. This also ensures consistency with the naming convention used in other command classes like `EquipmentSharingUpdateCommand`.

</details>
<details>
<summary>packages/core/src/lib/time-off-request/commands/time-off.create.command.ts (1)</summary>

`7-7`: **Parameter naming change improves consistency across commands.**

Changing the parameter name from `timeOff` to `input` creates better consistency with other command classes in the codebase. This naming convention better represents the role of this parameter as command input data rather than a specific entity type.

</details>
<details>
<summary>packages/core/src/lib/equipment-sharing/commands/equipment-sharing.update.command.ts (1)</summary>

`7-7`: **Parameter naming change aligns with command pattern best practices.**

The parameter rename from `equipmentSharing` to `input` is appropriate and consistent with the changes made to the create command. This unified naming approach improves code readability and maintainability across the codebase.

</details>
<details>
<summary>packages/core/src/lib/request-approval/request-approval.seed.ts (5)</summary>

`25-30`: **Good addition of JSDoc comments.**

The JSDoc comments for the `createDefaultRequestApprovalEmployee` function improve code documentation by clearly indicating parameters and return type.

---

`41-41`: **Code readability improvement.**

Consolidating the warning message into a single line improves readability.

---

`69-70`: **Simplified database save operation.**

Good refactoring to use a more concise syntax for saving data to the database.

---

`94-94`: **Improved employee selection randomization.**

The code properly implements a random selection of employees using `sort()` with a random comparison function.

---

`119-119`: **Enhanced database insertion with query builder.**

Good refactoring to use the more efficient query builder pattern for inserting multiple records at once.

</details>
<details>
<summary>packages/core/src/lib/time-off-request/commands/time-off.update.command.ts (2)</summary>

`2-2`: **Improved type safety with ID type.**

Importing and using the `ID` type from `@gauzy/contracts` enhances type safety and consistency across the application.

---

`8-8`: **Enhanced command structure with better parameter naming.**

The command constructor has been improved in two ways:
1. Changed `id` type from `string` to the more appropriate `ID` type
2. Renamed `timeOff` parameter to the more generic `input`, which better represents its purpose

This change improves the API design and follows command pattern best practices.

</details>
<details>
<summary>apps/gauzy/src/app/pages/approvals/approvals.component.ts (1)</summary>

`240-248`: **Property name change from 'createdByName' to 'createdByUser'.**

This change aligns the property name with the entity changes in the database where `createdBy` and `createdByName` fields are being replaced with a single `createdByUserId` field. This improves consistency across the codebase.

The component initialization for the `CreatedByUserComponent` remains unchanged, as it still correctly assigns the row data to the instance.

</details>
<details>
<summary>packages/core/src/lib/time-off-request/time-off-request.subscriber.ts (4)</summary>

`2-2`: **Added import for RequestContext.**

The addition of the `RequestContext` import is necessary for accessing the current user ID in the new `beforeEntityCreate` method.

---

`4-4`: **Reordered import for better organization.**

Moving the `TimeOffRequest` import after the core imports follows a good practice of organizing imports from general to specific.

---

`33-47`: **Implemented entity lifecycle hook for setting creator ID.**

The new `beforeEntityCreate` method is a well-designed lifecycle hook that:
1. Automatically assigns the current user's ID to the `createdByUserId` property
2. Implements proper error handling with try/catch
3. Includes comprehensive JSDoc documentation

This addition ensures consistent tracking of the request creator and aligns with the database schema changes that replaced `createdBy` and `createdByName` with `createdByUserId`.

---

`40-46`: <details>
<summary>✅ Verification successful</summary>

**Verify integration with RequestApproval entity changes.**

The code sets `createdByUserId` on the TimeOffRequest entity, which appears to be part of a broader change replacing `createdBy` and `createdByName`. Let's verify that these fields have been properly removed from the database schema and that all relevant entities have been updated consistently.

---

🏁 Script executed:

```shell
#!/bin/bash
# Check for the existence of createdByUserId field and removal of createdBy/createdByName in related entities

# Look for migration files related to RequestApproval
echo "Searching for RequestApproval migrations..."
fd "RequestApproval" --type f | grep -i "migration"

# Check the definition of RequestApproval entity
echo "Checking RequestApproval entity definition..."
fd "request-approval.entity.ts" --type f --exec cat {}

# Check TimeOffRequest entity definition
echo "Checking TimeOffRequest entity definition..."
fd "time-off-request.entity.ts" --type f --exec cat {}

# Check for usage of createdBy/createdByName vs createdByUserId
echo "Checking for usage patterns..."
rg "createdBy(User)?Id" --type ts
rg "createdByName" --type ts
rg "createdBy[^a-zA-Z]" --type ts
```

Length of output: 72969

---



</details>

**Integration Verified – RequestApproval Updates Consistent**

The verification confirms that the migration files and entity definitions have been correctly updated:
- The RequestApproval migrations (e.g., `1741071424998-AlterRequestApprovalEntityTable.ts`) properly shift data from `createdBy` to `createdByUserId`.
- The RequestApproval and other related entities no longer reference `createdByName`, and all usage now consistently relies on `createdByUserId`.
- The update in `time-off-request.subscriber.ts` aligns with these broader changes.

</details>
<details>
<summary>packages/core/src/lib/time-off-request/commands/handlers/time-off.update.handler.ts (4)</summary>

`6-7`: **Service-oriented approach **  
Using dedicated services rather than direct repository interactions promotes a more modular architecture and aligns with best practices.

---

`12-13`: **Dependency injection looks good **  
No immediate issues with injecting `RequestApprovalService` and `TimeOffRequestService`. This helps ensure better testability.

---

`16-23`: **Helpful JSDoc comment **  
This comment block clearly explains the method's purpose, parameters, and return value, improving maintainability.

---

`23-45`: **Potential partial update concerns **  
Deleting and recreating the record entirely may break references for any modules that depend on the original ID. Ensure no downstream logic relies on retaining the same record ID.  
Would you like me to generate a script to search for references to this time off request ID across the code to verify dependency impact?

</details>
<details>
<summary>packages/core/src/lib/request-approval/request-approval.service.ts (5)</summary>

`115-116`: **Informative inline comment **  
Documenting the logic behind retrieving the user context makes the code easier to understand for new contributors.

---

`122-122`: **Ownership logic **  
Linking request approvals to the current user’s ID is sensible if the current user is always the originator. Verify whether you also need to track the employee’s ID or a separate approver user reference for auditing.

---

`156-161`: **Clear JSDoc **  
Great job documenting parameters and returns in the `createRequestApproval` method.

---

`163-166`: **Consistent user/tenant retrieval **  
Using `RequestContext.currentUserId()` aligns with the updated pattern of referencing IDs directly, ensuring consistent usage across the codebase.

---

`170-170`: **Field consolidation **  
Replacing `createdBy` and `createdByName` with `createdByUserId` streams down to a simpler, ID-based approach, reducing duplication.

</details>
<details>
<summary>packages/core/src/lib/time-off-request/time-off-request.service.ts (3)</summary>

`33-39`: **JSDoc clarity **  
These comments provide a concise overview of the `create` method’s responsibilities.

---

`41-49`: **Object.assign risks **  
While `Object.assign` is concise, consider validating or sanitizing input to avoid introducing unexpected properties to the `TimeOffRequest` object.  
Would you like a quick script to confirm no extraneous fields are passed at runtime?

---

`68-68`: **Return value **  
Returning the newly created `timeOffRequest` is helpful for further processing or confirmations.

</details>
<details>
<summary>packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.create.handler.ts (7)</summary>

`3-4`: **Import restructuring looks good.**

The imports have been updated to use the RequestApprovalService instead of directly accessing the repository, which aligns with service-oriented architecture principles.

---

`11-14`: **Good refactoring to service-oriented approach.**

Changing from direct repository access to service-based dependency injection improves separation of concerns and follows better architectural practices. The naming convention with underscore prefix for private members is also consistent with common TypeScript conventions.

---

`23-25`: **Clear and concise comment for user ID extraction.**

Good practice to include explanatory comments that document where the user ID is coming from.

---

`27-27`: **Improved parameter naming from 'entity' to 'input'.**

The change from `entity` to `input` better reflects that this is incoming data rather than an already constructed entity, improving code readability.

---

`29-34`: **More concise equipment sharing creation.**

The creation logic has been simplified to use a single service call with spread operator, making the code more readable and maintainable.

---

`36-44`: **Streamlined request approval creation logic.**

The request approval creation has been simplified by using the service directly with all necessary properties passed in a single object, following good practices for service-oriented architecture.

---

`46-46`: **Clean return statement.**

Clear and explicit return of the created equipment sharing entity.

</details>
<details>
<summary>packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.status.handler.ts (5)</summary>

`4-4`: **Proper import of RequestApprovalService.**

Good migration from direct repository access to service-based approach.

---

`10-13`: **Consistent service naming convention.**

Using underscore prefix for private members is consistent with the codebase style.

---

`25-28`: **Improved concurrent data retrieval.**

Using Promise.all for parallel execution of independent queries is a good performance optimization.

---

`35-37`: **Enhanced error handling for request approval.**

Adding a specific check for the request approval's existence with a clear error message improves error handling.

---

`45-45`: **Clean equipment sharing update.**

The update operation is now simpler and more focused, updating only the status field.

</details>
<details>
<summary>packages/core/src/lib/request-approval/request-approval.entity.ts (9)</summary>

`8-10`: **Cleaned up and consolidated imports.**

The import statements have been reorganized and consolidated for better readability and maintenance.

---

`27-34`: **Improved use of multi-ORM decorators.**

The explicit imports of MultiORM decorators improve code readability and maintainability.

---

`46-50`: **Added proper validation for status field.**

Making the status field optional with explicit validation decorator improves data integrity.

---

`52-56`: **Added proper validation for min_count field.**

Making the min_count field optional with explicit validation improves data integrity.

---

`58-61`: **Updated requestId type to ID.**

Changed the requestId type from string to ID, which provides more flexibility for different ID types in the system.

---

`63-67`: **Improved requestType field with enum type.**

Using ApprovalPolicyTypesStringEnum for requestType ensures type safety and consistency.

---

`74-85`: **Enhanced approvalPolicy relation configuration.**

Making the approvalPolicy relation optional with proper validation decorators and improved documentation comments enhances clarity and flexibility.

---

`87-96`: **Improved approvalPolicyId property with optional marker.**

Adding proper validation and documentation for the approvalPolicyId makes the code more robust.

---

`123-132`: **Enhanced tag relationship configuration.**

Improved documentation and configuration for the tags many-to-many relationship adds clarity.

</details>
<details>
<summary>packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.update.handler.ts (4)</summary>

`4-5`: **Import restructuring looks good.**

Appropriate imports for the services and entities.

---

`11-14`: **Good refactoring to service-oriented approach.**

The constructor now uses services instead of repositories, which is a better architectural approach.

---

`23-24`: **Appropriate user context retrieval.**

Getting the current user ID from the request context is a secure and centralized approach.

---

`26-26`: **Improved parameter naming from 'equipmentSharing' to 'input'.**

Using 'input' better reflects that this is incoming data rather than an already constructed entity.

</details>
<details>
<summary>packages/core/src/lib/time-off-request/commands/handlers/time-off.create.handler.ts (1)</summary>

`9-12`: **Use of services for data operations**  
The shift to `TimeOffRequestService` and `RequestApprovalService` is a clean approach toward a more service-oriented architecture. This design improves testability and decouples ORM-specific details from the command handler.

</details>
<details>
<summary>packages/contracts/src/lib/request-approval.model.ts (3)</summary>

`1-7`: **New imports and enumerations**  
The updated imports (lines 1, 6, 7) properly reference the new or reorganized types (`ID`, `IApprovalPolicy`, etc.). No issues found with these additions.

---

`21-33`: **Base interfaces for better modularity**  
Introducing `IBaseRequestApprovalProperties` and `IRequestApprovalAssociations` promotes clearer separation of concerns and reusability. This is a good design choice for maintainable code.

---

`41-43`: **Optional `status` in create input**  
Allowing `status?: number` gives flexibility for partial creation. Confirm that all code paths handle an undefined status appropriately (e.g. defaulting to `REQUESTED`).

</details>
<details>
<summary>packages/core/src/lib/database/migrations/1741071424998-AlterRequestApprovalEntityTable.ts (4)</summary>

`1-30`: **Consistent approach to multi-database migration**  
The `up` method uses a switch statement to delegate logic to specific database-type methods (SQLite/Postgres/MySQL). This structure is clear, but be sure to keep all branches in sync if additional columns or constraints are added later.

---

`32-52`: **Symmetry in down method**  
Mirroring the `up` method in `down` ensures reversibility. Check that columns dropped in `up` (like `createdByName`) are fully restored in `down`. The logic here looks correct.

---

`54-71`: **Potential UUID cast issues (Postgres)**  
The forced cast `"createdBy"::uuid` (line 62 in `postgresUpQueryRunner`) will fail if legacy `createdBy` values are not valid UUIDs. Ensure your existing data is sanitized or handle invalid entries to prevent migration failure.

---

`366-403`: **MySQL column drop and data transfer**  
The MySQL block (lines 372-383 and 391-402) consistently drops/readds columns, transferring data into `createdByUserId`. Validate in your staging environment that references remain intact and no data is truncated if `createdBy` was longer than 255 characters.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-04T08:14:40Z
user: login: coderabbitai[bot]
body: **Actionable comments posted: 0**

<details>
<summary>🧹 Nitpick comments (5)</summary><blockquote>

<details>
<summary>packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.status.handler.ts (1)</summary><blockquote>

`39-40`: **Misleading comment needs updating.**

The comment "If a corresponding request approval exists, update its status as well." is misleading since we're unconditionally updating the request approval status after validating its existence.


```diff
-		// If a corresponding request approval exists, update its status as well.
+		// Update the request approval's status.
 		await this._requestApprovalService.update({ requestId: id }, { status });
```

</blockquote></details>
<details>
<summary>packages/core/src/lib/time-off-request/commands/handlers/time-off.create.handler.ts (4)</summary><blockquote>

`9-11`: **Architecture improvement through service-oriented design.**

Importing service classes instead of directly using repositories shows a positive shift toward a more maintainable service-oriented architecture, which improves separation of concerns and testability.


This change is part of a good architectural pattern that separates data access from business logic, making the code more modular and easier to test. Consider applying this pattern consistently across the codebase.

---

`16-18`: **Good refactoring to service injection.**

The constructor now correctly injects services rather than directly using repositories, following dependency inversion principles.


Consider using the `@InjectRepository()` decorator for any remaining repositories in the codebase that still need direct injection to maintain consistency.

---

`29-30`: **Incorrect comment regarding equipment sharing.**

The comment references "equipment sharing" but this handler is for time-off requests.

```diff
- // Create the request approval record for the created equipment sharing.
+ // Create the time off request using the service.
```

---

`32-41`: **Incorrect comment and potential naming inconsistency.**

1. The comment incorrectly references "equipment sharing" instead of "time off request".
2. The name parameter "Request time off" could potentially be more descriptive.


```diff
- // Create the request approval record for the created equipment sharing.
+ // Create the request approval record for the time off request.

  await this._requestApprovalService.create({
    requestId: timeOffRequest.id,
    requestType: ApprovalPolicyTypesStringEnum.TIME_OFF,
    status: timeOffRequest.status
      ? StatusTypesMapRequestApprovalEnum[timeOffRequest.status]
      : RequestApprovalStatusTypesEnum.REQUESTED,
-   name: 'Request time off',
+   name: `Time off request for ${timeOffRequest.description || 'employee'}`,
    min_count: 1
  });
```

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 07679cfdea6c1c9d1b017d0f7565b4438c335a4a and e5e53a61a434f46d0c4fde267e33fb5d804b9016.

</details>

<details>
<summary>📒 Files selected for processing (3)</summary>

* `packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.status.handler.ts` (2 hunks)
* `packages/core/src/lib/time-off-request/commands/handlers/time-off.create.handler.ts` (1 hunks)
* `packages/core/src/lib/time-off-request/commands/handlers/time-off.update.handler.ts` (1 hunks)

</details>

<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary>

* packages/core/src/lib/time-off-request/commands/handlers/time-off.update.handler.ts

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (3)</summary>

* GitHub Check: Codacy Static Code Analysis
* GitHub Check: test
* GitHub Check: build

</details>

<details>
<summary>🔇 Additional comments (9)</summary><blockquote>

<details>
<summary>packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.status.handler.ts (5)</summary>

`4-4`: **Appropriate service injection for request approval.**

The import of `RequestApprovalService` is a good architectural change, moving away from direct repository usage in favor of a service-oriented approach, which improves maintainability and separation of concerns.

---

`11-12`: **Consistent naming convention adopted with underscore prefix.**

The renamed service members with underscore prefix follow TypeScript best practices for private class members, improving code consistency and readability.

---

`26-27`: **Service usage is correctly implemented.**

The refactored method calls appropriately utilize the renamed service members and their respective methods for retrieving both the equipment sharing and request approval records concurrently.

---

`35-37`: **Proper validation for request approval.**

Adding explicit validation for the request approval entity with a clear exception message is a good practice that ensures data integrity and fails early if required data is missing.

---

`43-43`: **Simplified update operation.**

The update operation for equipment sharing has been streamlined to only update the status field, which is more focused and efficient than updating the entire record.

</details>
<details>
<summary>packages/core/src/lib/time-off-request/commands/handlers/time-off.create.handler.ts (4)</summary>

`1-1`: **Appropriate import changes for error handling.**

The change to `HttpException` and `HttpStatus` imports aligns with the updated error handling strategy in the execute method.

---

`20-25`: **Improved code documentation with JSDoc.**

Adding JSDoc comments enhances code readability and maintainability.

---

`26-27`: **API strengthening by removing optional parameter.**

Making the command parameter required rather than optional improves type safety and API clarity.

---

`45-48`: <details>
<summary>❓ Verification inconclusive</summary>

**Enhanced error handling with more descriptive messages.**

The error handling has been improved by:
1. Using a more specific error message that includes the original error
2. Using HttpException with an appropriate status code



Consider whether `INTERNAL_SERVER_ERROR` is always appropriate here. Some errors might be client-related (`BAD_REQUEST`), especially for validation failures. You may want to check if the previous implementation distinguished between different error types.

---

🏁 Script executed:

```shell
#!/bin/bash
# Check for other error handling patterns in the codebase

# Look for patterns of error handling in other command handlers
rg -A 3 "throw new (BadRequestException|HttpException)" --type ts "packages/core/src/lib/*/commands/handlers/*.handler.ts" | grep -v "time-off.create.handler.ts"
```

Length of output: 256

---

**Action: Revisit HTTP Error Code Usage in Time-off Request Handler**

- The handler in `packages/core/src/lib/time-off-request/commands/handlers/time-off.create.handler.ts` (lines 45–48) currently throws an `HttpException` with the `INTERNAL_SERVER_ERROR` status for all errors.
- Consider whether this status is always appropriate. For instance, validation errors might be better represented as client errors using the `BAD_REQUEST` status.
- Since our initial search using the provided file patterns was inconclusive (likely due to path wildcard mismatches), please manually verify if other command handlers distinguish between server and client errors based on the error context.



---

🏁 Script executed:

```shell

#!/bin/bash
# List all TypeScript files in any 'handlers' directory under packages/core/src/lib
fd --extension ts "handlers" packages/core/src/lib/

# Search for error handling using HttpException across command handler files
echo "Occurrences of 'throw new HttpException':"
rg -A 3 "throw new HttpException" packages/core/src/lib/**/commands/handlers/*.handler.ts

# Search for error handling using BadRequestException to check for client error cases
echo "Occurrences of 'throw new BadRequestException':"
rg -A 3 "throw new BadRequestException" packages/core/src/lib/**/commands/handlers/*.handler.ts
```

Length of output: 56356

---



</details>

**Action Required: Reevaluate Error Status Code for Time-Off Request Handling**

The updated error handling now includes enhanced, descriptive messages that capture the underlying error (which is an improvement). However, our review of similar command handlers across the codebase reveals some handlers switch to using `HttpStatus.BAD_REQUEST` when dealing with client-side or validation errors. In contrast, the time-off creation (and update) handlers are hard-coded to use `HttpStatus.INTERNAL_SERVER_ERROR` for all errors. Please verify if errors arising from invalid client input (for example, validation issues) should indeed be signaled with a `BAD_REQUEST` rather than a server error. Adjusting the HTTP status code based on the error context can help provide clearer feedback to API consumers.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-04T08:47:03Z

Review comments:
diff_hunk: @@ -33,26 +38,23 @@ export const createDefaultRequestApprovalEmployee = async (
 ): Promise<void> => {
 	const requestApprovals: RequestApproval[] = [];
 	if (!defaultData.approvalPolicies) {
-		console.warn(
-			'Warning: Approval Policies not found, Request Approval Employee  will not be created'
-		);
+		console.warn('Warning: Approval Policies not found, Request Approval Employee  will not be created');
 		return;
 	}
 
 	for await (const org of defaultData.orgs) {
-
 		const requestApproval = new RequestApproval();
 		requestApproval.name = faker.helpers.arrayElement(approvalTypes);
 		requestApproval.status = faker.number.int({ min: 1, max: 3 });
 		requestApproval.approvalPolicy = faker.helpers.arrayElement(defaultData.approvalPolicies);
 		requestApproval.min_count = faker.number.int({ min: 1, max: 56 });
-		requestApproval.createdBy = faker.helpers.arrayElement(defaultData.employees).id;
-
 
 		const requestApprovalEmployees: RequestApprovalEmployee[] = [];
 		for await (const employee of faker.helpers.arrayElements(defaultData.employees, 5)) {
 			const defaultRequestApprovalEmployee = new RequestApprovalEmployee();
-			defaultRequestApprovalEmployee.requestApprovalId = faker.helpers.arrayElement(defaultData.approvalPolicies).id;
+			defaultRequestApprovalEmployee.requestApprovalId = faker.helpers.arrayElement(
+				defaultData.approvalPolicies
+			).id;
path: packages/core/src/lib/request-approval/request-approval.seed.ts
user: login: coderabbitai[bot]
body: _⚠️ Potential issue_

**Logic issue in requestApprovalId assignment.**

The code is assigning an approval policy ID as the requestApprovalId, which appears to be incorrect. The requestApprovalId should likely be related to the request approval entity, not an approval policy.


```diff
-defaultRequestApprovalEmployee.requestApprovalId = faker.helpers.arrayElement(
-	defaultData.approvalPolicies
-).id;
+defaultRequestApprovalEmployee.requestApprovalId = requestApproval.id;
```

This correction ensures the requestApprovalEmployee is properly linked to its parent requestApproval entity.


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
			defaultRequestApprovalEmployee.requestApprovalId = requestApproval.id;
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-03-04T08:14:39Z
author_association: CONTRIBUTOR
diff_hunk: @@ -106,9 +113,7 @@ export class TimeOffRequestService extends TenantAwareCrudService<TimeOffRequest
 				id,
 				...timeOffRequest
 			});
-		} catch (error) {
-			throw new BadRequestException(error);
-		}
+		} catch (error) {}
path: packages/core/src/lib/time-off-request/time-off-request.service.ts
user: login: coderabbitai[bot]
body: _⚠️ Potential issue_

**Empty catch block **  
Silently discarding errors can mask failures and hinder debugging. Re-throw or handle the error appropriately:
```diff
- } catch (error) {}
+ } catch (error) {
+   throw new BadRequestException(error);
+ }
```



<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
		} catch (error) {
			throw new BadRequestException(error);
		}
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-03-04T08:14:39Z
author_association: CONTRIBUTOR
diff_hunk: @@ -30,35 +30,42 @@
 		super(typeOrmTimeOffRequestRepository, mikroOrmTimeOffRequestRepository);
 	}
 
+	/**
+	 * Creates a new time off request and its associated approval record.
+	 *
+	 * @param entity - The input data for creating a time off request.
+	 * @returns A promise that resolves to the saved TimeOffRequest.
+	 * @throws {BadRequestException} If any error occurs during the creation process.
+	 */
 	async create(entity: ITimeOffCreateInput): Promise<TimeOffRequest> {
-		try {
-			const request = new TimeOffRequest();
-			Object.assign(request, entity);
+		const request = new TimeOffRequest();
+		Object.assign(request, entity);
 
-			const tenantId = RequestContext.currentTenantId();
-			const currentUser = RequestContext.currentUser();
+		// Retrieve tenant and user context.
+		const tenantId = RequestContext.currentTenantId();
+		const currentUserId = RequestContext.currentUserId();
 
-			const timeOffRequest = await this.typeOrmRepository.save(request);
+		// Save the time off request first.
+		const timeOffRequest = await this.typeOrmRepository.save(request);
 
-			const requestApproval = new RequestApproval();
-			requestApproval.requestId = timeOffRequest.id;
-			requestApproval.requestType = ApprovalPolicyTypesStringEnum.TIME_OFF;
-			requestApproval.status = timeOffRequest.status
-				? StatusTypesMapRequestApprovalEnum[timeOffRequest.status]
-				: RequestApprovalStatusTypesEnum.REQUESTED;
+		// Prepare the request approval record using the new request's id.
+		const requestApproval = new RequestApproval();
+		requestApproval.requestId = timeOffRequest.id;
+		requestApproval.requestType = ApprovalPolicyTypesStringEnum.TIME_OFF;
+		requestApproval.status = timeOffRequest.status
+			? StatusTypesMapRequestApprovalEnum[timeOffRequest.status]
+			: RequestApprovalStatusTypesEnum.REQUESTED;
+		requestApproval.createdByUserId = currentUserId;
+		requestApproval.name = 'Request time off';
+		requestApproval.min_count = 1;
+		requestApproval.organizationId = timeOffRequest.organizationId;
+		requestApproval.tenantId = tenantId;
 
-			requestApproval.createdBy = currentUser.id;
-			requestApproval.createdByName = currentUser.name;
-			requestApproval.name = 'Request time off';
-			requestApproval.min_count = 1;
-			requestApproval.organizationId = timeOffRequest.organizationId;
-			requestApproval.tenantId = tenantId;
+		// Save the request approval record. Using Promise.all here allows you to
+		// concurrently run other independent asynchronous operations if needed.
+		await this.typeOrmRequestApprovalRepository.save(requestApproval);
 
path: packages/core/src/lib/time-off-request/time-off-request.service.ts
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Consider transactions **  
If saving the request approval fails after the time off request is created, the database ends up in a partial state. Wrapping both operations in a transaction ensures atomicity:
```diff
+ // Example snippet
+ await this.connection.transaction(async manager => {
+   const savedRequest = await manager.save(TimeOffRequest, request);
+   const requestApproval = new RequestApproval();
+   // ...
+   await manager.save(RequestApproval, requestApproval);
+   return savedRequest;
+ });
```



> Committable suggestion skipped: line range outside the PR's diff.

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-03-04T08:14:39Z
author_association: CONTRIBUTOR
diff_hunk: @@ -23,25 +23,25 @@ export class EquipmentSharingStatusHandler implements ICommandHandler<EquipmentS
 
 		// Retrieve the equipment sharing record and its associated request approval concurrently.
 		const [equipmentSharing, requestApproval] = await Promise.all([
-			this.equipmentSharingService.findOneByIdString(id),
-			this.typeOrmRequestApprovalRepository.findOneBy({ requestId: id })
+			this._equipmentSharingService.findOneByIdString(id),
+			this._requestApprovalService.findOneByWhereOptions({ requestId: id })
 		]);
 
 		// If the equipment sharing record is not found, throw an exception.
 		if (!equipmentSharing) {
 			throw new NotFoundException('Equipment Sharing not found');
 		}
 
-		// Update the equipment sharing status.
-		equipmentSharing.status = status;
+		if (!requestApproval) {
+			throw new NotFoundException('Request Approval not found');
+		}
 
 		// If a corresponding request approval exists, update its status as well.
 		if (requestApproval) {
-			requestApproval.status = status;
-			await this.typeOrmRequestApprovalRepository.save(requestApproval);
+			await this._requestApprovalService.update({ requestId: id }, { status });
 		}
path: packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.status.handler.ts
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Remove redundant conditional check.**

The code checks for `requestApproval` existence twice - once at lines 35-37 (throwing an exception if not found) and then again at line 40. This second check is redundant since the execution would never reach this point if `requestApproval` was null.


```diff
-// If a corresponding request approval exists, update its status as well.
-if (requestApproval) {
-	await this._requestApprovalService.update({ requestId: id }, { status });
-}
+// Update the request approval's status.
+await this._requestApprovalService.update({ requestId: id }, { status });
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
		// Update the request approval's status.
		await this._requestApprovalService.update({ requestId: id }, { status });
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-03-04T08:14:40Z
author_association: CONTRIBUTOR
diff_hunk: @@ -21,34 +20,29 @@ export class EquipmentSharingUpdateHandler implements ICommandHandler<EquipmentS
 	 * @returns A promise that resolves to the updated EquipmentSharing record.
 	 */
 	public async execute(command: EquipmentSharingUpdateCommand): Promise<EquipmentSharing> {
-		const { id, equipmentSharing } = command;
+		// Get the current tenant ID and current user ID from the request context.
+		const createdByUserId = RequestContext.currentUserId();
 
-		const currentUser = RequestContext.currentUser();
-		const tenantId = RequestContext.currentTenantId();
+		const { id, input } = command;
 
 		// Delete the existing Equipment Sharing record and its associated Request Approval concurrently.
 		await Promise.all([
-			this.equipmentSharingService.delete(id),
-			this.typeOrmRequestApprovalRepository.delete({ requestId: id })
+			this._equipmentSharingService.delete(id),
+			this._requestApprovalService.delete({ requestId: id })
 		]);
path: packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.update.handler.ts
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Consider using transactions for delete-then-create pattern.**

The current implementation deletes existing records before creating new ones, which could lead to data integrity issues if the deletion succeeds but creation fails. Consider wrapping this in a database transaction.


```diff
 // Delete the existing Equipment Sharing record and its associated Request Approval concurrently.
-await Promise.all([
-	this._equipmentSharingService.delete(id),
-	this._requestApprovalService.delete({ requestId: id })
-]);
+// Use a transaction to ensure data integrity
+const equipmentSharing = await RequestContext.getEntityManager().transaction(async (transactionManager) => {
+	// Delete existing records
+	await Promise.all([
+		this._equipmentSharingService.delete(id, { transactionManager }),
+		this._requestApprovalService.delete({ requestId: id }, { transactionManager })
+	]);
+
+	// Create new equipment sharing
+	const newEquipmentSharing = await this._equipmentSharingService.create(input, { transactionManager });
+
+	// Create new request approval
+	await this._requestApprovalService.create({
+		requestId: newEquipmentSharing.id,
+		status: newEquipmentSharing.status ?? RequestApprovalStatusTypesEnum.REQUESTED,
+		createdByUserId,
+		name: newEquipmentSharing.name,
+		min_count: 1
+	}, { transactionManager });
+
+	return newEquipmentSharing;
+});
```

Note: This suggestion assumes your services support transaction manager injection. If they don't, you may need to modify the services to support this pattern.


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
		// Use a transaction to ensure data integrity
		const equipmentSharing = await RequestContext.getEntityManager().transaction(async (transactionManager) => {
			// Delete existing records
			await Promise.all([
				this._equipmentSharingService.delete(id, { transactionManager }),
				this._requestApprovalService.delete({ requestId: id }, { transactionManager })
			]);
			
			// Create new equipment sharing
			const newEquipmentSharing = await this._equipmentSharingService.create(input, { transactionManager });
			
			// Create new request approval
			await this._requestApprovalService.create({
				requestId: newEquipmentSharing.id,
				status: newEquipmentSharing.status ?? RequestApprovalStatusTypesEnum.REQUESTED,
				createdByUserId,
				name: newEquipmentSharing.name,
				min_count: 1
			}, { transactionManager });
			
			return newEquipmentSharing;
		});
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-03-04T08:14:40Z
author_association: CONTRIBUTOR
diff_hunk: @@ -21,34 +20,29 @@
 	 * @returns A promise that resolves to the updated EquipmentSharing record.
 	 */
 	public async execute(command: EquipmentSharingUpdateCommand): Promise<EquipmentSharing> {
-		const { id, equipmentSharing } = command;
+		// Get the current tenant ID and current user ID from the request context.
+		const createdByUserId = RequestContext.currentUserId();
 
-		const currentUser = RequestContext.currentUser();
-		const tenantId = RequestContext.currentTenantId();
+		const { id, input } = command;
 
 		// Delete the existing Equipment Sharing record and its associated Request Approval concurrently.
 		await Promise.all([
-			this.equipmentSharingService.delete(id),
-			this.typeOrmRequestApprovalRepository.delete({ requestId: id })
+			this._equipmentSharingService.delete(id),
+			this._requestApprovalService.delete({ requestId: id })
 		]);
 
 		// Save the updated Equipment Sharing record.
-		equipmentSharing.tenantId = tenantId;
-		const equipmentSharingSaved = await this.equipmentSharingService.create(equipmentSharing);
-
-		// Create a new Request Approval record for the updated Equipment Sharing.
-		const requestApproval = new RequestApproval();
-		requestApproval.requestId = equipmentSharingSaved.id;
-		requestApproval.status = equipmentSharingSaved.status ?? RequestApprovalStatusTypesEnum.REQUESTED;
-		requestApproval.createdBy = currentUser.id;
-		requestApproval.createdByName = currentUser.name;
-		requestApproval.name = equipmentSharing.name;
-		requestApproval.min_count = 1;
-		requestApproval.tenantId = tenantId;
-
-		// Save the new Request Approval.
-		await this.typeOrmRequestApprovalRepository.save(requestApproval);
-
-		return equipmentSharingSaved;
+		const equipmentSharing = await this._equipmentSharingService.create(input);
+
+		// Create a new request approval record for the updated equipment sharing.
+		await this._requestApprovalService.create({
+			requestId: equipmentSharing.id,
+			status: equipmentSharing.status ?? RequestApprovalStatusTypesEnum.REQUESTED,
+			createdByUserId,
+			name: equipmentSharing.name,
+			min_count: 1
+		});
path: packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.update.handler.ts
user: login: coderabbitai[bot]
body: _💡 Verification agent_

<details>
<summary>🧩 Analysis chain</summary>

**Ensure request approval fields are preserved during update.**

When updating a request approval, you might want to preserve certain fields from the original record rather than setting them to fixed values.

---

🏁 Script executed:

```shell
#!/bin/bash
# Find the implementation of equipmentSharingService.create to understand how it handles relationships
rg -A 10 "class EquipmentSharingService" --type ts
```

Length of output: 2465

---



</details>

**Preserve Request Approval Fields on Update**

The update handler currently creates a new request approval with hard-coded values (e.g., `min_count: 1`), which may overwrite fields from an existing record. To avoid unintended data loss during an update, please ensure that if a request approval already exists, its non-updated fields are fetched and merged rather than being replaced by fixed values.

- Confirm whether the intent is to update an existing request approval or always create a new one.
- If updating an existing record, retrieve the current approval data (e.g., current `min_count`, status, etc.) and merge it with the new values from `equipmentSharing` before persisting the change.
- Review the implementation of `_requestApprovalService.create` (or consider using an update/merge method) to ensure that fields needing preservation aren’t unintentionally reset.

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-03-04T08:14:40Z
author_association: CONTRIBUTOR

PR comments:
user: login: coderabbitai[bot]
created_at: 2025-03-04T08:07:52Z
body: <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- This is an auto-generated comment: failure by coderabbit.ai -->

> [!CAUTION]
> ## Review failed
> 
> The pull request is closed.

<!-- end of auto-generated comment: failure by coderabbit.ai -->
<!-- walkthrough_start -->

## Walkthrough
This pull request refactors and streamlines various approval, equipment sharing, and time off request modules. It involves renaming properties (e.g., from `createdByName` to `createdByUser`), updating interface definitions to allow partial inputs, and modularizing request approvals by segregating common properties. The changes also update route definitions, incorporate service-oriented patterns in command handlers, and add a new database migration to alter the RequestApproval entity table.

## Changes

| File(s) | Change Summary |
|---------|----------------|
| `apps/gauzy/src/app/pages/approvals/approvals.component.ts` | Removed `IApprovalsData` and `listApprovals`; renamed column property `createdByName` to `createdByUser` in smart table configuration. |
| `packages/contracts/src/lib/equipment-sharing.model.ts` | Updated `IEquipmentSharingUpdateInput` to extend `Partial<IEquipmentSharingCreateInput>` for optional property updates. |
| `packages/contracts/src/lib/request-approval.model.ts` | Refactored request approval interfaces by introducing new base interfaces (`IBaseRequestApprovalProperties`, `IRequestApprovalAssociations`) and updated property types/definitions. |
| `packages/core/src/lib/database/migrations/1741071424998-AlterRequestApprovalEntityTable.ts` | Added a migration file with `up` and `down` methods for PostgreSQL, MySQL, and SQLite to update columns by copying data and dropping deprecated fields. |
| *(Equipment Sharing Commands & Handlers)*<br>`packages/core/src/lib/equipment-sharing/commands/equipment-sharing.create.command.ts`<br>`packages/core/src/lib/equipment-sharing/commands/equipment-sharing.update.command.ts`<br>`packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.create.handler.ts`<br>`packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.status.handler.ts`<br>`packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.update.handler.ts` | Renamed constructor parameters (e.g., `entity` to `input`), replaced repository dependencies with service injections (`RequestApprovalService`), and streamlined logic for creating and updating equipment sharing records and associated request approvals. |
| *(Request Approval Entity & Service)*<br>`packages/core/src/lib/request-approval/request-approval.entity.ts`<br>`packages/core/src/lib/request-approval/request-approval.seed.ts`<br>`packages/core/src/lib/request-approval/request-approval.service.ts` | Updated property types (e.g., `string` → `ID`, `string` → `ApprovalPolicyTypesStringEnum`), made certain fields optional with validation decorators, and refined the logic for accessing the current user and mapping employee/team approvals. |
| *(Time Off Request Module)*<br>`packages/core/src/lib/time-off-request/commands/handlers/time-off.create.handler.ts`<br>`packages/core/src/lib/time-off-request/commands/handlers/time-off.update.handler.ts`<br>`packages/core/src/lib/time-off-request/commands/time-off.create.command.ts`<br>`packages/core/src/lib/time-off-request/commands/time-off.update.command.ts`<br>`packages/core/src/lib/time-off-request/time-off-request.controller.ts`<br>`packages/core/src/lib/time-off-request/time-off-request.entity.ts`<br>`packages/core/src/lib/time-off-request/time-off-request.service.ts`<br>`packages/core/src/lib/time-off-request/time-off-request.subscriber.ts` | Revised command parameter naming (e.g., from `timeOff` to `input`), updated route paths to include a leading slash, refactored service calls in command handlers, enhanced error handling simplification, and introduced a new subscriber method (`beforeEntityCreate`) to set the creator’s user ID before insertion. |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant Client as Client Command
    participant ESH as EquipmentSharingCreateHandler
    participant ES as EquipmentSharingService
    participant RA as RequestApprovalService

    Client->>ESH: Send EquipmentSharingCreateCommand (input)
    ESH->>ES: Create new equipment sharing record
    ES-->>ESH: Return equipment sharing data
    ESH->>RA: Create associated request approval record
    RA-->>ESH: Return approval data
    ESH-->>Client: Return combined response
```

```mermaid
sequenceDiagram
    participant Client as Client Command
    participant TCH as TimeOffCreateHandler
    participant TS as TimeOffRequestService
    participant RA as RequestApprovalService

    Client->>TCH: Send TimeOffCreateCommand (input)
    TCH->>TS: Create new time off request
    TS-->>TCH: Return time off request
    TCH->>RA: Create corresponding request approval record
    RA-->>TCH: Return approval confirmation
    TCH-->>Client: Return final response
```

## Possibly related PRs
- **ever-co/ever-gauzy#8831**: Involved renaming `createdByName` to `createdByUser` in the equipment sharing component, similar to the changes in this PR.

## Poem
> I'm a rabbit with a joyful hop,  
> Refactoring code that makes my heart pop.  
> Renamed and streamlined, the changes are neat,  
> With services and updates, my work is complete.  
> Hopping through migrations, approvals, and more –  
> My code garden blooms like never before!  
> 🐰💻

<!-- walkthrough_end -->
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpADK2VmgqyjcEj2wAbb5AokAI7Y0riQ4rjedJAARADaAGLwAB4AupAAgt40fADkNkEhiLgZ3Lz4EmjeuZAAohgR8tAqUTGQAO5oyIjYAszqNPRy4bCe2IiU/miwPmAU+AwA1iRhmPSo8EoN8ABm8NHDuKOQGE4CkwAcFwDMFxowx7YoyLD4xdH4WADi6gASvegwkdPDt8L58O14BgiJAAKo2AAyXDisFwuG4iA4AHosUR1DMBBomMwsSQpBQwExSeTiGhsAAvWRY7g+bxYq63VIAClR6MxOLxR16RJY1MolPwYopRDpjOZrPZNwuAEoNO5jkpEAwKPBuOJPvwdiNPE8oQxvNhNehGKMlt4kEDYNRjQoGjqBHh8HxUAFgvAAvQCApmNwojR7nBUAxbYt7cV0IhFsh2qNgXxga7cO7PXwnchQeD2tEM0w3fAPeJoZAiNhNiR7eRkGsOqnRunRvInVJICRkqHtORA8do5hSMhmGglOgMEOSP7IJULSR7hlaLR1PBPlVvLIADQoMKoDD4QYjZ0Zp4T+TnRjeN7RSFHfB4YNsBooI0lmNxw80ZhNgIThPdA1wCRAJloNUDAAOXwSBEG4URdngBhICUXBtG8JsBGfR1PBHaFpEgCcpyDDMYgKYJQlKcpFzadh1HkDCBCidBANout1iwDNNW1XV9QwCNjlBBhxkNF0njQMoSBcZAgxvA0yB6HUq2JUN4EwBhPEfWBM2zASeHmAgmCwqY0zPLB0MwqEY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ycDBIeV+M4/EYh1Pe5RjimDL+KDMOZTyHWs0bJdyrAAVd6HvcZyBEHwBJwXeFkM38aA2Pgj47YFOAA07PmclJwa+S6j800IEBgqYiX1CpcMjC3oARPfgnnA5KUSBG54QBEEKgQoMoESCr6DjxCMwjEGKagnMjI2K5EOD9UJVhYCuPUYX0vMIfTrzNq0scsM7BzbQtKGcLyt5wvCGKVCtSTMcVWhDrPytjgegX8DWAvJXDS+/bawqdYEmNJATEE0f3ATE0pFmp8lfGplmySALrNdQuQDNIv9dI4oE19RGNn1Sz+bT9MPSMo7KPwTSIndJbFHs8sG8jx1HqDygNEIKBChPQQE0poqodgBqgDDMhN3iL7dKBUA1ADqByhuoAwD+zoodQBX5NgRACmFvcWAjoAV+d+GoxfIJHP8hIAN8jrD7yH8gYAdgJQDQA6whgFvIGAH8loBbyAQBfIHyWgBfIdge8izC6wrMIEBHyR8luAGAa4GuAswtAEfIW4XKCJySALMKlzrganNvJRc64EfIdgR8jrC2chgCVylAT8lJySAIXJ2ABALMNoALgF8kfIBAH8hZy6wrqF+yiclHNwA0cszExz9gIsFoA1+FHH0AgAA=== -->

<!-- internal state end -->

---

<details>
<summary>📜 Recent review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between e5e53a61a434f46d0c4fde267e33fb5d804b9016 and 5f617938557370ee149823e5293002990d5062a8.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `packages/core/src/lib/equipment-sharing/commands/handlers/equipment-sharing.create.handler.ts` (2 hunks)

</details>

</details>
<!-- finishing_touch_checkbox_start -->

<details>
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Generate unit testing code for this file.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai generate unit testing code for this file.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and generate unit testing code.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->
author_association: CONTRIBUTOR
user: login: nx-cloud[bot]
created_at: 2025-03-04T08:38:56Z
body: 
View your [CI Pipeline Execution ↗](https://cloud.nx.app/cipes/67c6c9f122f362046c0acd1d?utm_source=pull-request&utm_medium=comment) for commit 5f617938557370ee149823e5293002990d5062a8.

| Command | Status | Duration | Result |
|---------|--------|----------:|--------|
| `nx run api:desktop-api` | ✅ Succeeded | 1m 17s | [View ↗](https://cloud.nx.app/runs/eQEJEIVEvz?utm_source=pull-request&utm_medium=comment) |
| `nx run gauzy:desktop-ui --base-href ./` | ✅ Succeeded | 3m 33s | [View ↗](https://cloud.nx.app/runs/1TOYavwwhg?utm_source=pull-request&utm_medium=comment) |
| `nx build api -c=production --prod` | ✅ Succeeded | 1m 14s | [View ↗](https://cloud.nx.app/runs/YMUFpXV9Sz?utm_source=pull-request&utm_medium=comment) |
| `nx build desktop-ui-lib --configuration=develop...` | ✅ Succeeded | 31s | [View ↗](https://cloud.nx.app/runs/6qDf5HlQVC?utm_source=pull-request&utm_medium=comment) |
| `nx build plugin-integration-wakatime` | ✅ Succeeded | <1s | [View ↗](https://cloud.nx.app/runs/S1zBGSGh17?utm_source=pull-request&utm_medium=comment) |
| `nx build desktop-lib` | ✅ Succeeded | <1s | [View ↗](https://cloud.nx.app/runs/xgL175En0t?utm_source=pull-request&utm_medium=comment) |
| `nx build desktop-window` | ✅ Succeeded | <1s | [View ↗](https://cloud.nx.app/runs/3x2aVvwsfV?utm_source=pull-request&utm_medium=comment) |
| `nx build desktop-core` | ✅ Succeeded | <1s | [View ↗](https://cloud.nx.app/runs/ns63LuBHxE?utm_source=pull-request&utm_medium=comment) |
| `Additional runs (53)` | ✅ Succeeded | ... | [View ↗](https://cloud.nx.app/cipes/67c6c9f122f362046c0acd1d?utm_source=pull-request&utm_medium=comment) |

---

☁️ [Nx Cloud](https://cloud.nx.app?utm_source=pull-request&utm_medium=comment) last updated this comment at `2025-03-04 09:51:45` UTC

<!-- NX_CLOUD_APP_COMMENT_END -->
author_association: NONE