Skip to content

Commit

Permalink
feat: Makes endpoint templates sortable
Browse files Browse the repository at this point in the history
  • Loading branch information
cyaiox committed Jun 29, 2023
1 parent 58769a9 commit a2677c0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/Project/Project.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,13 @@ export const searchableProjectProperties: (keyof ProjectAttributes)[] = [
'is_template',
'template_status',
]

export const sortableTemplateProperties = {
sort: {
by: [
'template_status',
'created_at',
'updated_at',
] as (keyof ProjectAttributes)[],
},
}
10 changes: 8 additions & 2 deletions src/Project/SearchableProject.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { String } from 'aws-sdk/clients/codebuild'
import { Request } from 'express'
import { ProjectAttributes, Project, searchableProjectProperties } from '.'
import {
ProjectAttributes,
Project,
searchableProjectProperties,
sortableTemplateProperties,
} from '.'
import { AuthRequest } from '../middleware'
import { RequestParameters } from '../RequestParameters'
import {
Expand Down Expand Up @@ -36,7 +41,8 @@ export class SearchableProject {
Project.tableName
)
const parameters = new SearchableParameters<ProjectAttributes>(
requestParameters
requestParameters,
sortableTemplateProperties
)
const conditions = new SearchableConditions<ProjectAttributes>(
requestParameters,
Expand Down

0 comments on commit a2677c0

Please sign in to comment.