File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,15 +57,16 @@ const logActivityMiddleware = middleware(async (opts) => {
5757 if ( type !== undefined ) {
5858 // const rawInput = opts.getRawInput() as { id: number }
5959 const resultData = result . data as { id ?: string }
60- logger . verbose ( `Recording activity ${ opts . path } of type ${ type } ` )
6160 const subjectId = type === 'CREATE' ? resultData ?. id : '9999'
62- if ( ! subjectId ) throw new TRPCError ( { code : 'INTERNAL_SERVER_ERROR' , message : 'No subjectId found' } )
63- await logActivity ( {
64- subjectId,
65- subjectType : subject || 'NO_SUBJECT' ,
66- causerId : opts . ctx . authenticated ? opts . ctx . accountId : undefined ,
67- type,
68- } )
61+ if ( subjectId ) {
62+ logger . verbose ( `Recording activity ${ opts . path } of type ${ type } ` )
63+ await logActivity ( {
64+ subjectId,
65+ subjectType : subject || 'NO_SUBJECT' ,
66+ causerId : opts . ctx . authenticated ? opts . ctx . accountId : undefined ,
67+ type,
68+ } )
69+ }
6970 }
7071 }
7172
You can’t perform that action at this time.
0 commit comments