Skip to content

Commit

Permalink
refactor: inline push column
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew committed Sep 23, 2024
1 parent 70aab3a commit c17cb8f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions src/lib/features/project/project-read-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,9 @@ export class ProjectReadModel implements IProjectReadModel {
'MAX(events.created_at) AS last_updated',
),
'project_settings.project_mode',
'projects.archived_at',
] as (string | Raw<any>)[];

selectColumns.push(`${TABLE}.archived_at`);

let groupByColumns = ['projects.id', 'project_settings.project_mode'];

if (userId) {
Expand Down Expand Up @@ -193,10 +192,9 @@ export class ProjectReadModel implements IProjectReadModel {
'count(features.name) FILTER (WHERE features.archived_at is null and features.potentially_stale IS TRUE) AS potentially_stale_feature_count',
),
'project_stats.avg_time_to_prod_current_window',
'projects.archived_at',
] as (string | Raw<any>)[];

selectColumns.push(`${TABLE}.archived_at`);

const groupByColumns = [
'projects.id',
'project_stats.avg_time_to_prod_current_window',
Expand Down
6 changes: 2 additions & 4 deletions src/lib/features/project/project-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,9 @@ class ProjectStore implements IProjectStore {
'project_settings.default_stickiness',
'project_settings.project_mode',
'project_stats.avg_time_to_prod_current_window',
'projects.archived_at',
] as (string | Raw<any>)[];

selectColumns.push(`${TABLE}.archived_at`);

let groupByColumns = [
'projects.id',
'project_settings.default_stickiness',
Expand Down Expand Up @@ -241,8 +240,7 @@ class ProjectStore implements IProjectStore {
}

async get(id: string): Promise<IProject> {
let extraColumns: string[] = [];
extraColumns = ['archived_at'];
const extraColumns: string[] = ['archived_at'];

return this.db
.first([...COLUMNS, ...SETTINGS_COLUMNS, ...extraColumns])
Expand Down

0 comments on commit c17cb8f

Please sign in to comment.