Skip to content

Documentation


Documentation / @kizami/db / upsertMembership

Function: upsertMembership()

upsertMembership(db, input): Promise<{ createdAt: number; departmentId: string; id: string; tenantId: string; title: string | null; userId: string; }>

Defined in: packages/db/src/queries/members.ts:172

既存のメンバーシップ(最新1行)があれば所属部署を更新、無ければ新規作成する。

Database | Transaction を受け取る(createUser と同じ理由 — 招待式登録のメンバー作成 トランザクションから使うため)。

Parameters

db

Database | SQLiteTransaction<"async", ResultSet, schema, ExtractTablesWithRelations<schema>>

input

UpsertMembershipInput

Returns

Promise<{ createdAt: number; departmentId: string; id: string; tenantId: string; title: string | null; userId: string; }>