Skip to content

Commit f56e0f3

Browse files
committed
feat: add session id to instrument record, add get session api call
1 parent 5d9048f commit f56e0f3

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

apps/api/src/sessions/sessions.controller.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { RouteAccess } from '@douglasneuroinformatics/libnest';
2-
import { Body, Controller, Post } from '@nestjs/common';
2+
import { Body, Controller, Get, Post } from '@nestjs/common';
33
import { ApiOperation } from '@nestjs/swagger';
44
import type { Session } from '@prisma/client';
55

@@ -16,4 +16,11 @@ export class SessionsController {
1616
create(@Body() data: CreateSessionDto): Promise<Session> {
1717
return this.sessionsService.create(data);
1818
}
19+
20+
@ApiOperation({ description: 'Find Session by ID' })
21+
@Get()
22+
@RouteAccess({ action: 'read', subject: 'Session' })
23+
findByID(id: string): Promise<Session> {
24+
return this.sessionsService.findById(id);
25+
}
1926
}

packages/schemas/src/instrument-records/instrument-records.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { z } from 'zod/v4';
33

44
import { $BaseModel, $Json } from '../core/core.js';
55
import { $InstrumentMeasureValue } from '../instrument/instrument.js';
6-
76
import type { SessionType } from '../session/session.js';
87

98
export const $CreateInstrumentRecordData = z.object({
@@ -39,7 +38,8 @@ export const $InstrumentRecord = $BaseModel.extend({
3938
date: z.coerce.date(),
4039
groupId: z.string().nullish(),
4140
instrumentId: z.string(),
42-
subjectId: z.string()
41+
subjectId: z.string(),
42+
sessionId: z.string()
4343
});
4444

4545
export type InstrumentRecord = z.infer<typeof $InstrumentRecord>;

0 commit comments

Comments
 (0)