Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/pages/setting/Setting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ import { type ChangeEvent, useEffect, useMemo, useState } from "react";
import { toast } from "sonner";

import type { IApiErrorResponse } from "@/types/common/common";
import type {
IChannelNotificationSettings,
IWorkspaceNotificationSettings,
} from "@/types/setting/notification";

import { useImageUploader } from "@/hooks/common/useImageUploader";
import { useCoreQuery } from "@/hooks/customQuery";
Expand All @@ -22,6 +18,16 @@ import { getMyWorkspaces } from "@/api/workspace/org";
import { QUERY_KEYS } from "@/lib/queryKeys";
import useWorkspaceStore from "@/store/useWorkspaceStore";

interface IChannelNotificationSettings {
browserPush: boolean;
emailNotif: boolean;
}

interface IWorkspaceNotificationSettings {
clickAlarm: boolean;
weeklyReport: boolean;
}

const DEFAULT_CHANNEL: IChannelNotificationSettings = {
browserPush: false,
emailNotif: false,
Expand Down
76 changes: 70 additions & 6 deletions src/types/setting/notification.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,73 @@
export interface IChannelNotificationSettings {
browserPush: boolean;
emailNotif: boolean;
import type { TMemberRole } from "@/types/workspace/workspace";

//공통 empty data
export type TNotificationEmptyData = Record<string, never>;

//GET .../members
export interface INotificationMemberItem {
membershipId: number;
name: string;
email: string;
role: TMemberRole;
isReceive: boolean;
}
export interface INotificationMembersData {
hasNext: boolean;
nextCursor: string | null;
members: INotificationMemberItem[];
}
export interface INotificationMembersParams {
cursor?: string;
}

//GET .../settings/{orgId}
export interface IMyNotificationSettings {
isMasterEnabled: boolean;
isBrowserPushEnabled: boolean;
isEmailEnabled: boolean;
isSlackEnabled: boolean;
isSlackConnected: boolean;
isDiscordEnabled: boolean;
isDiscordConnected: boolean;
alertClicks: boolean;
alertReport: boolean;
orgAlertClicks: boolean;
orgAlertReport: boolean;
}
//PATCH .../org
export interface IUpdateOrgNotificationSettingsRequest {
isSlackEnabled: boolean;
slackWebhookUrl: string;
disconnectSlack: boolean;
isDiscordEnabled: boolean;
discordWebhookUrl: string;
disconnectDiscord: boolean;
alertClicks: boolean;
alertReport: boolean;
}

//PATCH .../members
export interface IUpdateNotificationMemberItem {
membershipId: number;
isReceive: boolean;
}
export interface IUpdateNotificationMembersRequest {
members: IUpdateNotificationMemberItem[];
}

//PATCH .../master
export interface IUpdateMasterNotificationSettingRequest {
isMasterEnabled: boolean;
}

//PATCH .../channels
export interface IUpdateChannelNotificationSettingsRequest {
isBrowserPushEnabled: boolean;
isEmailEnabled: boolean;
}

export interface IWorkspaceNotificationSettings {
clickAlarm: boolean;
weeklyReport: boolean;
//PATCH .../alerts
export interface IUpdateAlertsNotificationSettingsRequest {
alertClicks: boolean;
alertReport: boolean;
}
Loading