File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -17,9 +17,7 @@ export default createTRPCRouter({
1717 } ) ,
1818 )
1919 . mutation ( async ( { input } ) => {
20- await DB . insert ( SCHEMA . TG . auditLog )
21- . values ( input )
22- . onConflictDoNothing ( ) ;
20+ await DB . insert ( SCHEMA . TG . auditLog ) . values ( input ) . onConflictDoNothing ( ) ;
2321 } ) ,
2422
2523 getById : publicProcedure
@@ -29,8 +27,14 @@ export default createTRPCRouter({
2927 } ) ,
3028 )
3129 . query ( async ( { input } ) => {
32- return await DB . select ( )
30+ const res = await DB . select ( )
3331 . from ( SCHEMA . TG . auditLog )
34- . where ( ( t ) => eq ( t . targetId , input . targetId ) ) ;
32+ . where ( ( t ) => eq ( t . targetId , input . targetId ) )
33+ . leftJoin (
34+ SCHEMA . TG . groups ,
35+ eq ( SCHEMA . TG . auditLog . groupId , SCHEMA . TG . groups . telegramId ) ,
36+ ) ;
37+
38+ return res . map ( ( e ) => ( { ...e . audit_log , groupTitle : e . groups ?. title } ) ) ;
3539 } ) ,
3640} ) ;
You can’t perform that action at this time.
0 commit comments