@@ -11,12 +11,14 @@ interface Query {
1111 expires ?: Date ;
1212 limit ?: number ;
1313 disabled ?: boolean ;
14+ ephemeral ?: boolean ;
15+ customize ?;
1416}
1517
1618export default async function registrationTokensQuery (
1719 db : PostgreSQL ,
1820 options : { delete ?: boolean } [ ] ,
19- query : Query
21+ query : Query ,
2022) {
2123 if ( isDelete ( options ) && query . token ) {
2224 // delete if option is set and there is a token which is defined and not an empty string
@@ -37,22 +39,27 @@ export default async function registrationTokensQuery(
3739 return rows ;
3840 } else if ( query . token ) {
3941 // upsert an existing one
40- const { token, descr, expires, limit, disabled } = query ;
42+ const { token, descr, expires, limit, disabled, ephemeral, customize } =
43+ query ;
4144 const { rows } = await callback2 ( db . _query , {
42- query : `INSERT INTO registration_tokens ("token","descr","expires","limit","disabled")
43- VALUES ($1, $2, $3, $4, $5) ON CONFLICT (token)
45+ query : `INSERT INTO registration_tokens ("token","descr","expires","limit","disabled","ephemeral","customize" )
46+ VALUES ($1, $2, $3, $4, $5, $6, $7 ) ON CONFLICT (token)
4447 DO UPDATE SET
4548 "token" = EXCLUDED.token,
4649 "descr" = EXCLUDED.descr,
4750 "expires" = EXCLUDED.expires,
4851 "limit" = EXCLUDED.limit,
49- "disabled" = EXCLUDED.disabled` ,
52+ "disabled" = EXCLUDED.disabled,
53+ "ephemeral" = EXCLUDED.ephemeral,
54+ "customize" = EXCLUDED.customize` ,
5055 params : [
5156 token ,
5257 descr ? descr : null ,
5358 expires ? expires : null ,
5459 limit == null ? null : limit , // if undefined make it null
5560 disabled != null ? disabled : false ,
61+ ephemeral == null ? null : ephemeral ,
62+ customize == null ? null : customize ,
5663 ] ,
5764 } ) ;
5865 return rows ;
0 commit comments