feat(contents): add updateAdmin method to contents service
- Introduced `updateAdmin` logic to handle admin-specific content updates. - Included cache clearing upon successful update for data consistency.
This commit is contained in:
@@ -184,6 +184,16 @@ export class ContentsService {
|
|||||||
return deleted;
|
return deleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async updateAdmin(id: string, data: any) {
|
||||||
|
this.logger.log(`Updating content ${id} by admin`);
|
||||||
|
const updated = await this.contentsRepository.update(id, data);
|
||||||
|
|
||||||
|
if (updated) {
|
||||||
|
await this.clearContentsCache();
|
||||||
|
}
|
||||||
|
return updated;
|
||||||
|
}
|
||||||
|
|
||||||
async findOne(idOrSlug: string, userId?: string) {
|
async findOne(idOrSlug: string, userId?: string) {
|
||||||
const content = await this.contentsRepository.findOne(idOrSlug, userId);
|
const content = await this.contentsRepository.findOne(idOrSlug, userId);
|
||||||
if (!content) return null;
|
if (!content) return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user