Add account restrictions, appeals, and admin moderation tools

This commit is contained in:
2026-10-13 12:32:37 +05:00
parent 018be5049e
commit cfe5820802
28 changed files with 1936 additions and 125 deletions

View File

@@ -25,7 +25,7 @@ type ReportModerationFields = {
type AppealRecord = {
id: string;
dataset_id: string;
owner_id: string;
owner_id: string | null;
report_cycle: number;
reason: string;
state: string;
@@ -35,6 +35,25 @@ type AppealRecord = {
review_reason: string | null;
};
type AccountStatusFields = {
account_status: "active" | "deactivated" | "banned" | "deleting";
account_reason: string | null;
account_changed_at: string | null;
account_changed_by: string | null;
account_status_version: number;
};
type AccountAppealRecord = {
id: string;
owner_id: string;
status_version: number;
reason: string;
state: "open" | "approved" | "rejected";
created_at: string;
reviewer_id: string | null;
reviewed_at: string | null;
review_reason: string | null;
};
export type Database = {
// Allows to automatically instantiate createClient with right options
// instead of createClient<Database, { PostgrestVersion: 'XX' }>(URL, KEY)
@@ -43,6 +62,37 @@ export type Database = {
};
public: {
Tables: {
account_appeals: {
Row: AccountAppealRecord;
Insert: Partial<AccountAppealRecord> &
Pick<AccountAppealRecord, "owner_id" | "status_version" | "reason">;
Update: Partial<AccountAppealRecord>;
Relationships: [];
};
account_control_events: {
Row: {
id: string;
owner_id: string | null;
reviewer_id: string | null;
action: string;
previous_status: string;
new_status: string;
status_version: number;
reason: string;
created_at: string;
};
Insert: {
owner_id?: string | null;
reviewer_id?: string | null;
action: string;
previous_status: string;
new_status: string;
status_version: number;
reason: string;
};
Update: { owner_id?: string | null; reviewer_id?: string | null };
Relationships: [];
};
discord_announcements: {
Row: import("./discord").DiscordAnnouncement;
Insert: Partial<import("./discord").DiscordAnnouncement> &
@@ -307,7 +357,7 @@ export type Database = {
id: string;
map_path: string | null;
name: string;
owner_id: string;
owner_id: string | null;
panorama_count: number;
parent_dataset_id: string | null;
rejection_reason: string | null;
@@ -330,7 +380,7 @@ export type Database = {
id?: string;
map_path?: string | null;
name: string;
owner_id: string;
owner_id: string | null;
panorama_count?: number;
parent_dataset_id?: string | null;
rejection_reason?: string | null;
@@ -353,7 +403,7 @@ export type Database = {
id?: string;
map_path?: string | null;
name?: string;
owner_id?: string;
owner_id?: string | null;
panorama_count?: number;
parent_dataset_id?: string | null;
rejection_reason?: string | null;
@@ -489,7 +539,7 @@ export type Database = {
Relationships: [];
};
profiles: {
Row: {
Row: AccountStatusFields & {
glow_color: string;
bug_finder: boolean;
custom_prefix: string | null;
@@ -500,7 +550,7 @@ export type Database = {
id: string;
role: string;
};
Insert: {
Insert: Partial<AccountStatusFields> & {
glow_color?: string;
bug_finder?: boolean;
custom_prefix?: string | null;
@@ -511,7 +561,7 @@ export type Database = {
id: string;
role?: string;
};
Update: {
Update: Partial<AccountStatusFields> & {
glow_color?: string;
bug_finder?: boolean;
custom_prefix?: string | null;
@@ -702,6 +752,28 @@ export type Database = {
[_ in never]: never;
};
Functions: {
admin_account_action: {
Args: {
p_reviewer: string;
p_user: string;
p_action: string;
p_reason: string;
};
Returns: Json;
};
submit_account_appeal: {
Args: { p_owner: string; p_reason: string };
Returns: string;
};
review_account_appeal: {
Args: {
p_reviewer: string;
p_appeal: string;
p_decision: string;
p_reason: string;
};
Returns: undefined;
};
developer_keys_list: { Args: { p_owner: string }; Returns: Json };
developer_key_create: {
Args: {