fix(server): require at least one field to be set when updating memory (#27842)

* add zod util to require one field is set in some schemas. appy to update memory endpoint

* add test
This commit is contained in:
Freddie Floydd
2026-04-17 21:18:48 +01:00
committed by GitHub
parent 9d33853544
commit 6798d5df32
3 changed files with 28 additions and 8 deletions
@@ -96,6 +96,12 @@ describe(MemoryController.name, () => {
expect(status).toBe(400);
expect(body).toEqual(errorDto.badRequest(['Invalid input: expected object, received undefined']));
});
it('should require at least one field', async () => {
const { status, body } = await request(ctx.getHttpServer()).put(`/memories/${factory.uuid()}`).send({});
expect(status).toBe(400);
expect(body).toEqual(errorDto.badRequest(['At least one field must be provided']));
});
});
describe('DELETE /memories/:id', () => {