It’s not practical to write all commands in a single statement. Here’s a simple snippet of creating
It’s not practical to write all commands in a single statement. Here’s a simple snippet of creating and org and adding a admin to it.
/**
/**
- Create org
- @param userId
- @returns*/export const createOrg = async (userId: string,input: CreateOrgFormSchemaType,) => {return db.transaction(async (txn) => { // Create org const org = await txn .insert(orgs) .values({ ...input, id: getNanoId() }) .returning() .get() // Create admin member await txn .insert(members) .values({ id: getNanoId(), userId, orgId: org.id, role: 'admin' }) .returning() .get() return org})}




