MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / seedTenant

Function seedTenant

apps/cloud/src/db/org-deletion.test.ts:42–148  ·  view source on GitHub ↗
(db: DrizzleDb, tenant: string, tag: string)

Source from the content-addressed store, hash-verified

40// Insert one row into every tenant table, plus an org- and a user-scoped blob,
41// all owned by `tenant`. `tag` keeps unique indexes from colliding across orgs.
42const seedTenant = async (db: DrizzleDb, tenant: string, tag: string) => {
43 const now = new Date();
44 await db.insert(integration).values({
45 slug: `int-${tag}`,
46 plugin_id: "p",
47 created_at: now,
48 updated_at: now,
49 tenant,
50 });
51 await db.insert(connection).values({
52 integration: "int",
53 name: `conn-${tag}`,
54 template: "t",
55 provider: "pr",
56 item_ids: [],
57 created_at: now,
58 updated_at: now,
59 tenant,
60 owner: "o",
61 subject: "s",
62 });
63 await db.insert(oauth_client).values({
64 slug: `oc-${tag}`,
65 authorization_url: "u",
66 token_url: "u",
67 grant: "g",
68 client_id: "c",
69 created_at: now,
70 tenant,
71 owner: "o",
72 subject: "s",
73 });
74 await db.insert(oauth_session).values({
75 state: `state-${tag}`,
76 client_slug: "cs",
77 integration: "int",
78 name: "n",
79 template: "t",
80 redirect_url: "r",
81 payload: {},
82 expires_at: 0n,
83 created_at: now,
84 tenant,
85 owner: "o",
86 subject: "s",
87 });
88 await db.insert(tool).values({
89 integration: "int",
90 connection: "conn",
91 plugin_id: "p",
92 name: `tool-${tag}`,
93 description: "d",
94 created_at: now,
95 updated_at: now,
96 tenant,
97 owner: "o",
98 subject: "s",
99 });

Callers 1

Calls 1

valuesMethod · 0.80

Tested by

no test coverage detected