handle remove logo
This commit is contained in:
1 parent
f10f7385b0
commit
90fd9930db
3 files changed
+9
-4
No files matched your search
@@ -105,14 +105,16 @@ class MongoStatusPagesRepository implements IStatusPagesRepository {
|
||||
return this.mapDocuments(statusPages);
|
||||
};
|
||||
|
||||
updateById = async (id: string, teamId: string, image: Express.Multer.File | undefined, patch: Partial<StatusPage>): Promise<StatusPage> => {
|
||||
const { logo: _logo, ...restPatch } = patch;
|
||||
updateById = async (id: string, teamId: string, image: Express.Multer.File | undefined, patch: Partial<StatusPage> & { removeLogo?: string }): Promise<StatusPage> => {
|
||||
const { logo: _logo, removeLogo, ...restPatch } = patch;
|
||||
const updateData: StatusPageUpdateData = { ...restPatch };
|
||||
if (image) {
|
||||
updateData.logo = {
|
||||
data: image.buffer as Buffer,
|
||||
contentType: image.mimetype,
|
||||
};
|
||||
} else if (removeLogo === "true") {
|
||||
updateData.logo = null;
|
||||
}
|
||||
|
||||
const statusPage = await StatusPageModel.findOneAndUpdate({ teamId, _id: id }, updateData, {
|
||||
|
||||
Reference in new issue
Block a user