コンテンツにスキップ

検索はプロダクションビルドでのみ利用可能です。 ローカルでテストするには、サイトをビルドしてプレビューしてください。

Base RPC メソッド

BaseWorker はアカウント・組織・店舗管理を担当する基盤サービスです。WorkerEntrypoint<Env> を継承し、30の RPC メソッドを公開します。


アカウント一覧をページネーションで取得します。

async listAccounts(params: {
readonly cookie: string;
readonly page?: number;
readonly limit?: number;
readonly role?: string;
}): Promise<{
readonly users: readonly User[];
readonly total: number;
}>

新規アカウントを作成します。

async createAccount(params: {
readonly cookie: string;
readonly name: string;
readonly email: string;
readonly password?: string;
readonly role?: string;
}): Promise<{ readonly user: User }>

アカウント情報を更新します。

async updateAccount(params: {
readonly cookie: string;
readonly userId: string;
readonly name?: string;
readonly email?: string;
}): Promise<{
readonly success: boolean;
readonly user: User;
}>

アカウントのロールを変更します。

async updateAccountRole(params: {
readonly cookie: string;
readonly userId: string;
readonly role: string;
}): Promise<{
readonly success: boolean;
readonly user: User;
}>

アカウントを代理認証します。Set-Cookie ヘッダーを返却します。

async impersonateAccount(params: {
readonly cookie: string;
readonly userId: string;
}): Promise<{
readonly data: Record<string, unknown>;
readonly setCookies: readonly string[];
}>

パスワードリセットメールを送信します(Bell サービス経由)。

async resetPassword(params: {
readonly cookie: string;
readonly userId: string;
}): Promise<{
readonly success: boolean;
readonly message: string;
}>

組織管理(グループ・ストア)

Section titled “組織管理(グループ・ストア)”

グループ組織の一覧を取得します。

async listGroups(): Promise<{
readonly groups: readonly Organization[];
}>

新しいグループ組織を作成します。

async createGroup(params: {
readonly name: string;
readonly slug?: string;
}): Promise<{ readonly group: Organization }>

グループ組織を削除します。cascade オプションで関連データも削除可能です。

async deleteGroup(params: {
readonly groupId: string;
readonly cascade?: boolean;
}): Promise<{
readonly success: boolean;
readonly id: string;
}>

店舗一覧を取得します。グループ ID でフィルタリング可能です。

async listStores(params?: {
readonly groupId?: string;
}): Promise<{
readonly stores: readonly Store[];
}>

新規店舗を作成します。Vault に組織レコード、Cellar に店舗レコードを同時に作成します。

async createStore(params: {
readonly cookie: string;
readonly name: string;
readonly groupId?: string;
readonly pureloversShopId: string;
readonly image?: string;
}): Promise<{ readonly store: Store }>

店舗を削除します。Cellar DB の関連データもカスケード削除します。

async deleteStore(params: {
readonly storeId: string;
}): Promise<{
readonly success: boolean;
readonly id: string;
}>

組織 ID から店舗情報を取得します。

async getShopByOrganization(params: {
readonly organizationId: string;
}): Promise<{ readonly shop: Shop }>

店舗の所属グループを変更します。

async updateStoreGroup(params: {
readonly storeId: string;
readonly groupId: string;
}): Promise<{ readonly store: Store }>

店舗のプロフィール情報を更新します。

async updateStoreProfile(params: {
readonly storeId: string;
readonly name: string;
readonly pureloversShopId: string;
}): Promise<{ readonly store: Store }>

purelovers API から店舗情報を取得し、Cellar DB を更新します。

async syncShopFromPurelovers(params: {
readonly shopId: string;
}): Promise<{
readonly success: boolean;
readonly shop: Shop;
}>

個別組織をグループに紐付けます。

async linkOrganization(params: {
readonly individualId: string;
readonly groupId: string;
}): Promise<{
readonly success: boolean;
readonly organization: Organization;
}>

個別組織のグループ紐付けを解除します。

async unlinkOrganization(params: {
readonly individualId: string;
}): Promise<{
readonly success: boolean;
readonly organization: Organization;
}>

グループの子組織一覧を取得します。

async getOrganizationChildren(params: {
readonly groupId: string;
}): Promise<{
readonly group: Organization;
readonly children: readonly Organization[];
readonly count: number;
}>

個別組織の親グループを取得します。

async getOrganizationParent(params: {
readonly individualId: string;
}): Promise<{
readonly organization: Organization;
readonly parent: Organization | null;
}>

組織のカスタムロール一覧を取得します。

async listRoles(params: {
readonly organizationId: string;
}): Promise<{
readonly roles: readonly OrganizationRole[];
}>

カスタムロールを作成します。

async createRole(params: {
readonly organizationId: string;
readonly name: string;
readonly description?: string;
readonly permissions?: Record<string, unknown>;
}): Promise<{ readonly role: OrganizationRole }>

メンバーにロールを割り当てます。

async assignRole(params: {
readonly roleId: string;
readonly memberId: string;
}): Promise<{ readonly assignment: MemberRole }>

組織にメンバーを追加します。

async addMembership(params: {
readonly cookie: string;
readonly organizationId: string;
readonly userId: string;
readonly role: string;
}): Promise<{ readonly member: Member }>

組織からメンバーを削除します。

async removeMembership(params: {
readonly cookie: string;
readonly organizationId: string;
readonly memberId: string;
}): Promise<{ readonly success: boolean }>

店舗に紐付けられた LINE アカウント一覧を取得します。

async listLineAccounts(params: {
readonly shopId: string;
}): Promise<{
readonly accounts: readonly ShopLineAccount[];
readonly limit: number;
}>

LINE アカウントの紐付けを削除します。

async deleteLineAccount(params: {
readonly shopId: string;
readonly id: string;
}): Promise<{ readonly success: boolean }>

LINE OAuth コールバックを処理します。プロフィール情報を取得して保存します。

async lineCallback(params: {
readonly code: string;
readonly shopId: string;
readonly redirectUrl: string;
}): Promise<{
readonly success: boolean;
readonly profile: LineProfile;
}>

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 }>