a lot of things
This commit is contained in:
@@ -17,11 +17,29 @@ export default createRoute(
|
||||
|
||||
const schema = z.object({
|
||||
name: z.string().optional(),
|
||||
notes: z.string().nullable().optional(),
|
||||
fields: z
|
||||
.array(
|
||||
z.object({
|
||||
fieldId: z.string(),
|
||||
value: z.string(),
|
||||
}),
|
||||
)
|
||||
.optional(),
|
||||
});
|
||||
|
||||
const data = schema.parse(body);
|
||||
|
||||
await credential.update(data);
|
||||
if (data.fields) {
|
||||
await credential.validateAndUpdateFields(data.fields);
|
||||
}
|
||||
|
||||
if (data.name !== undefined || data.notes !== undefined) {
|
||||
await credential.update({
|
||||
...(data.name !== undefined && { name: data.name }),
|
||||
...(data.notes !== undefined && { notes: data.notes }),
|
||||
});
|
||||
}
|
||||
|
||||
const response = apiResponse.successful(
|
||||
"Credential Updated Successfully!",
|
||||
|
||||
Reference in New Issue
Block a user