From 5df5bb4c41e1bc7e58c8f554819472eec397ed67 Mon Sep 17 00:00:00 2001 From: Vitalii Stefaniv Date: Fri, 27 Sep 2024 12:53:04 +0300 Subject: [PATCH 1/6] refactor: fixed inconsistent naming gf-557 --- apps/frontend/src/libs/hooks/hooks.ts | 2 +- .../libs/constants/constants.ts | 0 .../libs/constants/first-page.constant.ts | 0 .../libs/constants/page-increment.constant.ts | 0 .../use-infinite-scroll.hook.ts} | 0 apps/frontend/src/modules/projects/libs/constants/constants.ts | 2 +- 6 files changed, 2 insertions(+), 2 deletions(-) rename apps/frontend/src/libs/hooks/{use-infinity-scroll => use-infinite-scroll}/libs/constants/constants.ts (100%) rename apps/frontend/src/libs/hooks/{use-infinity-scroll => use-infinite-scroll}/libs/constants/first-page.constant.ts (100%) rename apps/frontend/src/libs/hooks/{use-infinity-scroll => use-infinite-scroll}/libs/constants/page-increment.constant.ts (100%) rename apps/frontend/src/libs/hooks/{use-infinity-scroll/use-infinity-scroll.hook.ts => use-infinite-scroll/use-infinite-scroll.hook.ts} (100%) diff --git a/apps/frontend/src/libs/hooks/hooks.ts b/apps/frontend/src/libs/hooks/hooks.ts index 115a05d5f..9aaa716b4 100644 --- a/apps/frontend/src/libs/hooks/hooks.ts +++ b/apps/frontend/src/libs/hooks/hooks.ts @@ -2,7 +2,7 @@ export { useAppDispatch } from "./use-app-dispatch/use-app-dispatch.hook.js"; export { useAppForm } from "./use-app-form/use-app-form.hook.js"; export { useAppSelector } from "./use-app-selector/use-app-selector.hook.js"; export { useHandleClickOutside } from "./use-handle-click-outside/use-handle-click-outside.hook.js"; -export { useInfiniteScroll } from "./use-infinity-scroll/use-infinity-scroll.hook.js"; +export { useInfiniteScroll } from "./use-infinite-scroll/use-infinite-scroll.hook.js"; export { useIntersectionObserver } from "./use-intersection-observer/use-intersection-observer.hook.js"; export { useModal } from "./use-modal-state/use-modal-state.hook.js"; export { usePagination } from "./use-pagination/use-pagination.hook.js"; diff --git a/apps/frontend/src/libs/hooks/use-infinity-scroll/libs/constants/constants.ts b/apps/frontend/src/libs/hooks/use-infinite-scroll/libs/constants/constants.ts similarity index 100% rename from apps/frontend/src/libs/hooks/use-infinity-scroll/libs/constants/constants.ts rename to apps/frontend/src/libs/hooks/use-infinite-scroll/libs/constants/constants.ts diff --git a/apps/frontend/src/libs/hooks/use-infinity-scroll/libs/constants/first-page.constant.ts b/apps/frontend/src/libs/hooks/use-infinite-scroll/libs/constants/first-page.constant.ts similarity index 100% rename from apps/frontend/src/libs/hooks/use-infinity-scroll/libs/constants/first-page.constant.ts rename to apps/frontend/src/libs/hooks/use-infinite-scroll/libs/constants/first-page.constant.ts diff --git a/apps/frontend/src/libs/hooks/use-infinity-scroll/libs/constants/page-increment.constant.ts b/apps/frontend/src/libs/hooks/use-infinite-scroll/libs/constants/page-increment.constant.ts similarity index 100% rename from apps/frontend/src/libs/hooks/use-infinity-scroll/libs/constants/page-increment.constant.ts rename to apps/frontend/src/libs/hooks/use-infinite-scroll/libs/constants/page-increment.constant.ts diff --git a/apps/frontend/src/libs/hooks/use-infinity-scroll/use-infinity-scroll.hook.ts b/apps/frontend/src/libs/hooks/use-infinite-scroll/use-infinite-scroll.hook.ts similarity index 100% rename from apps/frontend/src/libs/hooks/use-infinity-scroll/use-infinity-scroll.hook.ts rename to apps/frontend/src/libs/hooks/use-infinite-scroll/use-infinite-scroll.hook.ts diff --git a/apps/frontend/src/modules/projects/libs/constants/constants.ts b/apps/frontend/src/modules/projects/libs/constants/constants.ts index adf714b75..5ef18d4ed 100644 --- a/apps/frontend/src/modules/projects/libs/constants/constants.ts +++ b/apps/frontend/src/modules/projects/libs/constants/constants.ts @@ -1 +1 @@ -export { FIRST_PAGE } from "~/libs/hooks/use-infinity-scroll/libs/constants/constants.js"; +export { FIRST_PAGE } from "~/libs/hooks/use-infinite-scroll/libs/constants/constants.js"; From d34bd73acc4bbc391682890468df051cace1dbc2 Mon Sep 17 00:00:00 2001 From: Vitalii Stefaniv Date: Fri, 27 Sep 2024 13:01:17 +0300 Subject: [PATCH 2/6] fix: fixed incorrect spelling gf-557 --- .../src/modules/activity-logs/activity-log.controller.ts | 2 +- .../src/modules/contributors/contributor.controller.ts | 2 +- .../src/modules/project-api-keys/project-api-key.service.ts | 6 +++--- .../src/libs/components/breadcrumbs/breadcrumbs.tsx | 2 +- .../libs/components/{componenets.ts => components.ts} | 0 5 files changed, 6 insertions(+), 6 deletions(-) rename apps/frontend/src/libs/components/breadcrumbs/libs/components/{componenets.ts => components.ts} (100%) diff --git a/apps/backend/src/modules/activity-logs/activity-log.controller.ts b/apps/backend/src/modules/activity-logs/activity-log.controller.ts index 76ccf43ed..d88bc2e93 100644 --- a/apps/backend/src/modules/activity-logs/activity-log.controller.ts +++ b/apps/backend/src/modules/activity-logs/activity-log.controller.ts @@ -49,7 +49,7 @@ import { * gitEmailId: * type: number * minimum: 1 - * ptojectId : + * projectId : * type: number * minimum: 1 * createdAt: diff --git a/apps/backend/src/modules/contributors/contributor.controller.ts b/apps/backend/src/modules/contributors/contributor.controller.ts index db7815b53..6b4b59914 100644 --- a/apps/backend/src/modules/contributors/contributor.controller.ts +++ b/apps/backend/src/modules/contributors/contributor.controller.ts @@ -268,7 +268,7 @@ class ContributorController extends BaseController { * 404: * description: Contributor not found * 409: - * description: Attept to self-merge or merging failed + * description: Attempt to self-merge or merging failed */ private async merge( options: APIHandlerOptions<{ diff --git a/apps/backend/src/modules/project-api-keys/project-api-key.service.ts b/apps/backend/src/modules/project-api-keys/project-api-key.service.ts index ef29b2aff..ea59052be 100644 --- a/apps/backend/src/modules/project-api-keys/project-api-key.service.ts +++ b/apps/backend/src/modules/project-api-keys/project-api-key.service.ts @@ -142,14 +142,14 @@ class ProjectApiKeyService implements Service { public async findByProjectId( projectId: number, ): Promise { - const apiKeyEnitity = + const apiKeyEntity = await this.projectApiKeyRepository.findByProjectId(projectId); - if (!apiKeyEnitity) { + if (!apiKeyEntity) { return null; } - const apiKey = apiKeyEnitity.toObject(); + const apiKey = apiKeyEntity.toObject(); const decryptedApiKey = this.encryption.decrypt(apiKey.encryptedKey); return { diff --git a/apps/frontend/src/libs/components/breadcrumbs/breadcrumbs.tsx b/apps/frontend/src/libs/components/breadcrumbs/breadcrumbs.tsx index 65f9434c8..6c1bb0586 100644 --- a/apps/frontend/src/libs/components/breadcrumbs/breadcrumbs.tsx +++ b/apps/frontend/src/libs/components/breadcrumbs/breadcrumbs.tsx @@ -1,4 +1,4 @@ -import { BreadcrumbItem } from "./libs/components/componenets.js"; +import { BreadcrumbItem } from "./libs/components/components.js"; import { type BreadcrumbNavigationItem } from "./libs/types/types.js"; import styles from "./styles.module.css"; diff --git a/apps/frontend/src/libs/components/breadcrumbs/libs/components/componenets.ts b/apps/frontend/src/libs/components/breadcrumbs/libs/components/components.ts similarity index 100% rename from apps/frontend/src/libs/components/breadcrumbs/libs/components/componenets.ts rename to apps/frontend/src/libs/components/breadcrumbs/libs/components/components.ts From 15b37ac1bd7be7340f82e200f0b9d30f88b8d47a Mon Sep 17 00:00:00 2001 From: Vitalii Stefaniv Date: Fri, 27 Sep 2024 13:12:08 +0300 Subject: [PATCH 3/6] refactor: fixed inconsistent file structure gf-557 --- .../get-group-users-columns.helper.ts | 0 .../project-group-users-table/libs/helpers/helpers.ts | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename apps/frontend/src/pages/project-access-management/libs/components/project-group-users-table/libs/helpers/{ => get-group-users-columns}/get-group-users-columns.helper.ts (100%) diff --git a/apps/frontend/src/pages/project-access-management/libs/components/project-group-users-table/libs/helpers/get-group-users-columns.helper.ts b/apps/frontend/src/pages/project-access-management/libs/components/project-group-users-table/libs/helpers/get-group-users-columns/get-group-users-columns.helper.ts similarity index 100% rename from apps/frontend/src/pages/project-access-management/libs/components/project-group-users-table/libs/helpers/get-group-users-columns.helper.ts rename to apps/frontend/src/pages/project-access-management/libs/components/project-group-users-table/libs/helpers/get-group-users-columns/get-group-users-columns.helper.ts diff --git a/apps/frontend/src/pages/project-access-management/libs/components/project-group-users-table/libs/helpers/helpers.ts b/apps/frontend/src/pages/project-access-management/libs/components/project-group-users-table/libs/helpers/helpers.ts index 408691ca8..099b84153 100644 --- a/apps/frontend/src/pages/project-access-management/libs/components/project-group-users-table/libs/helpers/helpers.ts +++ b/apps/frontend/src/pages/project-access-management/libs/components/project-group-users-table/libs/helpers/helpers.ts @@ -1 +1 @@ -export { getGroupUsersColumns } from "./get-group-users-columns.helper.js"; +export { getGroupUsersColumns } from "./get-group-users-columns/get-group-users-columns.helper.js"; From f2d596346b78931a53b744bbe3ef399b594b82da Mon Sep 17 00:00:00 2001 From: Vitalii Stefaniv Date: Fri, 27 Sep 2024 13:31:10 +0300 Subject: [PATCH 4/6] refactor: fixed svg fillings to be consistent gf-557 --- apps/frontend/src/assets/images/icons/check.svg | 2 +- apps/frontend/src/assets/images/icons/clipboard.svg | 2 +- apps/frontend/src/assets/images/icons/cross.svg | 6 +++--- apps/frontend/src/assets/images/icons/ellipsis.svg | 2 +- apps/frontend/src/assets/images/icons/eye.svg | 2 +- apps/frontend/src/assets/images/icons/left-double-arrow.svg | 4 ++-- apps/frontend/src/assets/images/icons/merge.svg | 2 +- apps/frontend/src/assets/images/icons/notifications.svg | 2 +- apps/frontend/src/assets/images/icons/pencil.svg | 2 +- .../frontend/src/assets/images/icons/right-double-arrow.svg | 4 ++-- apps/frontend/src/assets/images/icons/search.svg | 4 ++-- apps/frontend/src/assets/images/icons/split.svg | 2 +- apps/frontend/src/assets/images/icons/striked-eye.svg | 2 +- apps/frontend/src/assets/images/icons/sync.svg | 2 +- apps/frontend/src/assets/images/icons/trash-bin.svg | 2 +- apps/frontend/src/assets/images/icons/warning.svg | 2 +- 16 files changed, 21 insertions(+), 21 deletions(-) diff --git a/apps/frontend/src/assets/images/icons/check.svg b/apps/frontend/src/assets/images/icons/check.svg index e678de3bd..377d2fe84 100644 --- a/apps/frontend/src/assets/images/icons/check.svg +++ b/apps/frontend/src/assets/images/icons/check.svg @@ -1,3 +1,3 @@ - + diff --git a/apps/frontend/src/assets/images/icons/clipboard.svg b/apps/frontend/src/assets/images/icons/clipboard.svg index f8f7f00b6..b3825c67b 100644 --- a/apps/frontend/src/assets/images/icons/clipboard.svg +++ b/apps/frontend/src/assets/images/icons/clipboard.svg @@ -1,3 +1,3 @@ - + diff --git a/apps/frontend/src/assets/images/icons/cross.svg b/apps/frontend/src/assets/images/icons/cross.svg index 3dfe65db0..364df9c37 100644 --- a/apps/frontend/src/assets/images/icons/cross.svg +++ b/apps/frontend/src/assets/images/icons/cross.svg @@ -1,10 +1,10 @@ - + - + - + diff --git a/apps/frontend/src/assets/images/icons/ellipsis.svg b/apps/frontend/src/assets/images/icons/ellipsis.svg index faa361c03..0c0587577 100644 --- a/apps/frontend/src/assets/images/icons/ellipsis.svg +++ b/apps/frontend/src/assets/images/icons/ellipsis.svg @@ -1,3 +1,3 @@ - + diff --git a/apps/frontend/src/assets/images/icons/eye.svg b/apps/frontend/src/assets/images/icons/eye.svg index 9e6bb6fe2..a257b973e 100644 --- a/apps/frontend/src/assets/images/icons/eye.svg +++ b/apps/frontend/src/assets/images/icons/eye.svg @@ -1,3 +1,3 @@ - + diff --git a/apps/frontend/src/assets/images/icons/left-double-arrow.svg b/apps/frontend/src/assets/images/icons/left-double-arrow.svg index 03bdaf950..5b43464f2 100644 --- a/apps/frontend/src/assets/images/icons/left-double-arrow.svg +++ b/apps/frontend/src/assets/images/icons/left-double-arrow.svg @@ -1,3 +1,3 @@ - - + + diff --git a/apps/frontend/src/assets/images/icons/merge.svg b/apps/frontend/src/assets/images/icons/merge.svg index 5972d95e5..6237085e6 100644 --- a/apps/frontend/src/assets/images/icons/merge.svg +++ b/apps/frontend/src/assets/images/icons/merge.svg @@ -1,3 +1,3 @@ - + diff --git a/apps/frontend/src/assets/images/icons/notifications.svg b/apps/frontend/src/assets/images/icons/notifications.svg index d93f1ae95..b6e7c12de 100644 --- a/apps/frontend/src/assets/images/icons/notifications.svg +++ b/apps/frontend/src/assets/images/icons/notifications.svg @@ -1,3 +1,3 @@ - + \ No newline at end of file diff --git a/apps/frontend/src/assets/images/icons/pencil.svg b/apps/frontend/src/assets/images/icons/pencil.svg index 932a0ed3d..2f28839ea 100644 --- a/apps/frontend/src/assets/images/icons/pencil.svg +++ b/apps/frontend/src/assets/images/icons/pencil.svg @@ -1,3 +1,3 @@ - + diff --git a/apps/frontend/src/assets/images/icons/right-double-arrow.svg b/apps/frontend/src/assets/images/icons/right-double-arrow.svg index 70fc7c063..a7b80af3d 100644 --- a/apps/frontend/src/assets/images/icons/right-double-arrow.svg +++ b/apps/frontend/src/assets/images/icons/right-double-arrow.svg @@ -1,3 +1,3 @@ - - + + diff --git a/apps/frontend/src/assets/images/icons/search.svg b/apps/frontend/src/assets/images/icons/search.svg index 72f1ee0a4..4d8d746ce 100644 --- a/apps/frontend/src/assets/images/icons/search.svg +++ b/apps/frontend/src/assets/images/icons/search.svg @@ -1,3 +1,3 @@ - - + + diff --git a/apps/frontend/src/assets/images/icons/split.svg b/apps/frontend/src/assets/images/icons/split.svg index 84f00bd8d..942387e1e 100644 --- a/apps/frontend/src/assets/images/icons/split.svg +++ b/apps/frontend/src/assets/images/icons/split.svg @@ -1,3 +1,3 @@ - + diff --git a/apps/frontend/src/assets/images/icons/striked-eye.svg b/apps/frontend/src/assets/images/icons/striked-eye.svg index 41b831d2e..a352c26fb 100644 --- a/apps/frontend/src/assets/images/icons/striked-eye.svg +++ b/apps/frontend/src/assets/images/icons/striked-eye.svg @@ -1,3 +1,3 @@ - + diff --git a/apps/frontend/src/assets/images/icons/sync.svg b/apps/frontend/src/assets/images/icons/sync.svg index 212bb4a76..fe9f5444b 100644 --- a/apps/frontend/src/assets/images/icons/sync.svg +++ b/apps/frontend/src/assets/images/icons/sync.svg @@ -1,3 +1,3 @@ - + \ No newline at end of file diff --git a/apps/frontend/src/assets/images/icons/trash-bin.svg b/apps/frontend/src/assets/images/icons/trash-bin.svg index 4094692ed..5245154ba 100644 --- a/apps/frontend/src/assets/images/icons/trash-bin.svg +++ b/apps/frontend/src/assets/images/icons/trash-bin.svg @@ -1,3 +1,3 @@ - + diff --git a/apps/frontend/src/assets/images/icons/warning.svg b/apps/frontend/src/assets/images/icons/warning.svg index 4e2e73946..e53486edc 100644 --- a/apps/frontend/src/assets/images/icons/warning.svg +++ b/apps/frontend/src/assets/images/icons/warning.svg @@ -1,3 +1,3 @@ - + From ef10a1b1742045a4f8703ac3e2180acbe2879985 Mon Sep 17 00:00:00 2001 From: Vitalii Stefaniv Date: Fri, 27 Sep 2024 13:57:07 +0300 Subject: [PATCH 5/6] refactor: changed objection queries to have consistent naming case gf-557 --- .../activity-logs/activity-log.repository.ts | 6 ++--- .../contributors/contributor.repository.ts | 26 +++++++------------ .../notifications/notification.repository.ts | 2 +- .../project-api-key.repository.ts | 2 +- .../modules/projects/project.repository.ts | 12 ++++----- .../src/modules/users/user.repository.ts | 18 ++++++------- 6 files changed, 29 insertions(+), 37 deletions(-) diff --git a/apps/backend/src/modules/activity-logs/activity-log.repository.ts b/apps/backend/src/modules/activity-logs/activity-log.repository.ts index ddda833ed..810901126 100644 --- a/apps/backend/src/modules/activity-logs/activity-log.repository.ts +++ b/apps/backend/src/modules/activity-logs/activity-log.repository.ts @@ -58,7 +58,7 @@ class ActivityLogRepository implements Repository { builder.select("id", "name", "hiddenAt"); }) .whereNull("gitEmail:contributor.hiddenAt") - .whereBetween("activity_logs.date", [startDate, endDate]) + .whereBetween("activityLogs.date", [startDate, endDate]) .orderBy("date"); if (contributorName) { @@ -69,9 +69,9 @@ class ActivityLogRepository implements Repository { permittedProjectIds && permittedProjectIds.length !== EMPTY_LENGTH; if (projectId) { - query.where("project_id", projectId); + query.where("projectId", projectId); } else if (hasPermissionedProjects) { - query.whereIn("project_id", permittedProjectIds); + query.whereIn("projectId", permittedProjectIds); } const activityLogs = await query.orderBy("date"); diff --git a/apps/backend/src/modules/contributors/contributor.repository.ts b/apps/backend/src/modules/contributors/contributor.repository.ts index 49d3ad5d4..d27f6679a 100644 --- a/apps/backend/src/modules/contributors/contributor.repository.ts +++ b/apps/backend/src/modules/contributors/contributor.repository.ts @@ -83,9 +83,9 @@ class ContributorRepository implements Repository { "MAX(CASE WHEN activity_logs.commits_number > 0 THEN activity_logs.date ELSE NULL END) AS last_activity_date", ), ) - .leftJoin("git_emails", "contributors.id", "git_emails.contributor_id") - .leftJoin("activity_logs", "git_emails.id", "activity_logs.git_email_id") - .leftJoin("projects", "activity_logs.project_id", "projects.id") + .leftJoin("gitEmails", "contributors.id", "gitEmails.contributorId") + .leftJoin("activityLogs", "gitEmails.id", "activityLogs.gitEmailId") + .leftJoin("projects", "activityLogs.projectId", "projects.id") .groupBy("contributors.id") .withGraphFetched("gitEmails"); @@ -174,13 +174,9 @@ class ContributorRepository implements Repository { "COALESCE(ARRAY_AGG(DISTINCT jsonb_build_object('id', projects.id, 'name', projects.name)) FILTER (WHERE projects.id IS NOT NULL), '{}') AS projects", ), ) - .leftJoin("git_emails", "contributors.id", "git_emails.contributor_id") - .leftJoin( - "activity_logs", - "git_emails.id", - "activity_logs.git_email_id", - ) - .leftJoin("projects", "activity_logs.project_id", "projects.id") + .leftJoin("gitEmails", "contributors.id", "gitEmails.contributorId") + .leftJoin("activityLogs", "gitEmails.id", "activityLogs.gitEmailId") + .leftJoin("projects", "activityLogs.projectId", "projects.id") .groupBy("contributors.id") .withGraphFetched("gitEmails") .modifyGraph("gitEmails", (builder) => { @@ -233,13 +229,9 @@ class ContributorRepository implements Repository { "COALESCE(ARRAY_AGG(DISTINCT jsonb_build_object('id', projects.id, 'name', projects.name)) FILTER (WHERE projects.id IS NOT NULL), '{}') AS projects", ), ) - .leftJoin("git_emails", "contributors.id", "git_emails.contributor_id") - .leftJoin( - "activity_logs", - "git_emails.id", - "activity_logs.git_email_id", - ) - .leftJoin("projects", "activity_logs.project_id", "projects.id") + .leftJoin("gitEmails", "contributors.id", "gitEmails.contributorId") + .leftJoin("activityLogs", "gitEmails.id", "activityLogs.gitEmailId") + .leftJoin("projects", "activityLogs.projectId", "projects.id") .groupBy("contributors.id") .withGraphFetched("gitEmails") .modifyGraph("gitEmails", (builder) => { diff --git a/apps/backend/src/modules/notifications/notification.repository.ts b/apps/backend/src/modules/notifications/notification.repository.ts index 41357346c..a8a3bd7d1 100644 --- a/apps/backend/src/modules/notifications/notification.repository.ts +++ b/apps/backend/src/modules/notifications/notification.repository.ts @@ -81,7 +81,7 @@ class NotificationRepository implements Repository { const { results, total } = await this.notificationModel .query() .where("receiverUserId", userId) - .orderBy("created_at", SortType.DESCENDING) + .orderBy("createdAt", SortType.DESCENDING) .page(page, pageSize) .execute(); diff --git a/apps/backend/src/modules/project-api-keys/project-api-key.repository.ts b/apps/backend/src/modules/project-api-keys/project-api-key.repository.ts index 1a11d674d..a44ae740b 100644 --- a/apps/backend/src/modules/project-api-keys/project-api-key.repository.ts +++ b/apps/backend/src/modules/project-api-keys/project-api-key.repository.ts @@ -34,7 +34,7 @@ class ProjectApiKeyRepository implements Repository { const deletedRowsCount = await this.projectApiKeyModel .query() .delete() - .where("project_id", projectId) + .where("projectId", projectId) .execute(); return Boolean(deletedRowsCount); diff --git a/apps/backend/src/modules/projects/project.repository.ts b/apps/backend/src/modules/projects/project.repository.ts index 830eeed0e..b67243e36 100644 --- a/apps/backend/src/modules/projects/project.repository.ts +++ b/apps/backend/src/modules/projects/project.repository.ts @@ -49,14 +49,14 @@ class ProjectRepository implements Repository { .query() .select( "projects.*", - "activity_logs.date as analyticsLastSyncedAt", + "activityLogs.date as analyticsLastSyncedAt", "users.name as analyticsLastSyncedByUser", ) .from("projects") - .leftJoin("activity_logs", "projects.id", "activity_logs.projectId") - .leftJoin("users", "activity_logs.createdByUserId", "users.id") + .leftJoin("activityLogs", "projects.id", "activityLogs.projectId") + .leftJoin("users", "activityLogs.createdByUserId", "users.id") .where("projects.id", id) - .orderBy("activity_logs.date", SortType.DESCENDING) + .orderBy("activityLogs.date", SortType.DESCENDING) .first(); return item ? ProjectEntity.initialize(item) : null; @@ -72,7 +72,7 @@ class ProjectRepository implements Repository { > { const query = this.projectModel .query() - .orderBy("created_at", SortType.DESCENDING); + .orderBy("createdAt", SortType.DESCENDING); if (name) { query.whereILike("name", `%${name}%`); @@ -102,7 +102,7 @@ class ProjectRepository implements Repository { } const projects = await query - .orderBy("created_at", SortType.DESCENDING) + .orderBy("createdAt", SortType.DESCENDING) .execute(); return projects.map((project) => ProjectEntity.initialize(project)); diff --git a/apps/backend/src/modules/users/user.repository.ts b/apps/backend/src/modules/users/user.repository.ts index 91cf844b2..0e849aeda 100644 --- a/apps/backend/src/modules/users/user.repository.ts +++ b/apps/backend/src/modules/users/user.repository.ts @@ -54,19 +54,19 @@ class UserRepository implements Repository { "[groups.permissions, projectGroups.[permissions, projects]]", ) .modifyGraph("groups", (builder) => { - builder.select("user_groups.id", "name"); + builder.select("userGroups.id", "name"); }) .modifyGraph("groups.permissions", (builder) => { builder.select("permissions.id", "name", "key"); }) .modifyGraph("projectGroups", (builder) => { - builder.select("project_groups.id", "name"); + builder.select("projectGroups.id", "name"); }) .modifyGraph("projectGroups.projects", (builder) => { builder.select("projects.id"); }) .modifyGraph("projectGroups.permissions", (builder) => { - builder.select("project_permissions.id", "name", "key"); + builder.select("projectPermissions.id", "name", "key"); }) .execute(); @@ -111,12 +111,12 @@ class UserRepository implements Repository { .relatedQuery("projectGroups") .joinRelated("permissions") .join( - "projects_to_project_groups", - "project_groups.id", - "projects_to_project_groups.project_group_id", + "projectsToProjectGroups", + "projectGroups.id", + "projectsToProjectGroups.projectGroupId", ) .whereIn("permissions.key", permissionKeys) - .where("projects_to_project_groups.project_id", projectId), + .where("projectsToProjectGroups.projectId", projectId), ) .whereNull("deletedAt") .execute(); @@ -153,14 +153,14 @@ class UserRepository implements Repository { .query() .findOne({ email }) .withGraphFetched("groups.permissions") - .modifyGraph("user_groups.id", (builder) => { + .modifyGraph("userGroups.id", (builder) => { builder.select("id", "name"); }) .modifyGraph("groups.permissions", (builder) => { builder.select("permissions.id", "name", "key"); }) .modifyGraph("projectGroups", (builder) => { - builder.select("project_groups.id", "name"); + builder.select("projectGroups.id", "name"); }); if (!hasDeleted) { From 997c977b40aff413d8368227968870b2a0bbce2e Mon Sep 17 00:00:00 2001 From: Vitalii Stefaniv Date: Fri, 27 Sep 2024 15:14:04 +0300 Subject: [PATCH 6/6] refactor: changed contributor order by keys to have consistent naming case gf-557 --- .../contributors/libs/enums/contributor-order-by-key.enum.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/shared/src/modules/contributors/libs/enums/contributor-order-by-key.enum.ts b/packages/shared/src/modules/contributors/libs/enums/contributor-order-by-key.enum.ts index 6b41b943d..24f71d4f2 100644 --- a/packages/shared/src/modules/contributors/libs/enums/contributor-order-by-key.enum.ts +++ b/packages/shared/src/modules/contributors/libs/enums/contributor-order-by-key.enum.ts @@ -1,6 +1,6 @@ const ContributorOrderByKey = { - CREATED_AT: "created_at", - LAST_ACTIVITY_DATE: "last_activity_date", + CREATED_AT: "createdAt", + LAST_ACTIVITY_DATE: "lastActivityDate", } as const; export { ContributorOrderByKey };