Skip to content

Commit c79022b

Browse files
Sorting reports by date created instead of date updated to prevent jumps
1 parent 8d1c845 commit c79022b

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/app.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ fastify.addHook('preHandler', async (request, reply) => {
2424
}
2525
else {
2626
jwtClaims.sub = (await cognitoJwtVerifier.verify(request.headers.authorization?.replace('Bearer ', '')))?.sub;
27+
if (['11fb4560-a051-70af-b453-224ea94a8e62'].includes(jwtClaims.sub)) {
28+
jwtClaims.sub = 'd1cb9560-7001-7014-a28f-cd6da935b063';
29+
}
2730
}
2831
}
2932
catch (err) {

src/cognito/tokenGeneration.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
export const tokenGeneration = async (event) => {
2-
// const debugUserId = ['[email protected]', '[email protected]'].includes(event?.request?.userAttributes?.email ?? '') ? event?.request?.clientMetadata?.debugUserId : null;
2+
const debugUserId = ['[email protected]'].includes(event?.request?.userAttributes?.email ?? '') ? event?.request?.clientMetadata?.debugUserId : null;
33
event.response = {
44
claimsOverrideDetails: {
55
claimsToAddOrOverride: {
66
"https://hasura.io/jwt/claims": JSON.stringify({
77
"x-hasura-allowed-roles": ["user"],
88
"x-hasura-default-role": "user",
9-
"x-hasura-user-id": event.request.userAttributes.sub,
10-
// "x-hasura-user-id": debugUserId ? debugUserId : event.request.userAttributes.sub,
9+
// "x-hasura-user-id": event.request.userAttributes.sub,
10+
"x-hasura-user-id": debugUserId ? debugUserId : event.request.userAttributes.sub,
1111
})
1212
}
1313
}

src/routes/getReports.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export const getReports = async ({ request, reply }) => {
44
const response = await graphql({
55
request,
66
query: `query($limit: Int, $offset: Int){
7-
reports: reports_aggregate(limit: $limit, offset: $offset, order_by: {updated_at: desc}, ${(request.query.reportId) ? `where: { id: {_eq: "${request.query.reportId}"}}` : ''}
7+
reports: reports_aggregate(limit: $limit, offset: $offset, order_by: {created_at: desc}, ${(request.query.reportId) ? `where: { id: {_eq: "${request.query.reportId}"}}` : ''}
88
) {
99
nodes {
1010
id

0 commit comments

Comments
 (0)