Skip to content

Commit f67c7cc

Browse files
CarsonFadam-soltech
andcommitted
Fix sorting on project status/step to be by index instead of alpha
Co-authored-by: adam-soltech <[email protected]>
1 parent 1b14316 commit f67c7cc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/components/project/dto/project.dto.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import { stripIndent } from 'common-tags';
44
import { DateTime } from 'luxon';
55
import { keys as keysOf } from 'ts-transformer-keys';
66
import { MergeExclusive } from 'type-fest';
7+
import { sortingForEnumIndex } from '~/core/database/query';
78
import { abstractType, e } from '~/core/edgedb';
89
import { RegisterResource } from '~/core/resources';
910
import {
1011
DateInterval,
1112
DateTimeField,
1213
DbLabel,
14+
DbSort,
1315
DbUnique,
1416
ID,
1517
IntersectionType,
@@ -44,7 +46,7 @@ import { Postable } from '../../post/dto';
4446
import { ProjectChangeRequest } from '../../project-change-request/dto';
4547
import { ProjectMember } from '../project-member/dto';
4648
import { ProjectStatus } from './project-status.enum';
47-
import { SecuredProjectStep } from './project-step.enum';
49+
import { ProjectStep, SecuredProjectStep } from './project-step.enum';
4850
import { ProjectType } from './project-type.enum';
4951

5052
type AnyProject = MergeExclusive<TranslationProject, InternshipProject>;
@@ -114,10 +116,12 @@ class Project extends Interfaces {
114116
middleware: [parentIdMiddleware],
115117
})
116118
@DbLabel('ProjectStep')
119+
@DbSort(sortingForEnumIndex(ProjectStep))
117120
readonly step: SecuredProjectStep;
118121

119122
@Field(() => ProjectStatus)
120123
@DbLabel('ProjectStatus')
124+
@DbSort(sortingForEnumIndex(ProjectStatus))
121125
readonly status: ProjectStatus;
122126

123127
readonly primaryLocation: Secured<ID | null>;

0 commit comments

Comments
 (0)