Skip to content

Commit

Permalink
chore(tripsit): shorten ticket lifecycle to 3 days to close, 3 more t…
Browse files Browse the repository at this point in the history
…o delete
  • Loading branch information
theimperious1 committed Nov 14, 2024
1 parent a93e1b4 commit e31a44a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/discord/commands/global/d.tripsitmode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,10 @@ async function tripsitmodeOn(
status: 'OPEN' as ticket_status,
reopened_at: new Date(),
archived_at: env.NODE_ENV === 'production'
? DateTime.local().plus({ days: 7 }).toJSDate()
? DateTime.local().plus({ days: 3 }).toJSDate()
: DateTime.local().plus({ minutes: 1 }).toJSDate(),
deleted_at: env.NODE_ENV === 'production'
? DateTime.local().plus({ days: 14 }).toJSDate()
? DateTime.local().plus({ days: 6 }).toJSDate()
: DateTime.local().plus({ minutes: 2 }).toJSDate(),
},
});
Expand Down
16 changes: 8 additions & 8 deletions src/discord/utils/tripsitme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -800,11 +800,11 @@ export async function tripsitmeTeamClose(
// Update the ticket status to resolved
ticketData.status = 'RESOLVED' as ticket_status;
ticketData.archived_at = env.NODE_ENV === 'production'
? DateTime.local().plus({ days: 7 }).toJSDate()
? DateTime.local().plus({ days: 3 }).toJSDate()
: DateTime.local().plus({ minutes: 1 }).toJSDate();

ticketData.deleted_at = env.NODE_ENV === 'production'
? DateTime.local().plus({ days: 14 }).toJSDate()
? DateTime.local().plus({ days: 6 }).toJSDate()
: DateTime.local().plus({ minutes: 2 }).toJSDate();

// await database.tickets.set(ticketData);
Expand Down Expand Up @@ -1134,11 +1134,11 @@ export async function tripsitmeUserClose(
// Update the ticket status to closed
ticketData.status = 'CLOSED' as ticket_status;
ticketData.archived_at = env.NODE_ENV === 'production'
? DateTime.local().plus({ days: 7 }).toJSDate()
? DateTime.local().plus({ days: 3 }).toJSDate()
: DateTime.local().plus({ minutes: 1 }).toJSDate();

ticketData.deleted_at = env.NODE_ENV === 'production'
? DateTime.local().plus({ days: 14 }).toJSDate()
? DateTime.local().plus({ days: 6 }).toJSDate()
: DateTime.local().plus({ minutes: 2 }).toJSDate();

await db.user_tickets.update({
Expand Down Expand Up @@ -1402,11 +1402,11 @@ export async function tripSitMe(
// log.debug(F, `Sent message to ${channelTripsitmeta.name} (${channelTripsitmeta.id})`);

const archiveTime = env.NODE_ENV === 'production'
? DateTime.local().plus({ days: 7 })
? DateTime.local().plus({ days: 3 })
: DateTime.local().plus({ minutes: 1 });

const deleteTime = env.NODE_ENV === 'production'
? DateTime.local().plus({ days: 14 })
? DateTime.local().plus({ days: 6 })
: DateTime.local().plus({ minutes: 2 });

log.debug(F, `Ticket archives on ${archiveTime.toLocaleString(DateTime.DATETIME_FULL)} deletes on ${deleteTime.toLocaleString(DateTime.DATETIME_FULL)}`);
Expand Down Expand Up @@ -1725,11 +1725,11 @@ export async function tripsitmeButton(
ticketData.status = 'OPEN' as ticket_status;
ticketData.reopened_at = new Date();
ticketData.archived_at = env.NODE_ENV === 'production'
? DateTime.local().plus({ days: 7 }).toJSDate()
? DateTime.local().plus({ days: 3 }).toJSDate()
: DateTime.local().plus({ minutes: 1 }).toJSDate();

ticketData.deleted_at = env.NODE_ENV === 'production'
? DateTime.local().plus({ days: 14 }).toJSDate()
? DateTime.local().plus({ days: 6 }).toJSDate()
: DateTime.local().plus({ minutes: 2 }).toJSDate();
// await database.tickets.set(ticketData);

Expand Down
4 changes: 2 additions & 2 deletions src/global/utils/timer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ async function checkTickets() { // eslint-disable-line @typescript-eslint/no-unu
const updatedTicket = ticket;
updatedTicket.status = 'ARCHIVED' as ticket_status;
updatedTicket.deleted_at = env.NODE_ENV === 'production'
? DateTime.local().plus({ days: 7 }).toJSDate()
? DateTime.local().plus({ days: 3 }).toJSDate()
: DateTime.local().plus({ minutes: 1 }).toJSDate();
if (!updatedTicket.description) {
updatedTicket.description = 'Ticket archived';
Expand Down Expand Up @@ -323,7 +323,7 @@ async function checkTickets() { // eslint-disable-line @typescript-eslint/no-unu
archived: {
type: 'private',
fetchAll: true,
before: new Date().setDate(new Date().getDate() - 7),
before: new Date().setDate(new Date().getDate() - 3),
},
});
// const threadList = await channel.threads.fetchArchived({ type: 'private', fetchAll: true });
Expand Down

0 comments on commit e31a44a

Please sign in to comment.