Skip to content

Commit 5d9048f

Browse files
committed
feat: find user in session finding query, add user column to export record
1 parent cc5a445 commit 5d9048f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

apps/api/src/instrument-records/instrument-records.service.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ export class InstrumentRecordsService {
139139
select: {
140140
date: true,
141141
id: true,
142-
type: true
142+
type: true,
143+
user: true
143144
}
144145
},
145146
subject: true
@@ -174,6 +175,7 @@ export class InstrumentRecordsService {
174175
if (!Array.isArray(measureValue)) {
175176
data.push({
176177
groupId: record.subject.groupIds[0] ?? DEFAULT_GROUP_NAME,
178+
userId: record.session.user?.username ?? 'N/A',
177179
instrumentEdition: instrument.internal.edition,
178180
instrumentName: instrument.internal.name,
179181
measure: measureKey,
@@ -197,6 +199,7 @@ export class InstrumentRecordsService {
197199
throw new Error(`exportRecords: ${instrument.internal.name}.${measureKey}${arrayEntry.message}`);
198200
data.push({
199201
groupId: record.subject.groupIds[0] ?? DEFAULT_GROUP_NAME,
202+
userId: record.session.user?.username ?? 'N/A',
200203
instrumentEdition: instrument.internal.edition,
201204
instrumentName: instrument.internal.name,
202205
measure: `${measureKey} - ${arrayEntry.measure}`,

0 commit comments

Comments
 (0)