feat: enhance user limits

This commit is contained in:
gosangam
2026-06-23 14:23:20 +05:30
parent 8b7ae1e7a2
commit 0406a7fe63
2 changed files with 161 additions and 1 deletions
+19
View File
@@ -106,6 +106,19 @@ export type AdminUser = {
created_at: string;
has_password: boolean;
providers: string[];
/** Effective save limits in force (plan default merged with any override);
* -1 means unlimited. */
bookmark_limit: number;
public_collection_limit: number;
private_collection_limit: number;
};
/** Per-user save-limit override payload. null = reset that limit to the plan
* default; a number caps it for this user. */
export type UserLimitsInput = {
bookmark_limit: number | null;
public_collection_limit: number | null;
private_collection_limit: number | null;
};
export type AdminPost = {
@@ -246,6 +259,12 @@ export const api = {
unbanUser(id: string) {
return call(`/admin/users/${id}/ban`, { method: "DELETE" });
},
setUserLimits(id: string, limits: UserLimitsInput) {
return call(`/admin/users/${id}/limits`, {
method: "POST",
body: JSON.stringify(limits),
});
},
posts(q: string, limit: number, offset: number) {
return listed<AdminPost>(`/admin/posts${qs({ q, limit, offset })}`);
},