Skip to content

Commit

Permalink
add request.userid from feTS
Browse files Browse the repository at this point in the history
  • Loading branch information
jhk482001 committed Jan 16, 2025
1 parent 6c89fb1 commit fe98705
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/adm/handlers/moderation/__fixtures__/awardBadge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ export default {

'/badges/doc/test-certification-001': {
name: 'Test Certification',
displayName: 'Test Certification',
description: 'A test certification badge',
link: 'https://badge.source.com',
icon: 'https://badge.source.com/icon.png',
borderImage: 'https://badge.source.com/border.png',
issuers: ['authorized-issuer@test.com', 'service-token-123'],
createdAt: '2020-01-01T00:00:00.000Z',
updatedAt: '2020-01-01T00:00:00.000Z',
Expand Down
17 changes: 12 additions & 5 deletions src/adm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'dotenv/config';
import { createServer } from 'node:http';
import { readFileSync } from 'node:fs';
import path from 'node:path';
import { createRouter, Response } from 'fets';
import { createRouter, Response, Request } from 'fets';
import { Type } from '@sinclair/typebox';

import { useAuditLog, useAuth } from './util';
Expand Down Expand Up @@ -50,7 +50,7 @@ const router = createRouter({
),
},
},
handler: async (request) =>
handler: async (request: Request) =>
Response.json(pingHandler(await request.json())),
})
.route({
Expand Down Expand Up @@ -81,7 +81,7 @@ const router = createRouter({
}),
},
},
handler: async (request) =>
handler: async (request: Request) =>
Response.json(await blockUser(await request.json())),
})
.route({
Expand Down Expand Up @@ -112,8 +112,15 @@ const router = createRouter({
}),
},
},
handler: async (request) =>
Response.json(await awardBadge(await request.json())),
handler: async (request: Request) => {
const body = await request.json();
return Response.json(
await awardBadge({
...body,
request, // Pass the entire request object from feTS

Check failure on line 120 in src/adm/index.ts

View workflow job for this annotation

GitHub Actions / install-and-test

Delete `·`
})
);
},
});

createServer(router).listen(process.env.ADM_PORT, () => {
Expand Down

0 comments on commit fe98705

Please sign in to comment.