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

Function seedTenant

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

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 1

valuesMethod · 0.80

Tested by

no test coverage detected