add terms management for signup agreements
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2026-07-10 14:21:39 +09:00
parent 81b18721f7
commit 09480540ec
5 changed files with 444 additions and 2 deletions
+51
View File
@@ -112,6 +112,20 @@ export type LauncherNotice = {
updatedAt?: string;
};
export type LauncherTerm = {
id: string;
no?: number;
key: string;
body: string;
isRequired: boolean;
createdById?: string | null;
createdByName?: string | null;
createdByEmail?: string | null;
createdByAvatarUrl?: string | null;
createdAt: string;
updatedAt?: string;
};
export async function loadAdminsPage(params?: PageParams & { role?: string; state?: string }): Promise<PagedResponse<AdminAccount>> {
type RawAdminAccount = Omit<AdminAccount, 'appPermissions'> & {
appPermissions?: Array<string | { appId: string }>;
@@ -332,6 +346,43 @@ export function deleteLauncherNotice(noticeId: string) {
});
}
export async function loadTermsPage(params?: PageParams & { key?: string }): Promise<PagedResponse<LauncherTerm>> {
const response = await apiRequest<{ terms?: LauncherTerm[]; total?: number; page?: number; limit?: number }>(`/terms${pageQuery(params)}`);
const items = response.terms ?? [];
return { items, total: response.total ?? items.length, page: response.page ?? params?.page ?? 1, limit: response.limit ?? params?.limit ?? items.length };
}
export function createTerm(payload: {
key: string;
body: string;
isRequired?: boolean;
}) {
return apiRequest<{ term: LauncherTerm }>('/terms', {
method: 'POST',
body: JSON.stringify(payload)
});
}
export function updateTerm(
termId: string,
payload: Partial<{
key: string;
body: string;
isRequired: boolean;
}>
) {
return apiRequest<{ term: LauncherTerm }>(`/terms/${termId}`, {
method: 'PATCH',
body: JSON.stringify(payload)
});
}
export function deleteTerm(termId: string) {
return apiRequest<{ ok: boolean }>(`/terms/${termId}`, {
method: 'DELETE'
});
}
export type LicensePlan = {
id: string;
code: string;