Clean up attachment objects on issue delete and suppress responseTime in logs
Delete storage objects for each attachment when an issue is removed. Hide responseTime from pino-pretty console output to reduce noise. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ad748349cb
commit
a22af8f72f
2 changed files with 10 additions and 1 deletions
|
|
@ -19,7 +19,7 @@ export const logger = pino({
|
|||
targets: [
|
||||
{
|
||||
target: "pino-pretty",
|
||||
options: { ...sharedOpts, ignore: "pid,hostname,req,res", colorize: true, destination: 1 },
|
||||
options: { ...sharedOpts, ignore: "pid,hostname,req,res,responseTime", colorize: true, destination: 1 },
|
||||
level: "info",
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -320,6 +320,7 @@ export function issueRoutes(db: Db, storage: StorageService) {
|
|||
return;
|
||||
}
|
||||
assertCompanyAccess(req, existing.companyId);
|
||||
const attachments = await svc.listAttachments(id);
|
||||
|
||||
const issue = await svc.remove(id);
|
||||
if (!issue) {
|
||||
|
|
@ -327,6 +328,14 @@ export function issueRoutes(db: Db, storage: StorageService) {
|
|||
return;
|
||||
}
|
||||
|
||||
for (const attachment of attachments) {
|
||||
try {
|
||||
await storage.deleteObject(attachment.companyId, attachment.objectKey);
|
||||
} catch (err) {
|
||||
logger.warn({ err, issueId: id, attachmentId: attachment.id }, "failed to delete attachment object during issue delete");
|
||||
}
|
||||
}
|
||||
|
||||
const actor = getActorInfo(req);
|
||||
await logActivity(db, {
|
||||
companyId: issue.companyId,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue