@@ -52,6 +52,11 @@ async function storeRawReport(ctx: PipelineCtx, reportType: string, sourceUrl: s
5252 ctx . result . rawStored ++ ;
5353}
5454
55+ function toTimestamp ( db : DbClient , value : string | null | undefined ) : Date | string | null {
56+ if ( ! value ) return null ;
57+ return db . isSqlite ? value : new Date ( value ) ;
58+ }
59+
5560async function upsertUsers ( ctx : PipelineCtx , userRows : Array < {
5661 githubLogin : string ; enterprise : string ; org : string ;
5762 displayName ?: string | null ; email ?: string | null ; team ?: string | null ;
@@ -60,7 +65,12 @@ async function upsertUsers(ctx: PipelineCtx, userRows: Array<{
6065} > ) {
6166 if ( userRows . length === 0 ) return ;
6267 const t = dialectTable ( ctx . db , usersPg , usersSq ) ;
63- await ctx . r . insert ( t ) . values ( userRows )
68+ const values = userRows . map ( row => ( {
69+ ...row ,
70+ seatCreatedAt : toTimestamp ( ctx . db , row . seatCreatedAt ) ,
71+ lastActivityAt : toTimestamp ( ctx . db , row . lastActivityAt ) ,
72+ } ) ) ;
73+ await ctx . r . insert ( t ) . values ( values )
6474 . onConflictDoUpdate ( {
6575 target : t . githubLogin ,
6676 set : {
@@ -83,7 +93,12 @@ async function upsertSeatUsers(ctx: PipelineCtx, seatRows: Array<{
8393} > ) {
8494 if ( seatRows . length === 0 ) return ;
8595 const t = dialectTable ( ctx . db , usersPg , usersSq ) ;
86- await ctx . r . insert ( t ) . values ( seatRows )
96+ const values = seatRows . map ( row => ( {
97+ ...row ,
98+ seatCreatedAt : toTimestamp ( ctx . db , row . seatCreatedAt ) ,
99+ lastActivityAt : toTimestamp ( ctx . db , row . lastActivityAt ) ,
100+ } ) ) ;
101+ await ctx . r . insert ( t ) . values ( values )
87102 . onConflictDoUpdate ( {
88103 target : t . githubLogin ,
89104 set : {
0 commit comments