Add named teams and per-user data visibility (own/team/org) with settings UI and org module.
This commit is contained in:
@@ -120,7 +120,8 @@ export type OrgModuleKey =
|
||||
| "audit_logs"
|
||||
| "saved_views"
|
||||
| "public_api"
|
||||
| "sms_campaigns";
|
||||
| "sms_campaigns"
|
||||
| "teams";
|
||||
|
||||
export const ORG_MODULE_KEYS: OrgModuleKey[] = [
|
||||
"customers",
|
||||
@@ -151,6 +152,7 @@ export const ORG_MODULE_KEYS: OrgModuleKey[] = [
|
||||
"saved_views",
|
||||
"public_api",
|
||||
"sms_campaigns",
|
||||
"teams",
|
||||
];
|
||||
|
||||
export const ORG_MODULE_LABELS: Record<OrgModuleKey, string> = {
|
||||
@@ -182,6 +184,7 @@ export const ORG_MODULE_LABELS: Record<OrgModuleKey, string> = {
|
||||
saved_views: "فیلترهای ذخیرهشده",
|
||||
public_api: "API و وبهوک",
|
||||
sms_campaigns: "پیامک گروهی",
|
||||
teams: "تیمها و دیدپذیری",
|
||||
};
|
||||
|
||||
export const ORG_MODULE_GROUPS: Array<{
|
||||
@@ -227,6 +230,7 @@ export const ORG_MODULE_GROUPS: Array<{
|
||||
title: "تنظیمات",
|
||||
keys: [
|
||||
"team_settings",
|
||||
"teams",
|
||||
"custom_fields",
|
||||
"currencies",
|
||||
"tahesab",
|
||||
@@ -293,9 +297,25 @@ export interface OrgUserDto {
|
||||
lastLoginAt?: string | null;
|
||||
hasAvatar?: boolean;
|
||||
commissionPercent?: number;
|
||||
/** own = فقط خود | team = همتیمیها | org = کل سازمان */
|
||||
dataVisibility?: DataVisibility;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export type DataVisibility = "own" | "team" | "org";
|
||||
|
||||
export const DATA_VISIBILITIES: DataVisibility[] = ["own", "team", "org"];
|
||||
|
||||
export const DATA_VISIBILITY_LABELS: Record<DataVisibility, string> = {
|
||||
own: "فقط پروندههای خود",
|
||||
team: "تیمهای عضو",
|
||||
org: "کل سازمان",
|
||||
};
|
||||
|
||||
export interface UpdateUserVisibilityRequest {
|
||||
dataVisibility: DataVisibility;
|
||||
}
|
||||
|
||||
export type RolePermissionKey =
|
||||
| "customers"
|
||||
| "sales"
|
||||
@@ -3086,3 +3106,40 @@ export interface SmsCampaignListResponse {
|
||||
items: SmsCampaignDto[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
/* ——— تیمها و دیدپذیری ——— */
|
||||
|
||||
export type TeamMemberRole = "member" | "manager";
|
||||
|
||||
export interface TeamMemberDto {
|
||||
userId: string;
|
||||
fullName: string;
|
||||
role: TeamMemberRole;
|
||||
hasAvatar?: boolean;
|
||||
}
|
||||
|
||||
export interface TeamDto {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
memberCount: number;
|
||||
members: TeamMemberDto[];
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export interface CreateTeamRequest {
|
||||
name: string;
|
||||
description?: string;
|
||||
memberIds?: string[];
|
||||
managerIds?: string[];
|
||||
}
|
||||
|
||||
export interface UpdateTeamRequest {
|
||||
name?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface SetTeamMembersRequest {
|
||||
members: Array<{ userId: string; role: TeamMemberRole }>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user