Skip to content

Commit

Permalink
added order param and removed sort param
Browse files Browse the repository at this point in the history
  • Loading branch information
anudeeps352 committed Jul 27, 2024
1 parent b906512 commit f054806
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions apps/api/src/secret/controller/secret.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,15 @@ export class SecretController {
@Param('environmentId') environmentId: string,
@Query('page') page: number = 0,
@Query('limit') limit: number = 10,
@Query('sort') sort: string = 'version'
@Query('order') order: string = 'desc'
) {
return await this.secretService.getRevisionsOfSecret(
user,
secretId,
environmentId,
page,
limit,
sort
order
)
}
}
6 changes: 4 additions & 2 deletions apps/api/src/secret/service/secret.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,10 @@ export class SecretService {
environmentId: Environment['id'],
page: number,
limit: number,
sort: string
order: string
) {
// assign order to variable dynamically
const sortOrder = order === 'asc' ? 'asc' : 'desc'
//check access to secret
await this.authorityCheckerService.checkAuthorityOverSecret({
userId: user.id,
Expand All @@ -523,7 +525,7 @@ export class SecretService {
skip: page * limit,
take: limit,
orderBy: {
[sort]: sort
version: sortOrder
}
})
return revisions
Expand Down

0 comments on commit f054806

Please sign in to comment.