feat: update label

This commit is contained in:
Henry
2024-08-27 23:34:52 +01:00
parent 2adcac85a4
commit 583256a46b
6 changed files with 145 additions and 38 deletions

View File

@@ -52,10 +52,29 @@ export const getByPublicId = async (
) => {
const { data } = await db
.from("label")
.select(`id`)
.select(`id, publicId, name, colourCode`)
.eq("publicId", labelPublicId)
.limit(1)
.single();
return data;
};
export const update = async (
db: SupabaseClient<Database>,
labelInput: {
publicId: string;
name: string;
colourCode: string;
},
) => {
const { data } = await db
.from("label")
.update({
name: labelInput.name,
colourCode: labelInput.colourCode,
})
.eq("publicId", labelInput.publicId);
return data;
};