Skip to content

Commit bee852d

Browse files
committed
feat: add user to start session form
1 parent 3a9e77f commit bee852d

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

apps/web/src/components/StartSessionForm/StartSessionForm.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { $SessionType } from '@opendatacapture/schemas/session';
99
import type { CreateSessionData } from '@opendatacapture/schemas/session';
1010
import { $SubjectIdentificationMethod } from '@opendatacapture/schemas/subject';
1111
import type { Sex, SubjectIdentificationMethod } from '@opendatacapture/schemas/subject';
12+
import type { User } from '@opendatacapture/schemas/user';
1213
import { encodeScopedSubjectId, generateSubjectHash } from '@opendatacapture/subject-utils';
1314
import type { Promisable } from 'type-fest';
1415
import { z } from 'zod/v4';
@@ -32,12 +33,19 @@ type StartSessionFormData = {
3233

3334
type StartSessionFormProps = {
3435
currentGroup: Group | null;
36+
currentUser: User | null;
3537
initialValues?: FormTypes.PartialNullableData<StartSessionFormData>;
3638
onSubmit: (data: CreateSessionData) => Promisable<void>;
3739
readOnly: boolean;
3840
};
3941

40-
export const StartSessionForm = ({ currentGroup, initialValues, readOnly, onSubmit }: StartSessionFormProps) => {
42+
export const StartSessionForm = ({
43+
currentGroup,
44+
currentUser,
45+
initialValues,
46+
readOnly,
47+
onSubmit
48+
}: StartSessionFormProps) => {
4149
const { resolvedLanguage, t } = useTranslation();
4250
return (
4351
<Form
@@ -244,6 +252,7 @@ export const StartSessionForm = ({ currentGroup, initialValues, readOnly, onSubm
244252
await onSubmit({
245253
date: sessionDate,
246254
groupId: currentGroup?.id ?? null,
255+
userId: currentUser?.id ?? null,
247256
type: sessionType,
248257
subjectData: {
249258
id: subjectId,

0 commit comments

Comments
 (0)