Base RPC メソッド
BaseWorker はアカウント・組織・店舗管理を担当する基盤サービスです。WorkerEntrypoint<Env> を継承し、30の RPC メソッドを公開します。
アカウント管理
Section titled “アカウント管理”listAccounts
Section titled “listAccounts”アカウント一覧をページネーションで取得します。
async listAccounts(params: { readonly cookie: string; readonly page?: number; readonly limit?: number; readonly role?: string;}): Promise<{ readonly users: readonly User[]; readonly total: number;}>createAccount
Section titled “createAccount”新規アカウントを作成します。
async createAccount(params: { readonly cookie: string; readonly name: string; readonly email: string; readonly password?: string; readonly role?: string;}): Promise<{ readonly user: User }>updateAccount
Section titled “updateAccount”アカウント情報を更新します。
async updateAccount(params: { readonly cookie: string; readonly userId: string; readonly name?: string; readonly email?: string;}): Promise<{ readonly success: boolean; readonly user: User;}>updateAccountRole
Section titled “updateAccountRole”アカウントのロールを変更します。
async updateAccountRole(params: { readonly cookie: string; readonly userId: string; readonly role: string;}): Promise<{ readonly success: boolean; readonly user: User;}>impersonateAccount
Section titled “impersonateAccount”アカウントを代理認証します。Set-Cookie ヘッダーを返却します。
async impersonateAccount(params: { readonly cookie: string; readonly userId: string;}): Promise<{ readonly data: Record<string, unknown>; readonly setCookies: readonly string[];}>resetPassword
Section titled “resetPassword”パスワードリセットメールを送信します(Bell サービス経由)。
async resetPassword(params: { readonly cookie: string; readonly userId: string;}): Promise<{ readonly success: boolean; readonly message: string;}>組織管理(グループ・ストア)
Section titled “組織管理(グループ・ストア)”listGroups
Section titled “listGroups”グループ組織の一覧を取得します。
async listGroups(): Promise<{ readonly groups: readonly Organization[];}>createGroup
Section titled “createGroup”新しいグループ組織を作成します。
async createGroup(params: { readonly name: string; readonly slug?: string;}): Promise<{ readonly group: Organization }>deleteGroup
Section titled “deleteGroup”グループ組織を削除します。cascade オプションで関連データも削除可能です。
async deleteGroup(params: { readonly groupId: string; readonly cascade?: boolean;}): Promise<{ readonly success: boolean; readonly id: string;}>listStores
Section titled “listStores”店舗一覧を取得します。グループ ID でフィルタリング可能です。
async listStores(params?: { readonly groupId?: string;}): Promise<{ readonly stores: readonly Store[];}>createStore
Section titled “createStore”新規店舗を作成します。Vault に組織レコード、Cellar に店舗レコードを同時に作成します。
async createStore(params: { readonly cookie: string; readonly name: string; readonly groupId?: string; readonly pureloversShopId: string; readonly image?: string;}): Promise<{ readonly store: Store }>deleteStore
Section titled “deleteStore”店舗を削除します。Cellar DB の関連データもカスケード削除します。
async deleteStore(params: { readonly storeId: string;}): Promise<{ readonly success: boolean; readonly id: string;}>getShopByOrganization
Section titled “getShopByOrganization”組織 ID から店舗情報を取得します。
async getShopByOrganization(params: { readonly organizationId: string;}): Promise<{ readonly shop: Shop }>updateStoreGroup
Section titled “updateStoreGroup”店舗の所属グループを変更します。
async updateStoreGroup(params: { readonly storeId: string; readonly groupId: string;}): Promise<{ readonly store: Store }>updateStoreProfile
Section titled “updateStoreProfile”店舗のプロフィール情報を更新します。
async updateStoreProfile(params: { readonly storeId: string; readonly name: string; readonly pureloversShopId: string;}): Promise<{ readonly store: Store }>syncShopFromPurelovers
Section titled “syncShopFromPurelovers”purelovers API から店舗情報を取得し、Cellar DB を更新します。
async syncShopFromPurelovers(params: { readonly shopId: string;}): Promise<{ readonly success: boolean; readonly shop: Shop;}>linkOrganization
Section titled “linkOrganization”個別組織をグループに紐付けます。
async linkOrganization(params: { readonly individualId: string; readonly groupId: string;}): Promise<{ readonly success: boolean; readonly organization: Organization;}>unlinkOrganization
Section titled “unlinkOrganization”個別組織のグループ紐付けを解除します。
async unlinkOrganization(params: { readonly individualId: string;}): Promise<{ readonly success: boolean; readonly organization: Organization;}>getOrganizationChildren
Section titled “getOrganizationChildren”グループの子組織一覧を取得します。
async getOrganizationChildren(params: { readonly groupId: string;}): Promise<{ readonly group: Organization; readonly children: readonly Organization[]; readonly count: number;}>getOrganizationParent
Section titled “getOrganizationParent”個別組織の親グループを取得します。
async getOrganizationParent(params: { readonly individualId: string;}): Promise<{ readonly organization: Organization; readonly parent: Organization | null;}>listRoles
Section titled “listRoles”組織のカスタムロール一覧を取得します。
async listRoles(params: { readonly organizationId: string;}): Promise<{ readonly roles: readonly OrganizationRole[];}>createRole
Section titled “createRole”カスタムロールを作成します。
async createRole(params: { readonly organizationId: string; readonly name: string; readonly description?: string; readonly permissions?: Record<string, unknown>;}): Promise<{ readonly role: OrganizationRole }>assignRole
Section titled “assignRole”メンバーにロールを割り当てます。
async assignRole(params: { readonly roleId: string; readonly memberId: string;}): Promise<{ readonly assignment: MemberRole }>addMembership
Section titled “addMembership”組織にメンバーを追加します。
async addMembership(params: { readonly cookie: string; readonly organizationId: string; readonly userId: string; readonly role: string;}): Promise<{ readonly member: Member }>removeMembership
Section titled “removeMembership”組織からメンバーを削除します。
async removeMembership(params: { readonly cookie: string; readonly organizationId: string; readonly memberId: string;}): Promise<{ readonly success: boolean }>LINE 連携
Section titled “LINE 連携”listLineAccounts
Section titled “listLineAccounts”店舗に紐付けられた LINE アカウント一覧を取得します。
async listLineAccounts(params: { readonly shopId: string;}): Promise<{ readonly accounts: readonly ShopLineAccount[]; readonly limit: number;}>deleteLineAccount
Section titled “deleteLineAccount”LINE アカウントの紐付けを削除します。
async deleteLineAccount(params: { readonly shopId: string; readonly id: string;}): Promise<{ readonly success: boolean }>lineCallback
Section titled “lineCallback”LINE OAuth コールバックを処理します。プロフィール情報を取得して保存します。
async lineCallback(params: { readonly code: string; readonly shopId: string; readonly redirectUrl: string;}): Promise<{ readonly success: boolean; readonly profile: LineProfile;}>lineCallbackLiff
Section titled “lineCallbackLiff”LINE LIFF SDK 経由の登録を処理します。アクセストークンを検証してプロフィールを保存します。
async lineCallbackLiff(params: { readonly shopId: string; readonly userId: string; readonly displayName: string; readonly pictureUrl?: string; readonly accessToken: string; readonly registeredBy?: string; readonly registeredByName?: string;}): Promise<{ readonly success: boolean }>