Adding methods to delete backups on remote storage s3 and local. Some refactoring on models db and adding common.ts model with createdAt, updatedAt, and deletedAt.

This commit is contained in:
charlesgauthereau
2025-08-29 15:31:23 +02:00
parent c8da2579e8
commit 45e3b31fda
48 changed files with 310 additions and 148 deletions
+43
View File
@@ -0,0 +1,43 @@
import { pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
import { relations } from "drizzle-orm";
import { project } from "./06_project";
import { createSelectSchema } from "drizzle-zod";
import { z } from "zod";
import {invitation, OrganizationInvitation} from "@/db/schema/05_invitation";
import {member, OrganizationMember} from "@/db/schema/04_member";
import {User} from "@/db/schema/02_user";
import {timestamps} from "@/db/schema/00_common";
export const organization = pgTable("organization", {
id: uuid("id").defaultRandom().primaryKey(),
name: text("name").notNull(),
slug: text("slug").unique().notNull(),
logo: text("logo"),
metadata: text("metadata"),
...timestamps
});
export const organizationRelations = relations(organization, ({ many }) => ({
members: many(member),
invitations: many(invitation),
projects: many(project),
}));
export const organizationSchema = createSelectSchema(organization);
export type Organization = z.infer<typeof organizationSchema>;
export type OrganizationWithMembers = Organization & {
members: OrganizationMember[];
};
export type MemberWithUser = OrganizationMember & {
user: User;
};
export type OrganizationWithMembersAndUsers = Organization & {
members: MemberWithUser[];
invitations: OrganizationInvitation[];
};