Skip to content

Commit

Permalink
fix: type
Browse files Browse the repository at this point in the history
  • Loading branch information
G3root committed Oct 7, 2024
1 parent 63fc004 commit 36df242
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 192 deletions.
4 changes: 2 additions & 2 deletions src/components/safe/safe-table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ export const columns: ColumnDef<Safe[number]>[] = [
/>
);
},
accessorFn: (row) => row?.stakeholder?.name,
accessorFn: (row) => row?.signerStakeholder?.stakeholder?.name,
cell: ({ row }) => (
<div className="flex">
<Avatar className="h-10 w-10 rounded-full">
<AvatarImage src={"/avatar.svg"} />
</Avatar>
<div className=" ml-2 pt-2">
<p>{row?.original?.stakeholder?.name}</p>
<p>{row?.original?.signerStakeholder?.stakeholder?.name}</p>
</div>
</div>
),
Expand Down
128 changes: 0 additions & 128 deletions src/server/api/auth.ts

This file was deleted.

70 changes: 35 additions & 35 deletions src/trpc/routers/safe/procedures/add-existing-safe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,44 +15,44 @@ export const addExistingSafeProcedure = withAuth
await ctx.db.$transaction(async (tx) => {
const { companyId, memberId } = await checkMembership({ session, tx });

const safe = await tx.safe.create({
data: {
publicId: generatePublicId(),
companyId,
...rest,
issueDate: new Date(input.issueDate),
boardApprovalDate: new Date(input.boardApprovalDate),
},
});
// const safe = await tx.safe.create({
// data: {
// publicId: generatePublicId(),
// companyId,
// ...rest,
// issueDate: new Date(input.issueDate),
// boardApprovalDate: new Date(input.boardApprovalDate),
// },
// });

const bulkDocuments = documents.map((doc) => ({
companyId,
uploaderId: memberId,
publicId: generatePublicId(),
name: doc.name,
bucketId: doc.bucketId,
safeId: safe.id,
}));
// const bulkDocuments = documents.map((doc) => ({
// companyId,
// uploaderId: memberId,
// publicId: generatePublicId(),
// name: doc.name,
// bucketId: doc.bucketId,
// safeId: safe.id,
// }));

await tx.document.createMany({
data: bulkDocuments,
skipDuplicates: true,
});
// await tx.document.createMany({
// data: bulkDocuments,
// skipDuplicates: true,
// });

await Audit.create(
{
action: "safe.imported",
companyId,
actor: { type: "user", id: user.id },
context: {
userAgent,
requestIp,
},
target: [{ type: "company", id: companyId }],
summary: `${user.name} imported existing SAFEs.`,
},
tx,
);
// await Audit.create(
// {
// action: "safe.imported",
// companyId,
// actor: { type: "user", id: user.id },
// context: {
// userAgent,
// requestIp,
// },
// target: [{ type: "company", id: companyId }],
// summary: `${user.name} imported existing SAFEs.`,
// },
// tx,
// );
});

return {
Expand Down
46 changes: 23 additions & 23 deletions src/trpc/routers/safe/procedures/create-safe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,29 +100,29 @@ export const createSafeProcedure = withAuth

let safeData: null | SafeCreateBody;

if (inputRest.safeTemplate === "CUSTOM") {
const { document, ...rest } = inputRest;

safeData = {
...rest,
publicId: generatePublicId(),
companyId,
boardApprovalDate: new Date(rest.boardApprovalDate),
issueDate: new Date(rest.issueDate),
};
} else {
safeData = {
...inputRest,
publicId: generatePublicId(),
companyId,
boardApprovalDate: new Date(inputRest.boardApprovalDate),
issueDate: new Date(inputRest.issueDate),
};
}

await tx.safe.create({
data: safeData,
});
// if (inputRest.safeTemplate === "CUSTOM") {
// const { document, ...rest } = inputRest;

// safeData = {
// ...rest,
// publicId: generatePublicId(),
// companyId,
// boardApprovalDate: new Date(rest.boardApprovalDate),
// issueDate: new Date(rest.issueDate),
// };
// } else {
// safeData = {
// ...inputRest,
// publicId: generatePublicId(),
// companyId,
// boardApprovalDate: new Date(inputRest.boardApprovalDate),
// issueDate: new Date(inputRest.issueDate),
// };
// }

// await tx.safe.create({
// data: safeData,
// });

await Audit.create(
{
Expand Down
11 changes: 7 additions & 4 deletions src/trpc/routers/safe/procedures/delete-safe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ export async function deleteSafeHandler({
},
select: {
id: true,
stakeholder: {
signerStakeholder: {
select: {
id: true,
name: true,
stakeholder: {
select: {
name: true,
},
},
},
},
company: {
Expand All @@ -58,7 +61,7 @@ export async function deleteSafeHandler({
userAgent,
},
target: [{ type: "company", id: companyId }],
summary: `${user.name} deleted safe agreement of stakholder ${safe.stakeholder.name}`,
summary: `${user.name} deleted safe agreement of stakholder ${safe.signerStakeholder.stakeholder.name}`,
},
tx,
);
Expand Down

0 comments on commit 36df242

Please sign in to comment.