feat(server): create a person with optional values (#7706)

* feat: create person dto

* chore: open api

* fix: e2e

* fix: web usage
This commit is contained in:
Jason Rasmussen
2024-03-07 15:34:57 -05:00
committed by GitHub
parent f1a8e385e9
commit 661409bac7
20 changed files with 372 additions and 148 deletions
+29
View File
@@ -4047,6 +4047,16 @@
"post": {
"operationId": "createPerson",
"parameters": [],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PersonCreateDto"
}
}
},
"required": true
},
"responses": {
"201": {
"content": {
@@ -8720,6 +8730,25 @@
],
"type": "object"
},
"PersonCreateDto": {
"properties": {
"birthDate": {
"description": "Person date of birth.\nNote: the mobile app cannot currently set the birth date to null.",
"format": "date",
"nullable": true,
"type": "string"
},
"isHidden": {
"description": "Person visibility",
"type": "boolean"
},
"name": {
"description": "Person name.",
"type": "string"
}
},
"type": "object"
},
"PersonResponseDto": {
"properties": {
"birthDate": {
+16 -4
View File
@@ -529,6 +529,15 @@ export type PeopleResponseDto = {
people: PersonResponseDto[];
total: number;
};
export type PersonCreateDto = {
/** Person date of birth.
Note: the mobile app cannot currently set the birth date to null. */
birthDate?: string | null;
/** Person visibility */
isHidden?: boolean;
/** Person name. */
name?: string;
};
export type PeopleUpdateItem = {
/** Person date of birth.
Note: the mobile app cannot currently set the birth date to null. */
@@ -2051,14 +2060,17 @@ export function getAllPeople({ withHidden }: {
...opts
}));
}
export function createPerson(opts?: Oazapfts.RequestOpts) {
export function createPerson({ personCreateDto }: {
personCreateDto: PersonCreateDto;
}, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{
status: 201;
data: PersonResponseDto;
}>("/person", {
}>("/person", oazapfts.json({
...opts,
method: "POST"
}));
method: "POST",
body: personCreateDto
})));
}
export function updatePeople({ peopleUpdateDto }: {
peopleUpdateDto: PeopleUpdateDto;