feature: start to lay groundwork for reactions
This commit is contained in:
parent
10b3e9ff72
commit
6500d9a9be
4 changed files with 56 additions and 5 deletions
|
|
@ -8,6 +8,7 @@ import { INVITE_CODE, INVITE_CODES, VALIDATE_INVITE_CODE } from '../../../../../
|
|||
export const PRECHECKS: PRECHECK_TABLE = {};
|
||||
|
||||
const INVITE_CODES_ALLOWED_PER_MINUTE = parseInt(Deno.env.get('INVITE_CODES_ALLOWED_PER_MINUTE') ?? '3', 10);
|
||||
const DEFAULT_INVITE_EXPIRE_TIME: number = 28 * 24 * 60 * 60 * 1_000; // 28 days max invite length
|
||||
|
||||
// GET /api/users/:user_id/invites - get invites this user has created
|
||||
// query parameters:
|
||||
|
|
@ -94,6 +95,8 @@ export async function POST(req: Request, meta: Record<string, any>): Promise<Res
|
|||
invite_code.code = `${full_lurid.substring(0, 14).replace(/-/g, ' ')}${full_lurid.substring(39).replace(/-/g, ' ')}`;
|
||||
}
|
||||
|
||||
invite_code.timestamps.expires = invite_code.timestamps.expires ?? new Date(new Date(now).valueOf() + DEFAULT_INVITE_EXPIRE_TIME).toISOString();
|
||||
|
||||
const errors = VALIDATE_INVITE_CODE(invite_code);
|
||||
if (errors) {
|
||||
return Response.json({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue