@@ -339,7 +339,7 @@ export const apikeysRouter = createTRPCRouter({
339339 create : protectedProcedure
340340 . input ( createApiKeySchema )
341341 . mutation ( async ( { ctx, input } ) => {
342- const nowIso = new Date ( ) . toISOString ( ) ;
342+ const nowIso = new Date ( ) ;
343343 const { secret, prefix, start } = generateKeyMaterial ( ) ;
344344 const keyHash = hashSecretScrypt ( secret ) ;
345345
@@ -435,7 +435,7 @@ export const apikeysRouter = createTRPCRouter({
435435 ? key . expiresAt
436436 : ( input . expiresAt as string | null ) ,
437437 metadata : input . metadata ?? key . metadata ,
438- updatedAt : new Date ( ) . toISOString ( ) ,
438+ updatedAt : new Date ( ) ,
439439 } )
440440 . where ( eq ( apikey . id , input . id ) )
441441 . returning ( ) ;
@@ -475,8 +475,8 @@ export const apikeysRouter = createTRPCRouter({
475475 . update ( apikey )
476476 . set ( {
477477 enabled : false ,
478- revokedAt : new Date ( ) . toISOString ( ) ,
479- updatedAt : new Date ( ) . toISOString ( ) ,
478+ revokedAt : new Date ( ) ,
479+ updatedAt : new Date ( ) ,
480480 } )
481481 . where ( eq ( apikey . id , input . id ) ) ;
482482 return { success : true } ;
@@ -519,7 +519,7 @@ export const apikeysRouter = createTRPCRouter({
519519 start,
520520 key : secret ,
521521 keyHash,
522- updatedAt : new Date ( ) . toISOString ( ) ,
522+ updatedAt : new Date ( ) ,
523523 } )
524524 . where ( eq ( apikey . id , input . id ) )
525525 . returning ( ) ;
@@ -562,16 +562,16 @@ export const apikeysRouter = createTRPCRouter({
562562 . delete ( apikeyAccess )
563563 . where ( eq ( apikeyAccess . apikeyId , input . apikeyId ) ) ;
564564 if ( input . access . length > 0 ) {
565- const nowIso = new Date ( ) . toISOString ( ) ;
565+ const now = new Date ( ) ;
566566 const rows : InferInsertModel < typeof apikeyAccess > [ ] =
567567 input . access . map ( ( a ) => ( {
568568 id : nanoid ( ) ,
569569 apikeyId : input . apikeyId ,
570570 resourceType : a . resourceType ,
571571 resourceId : a . resourceId ?? null ,
572572 scopes : a . scopes ,
573- createdAt : nowIso ,
574- updatedAt : nowIso ,
573+ createdAt : now ,
574+ updatedAt : now ,
575575 } ) ) ;
576576 await tx . insert ( apikeyAccess ) . values ( rows ) ;
577577 }
@@ -598,7 +598,7 @@ export const apikeysRouter = createTRPCRouter({
598598 try {
599599 const key = await fetchKeyOrThrow ( ctx , input . apikeyId ) ;
600600 await assertCanManageKey ( ctx , key ) ;
601- const nowIso = new Date ( ) . toISOString ( ) ;
601+ const now = new Date ( ) ;
602602 const [ row ] = await ctx . db
603603 . insert ( apikeyAccess )
604604 . values ( {
@@ -607,16 +607,16 @@ export const apikeysRouter = createTRPCRouter({
607607 resourceType : input . resourceType ,
608608 resourceId : input . resourceId ?? null ,
609609 scopes : input . scopes ,
610- createdAt : nowIso ,
611- updatedAt : nowIso ,
610+ createdAt : now ,
611+ updatedAt : now ,
612612 } )
613613 . onConflictDoUpdate ( {
614614 target : [
615615 apikeyAccess . apikeyId ,
616616 apikeyAccess . resourceType ,
617617 apikeyAccess . resourceId ,
618618 ] ,
619- set : { scopes : input . scopes , updatedAt : nowIso } ,
619+ set : { scopes : input . scopes , updatedAt : now } ,
620620 } )
621621 . returning ( ) ;
622622 return row ;
0 commit comments