Skip to content

Commit

Permalink
fix: types
Browse files Browse the repository at this point in the history
  • Loading branch information
casperiv0 committed Sep 23, 2023
1 parent 25b6fc3 commit 6405e55
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,24 @@ export class AdminNameChangeController {
include: { citizen: true },
});

const auditLogType =
const action =
type === WhitelistStatus.ACCEPTED
? AuditLogActionType.NameChangeRequestAccepted
: AuditLogActionType.NameChangeRequestDeclined;
? ({
type: AuditLogActionType.NameChangeRequestAccepted,
new: { ...updated, id: updated.citizenId },
} as const)
: ({
type: AuditLogActionType.NameChangeRequestDeclined,
new: { ...updated, id: updated.citizenId },
} as const);

const translationKey =
type === WhitelistStatus.ACCEPTED ? "nameChangeRequestAccepted" : "nameChangeRequestDeclined";

await createAuditLogEntry({
translationKey,
action: {
type: auditLogType,
new: { ...updated, id: updated.citizenId },
},
// @ts-expect-error this is correct.
action,
prisma,
executorId: sessionUserId,
});
Expand Down
6 changes: 3 additions & 3 deletions apps/client/src/lib/editor/remarkGitHubReferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ function replaceMatchLinks(_url: string, _type: string, number: string) {

export function remarkGitHubReferences() {
return function (tree: any) {
findAndReplace(tree, linkRegex, replaceMatch, { ignore: "link" });
findAndReplace(tree, linkRegex, replaceMatchLinks, { ignore: "text" });
findAndReplace(tree, /What's Changed/);
findAndReplace(tree, [linkRegex, replaceMatch], { ignore: "link" });
findAndReplace(tree, [linkRegex, replaceMatchLinks], { ignore: "text" });
findAndReplace(tree, [/What's Changed/]);
};
}
5 changes: 4 additions & 1 deletion packages/audit-logger/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ import superjson from "superjson";
import type { PrismaClient } from "@prisma/client";
import type { AuditLogActions } from "./index";
import { captureException } from "@sentry/node";
import { AuditLog } from "@snailycad/types";
import { AuditLog as _AuditLog } from "@snailycad/types";

export * from "./types/action-types";
export * from "./types/actions";
type AuditLog = Omit<_AuditLog, "action"> & {
action: any;
};

export type AuditLogMessages =
keyof (typeof import("../../../apps/client/locales/en/admin.json"))["AuditLogs"];
Expand Down

0 comments on commit 6405e55

Please sign in to comment.