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:
@@ -19,7 +19,7 @@ export const logger = pino({
|
|||||||
targets: [
|
targets: [
|
||||||
{
|
{
|
||||||
target: "pino-pretty",
|
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",
|
level: "info",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -320,6 +320,7 @@ export function issueRoutes(db: Db, storage: StorageService) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
assertCompanyAccess(req, existing.companyId);
|
assertCompanyAccess(req, existing.companyId);
|
||||||
|
const attachments = await svc.listAttachments(id);
|
||||||
|
|
||||||
const issue = await svc.remove(id);
|
const issue = await svc.remove(id);
|
||||||
if (!issue) {
|
if (!issue) {
|
||||||
@@ -327,6 +328,14 @@ export function issueRoutes(db: Db, storage: StorageService) {
|
|||||||
return;
|
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);
|
const actor = getActorInfo(req);
|
||||||
await logActivity(db, {
|
await logActivity(db, {
|
||||||
companyId: issue.companyId,
|
companyId: issue.companyId,
|
||||||
|
|||||||
Reference in New Issue
Block a user