Skip to content

Commit 5305924

Browse files
committed
Fix PromptVariantResponse.responses.creator fallback on the current user
But I'm not sure that this is what we should be doing.
1 parent 8c8a874 commit 5305924

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/components/prompts/prompt-variant-response.service.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
type PromptVariantResponse,
3131
type PromptVariantResponseList,
3232
type UpdatePromptVariantResponse,
33+
type VariantResponse,
3334
} from './dto';
3435
import { type PromptVariantResponseRepository } from './prompt-variant-response.repository';
3536

@@ -244,12 +245,13 @@ export const PromptVariantResponseListService = <
244245
responses: this.resource.Variants.map(({ key }) => ({
245246
...responses.get(key),
246247
...(variant.key === key
247-
? {
248+
? ({
248249
variant: key,
249250
response: input.response,
250-
creator: responses.get(key)?.creator ?? session.userId,
251+
// TODO I'm not sure it's right to fallback to the current user...?
252+
creator: responses.get(key)?.creator ?? { id: session.userId },
251253
modifiedAt: DateTime.now(),
252-
}
254+
} satisfies UnsecuredDto<VariantResponse>)
253255
: {}),
254256
})),
255257
};

0 commit comments

Comments
 (0)