-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from tago-io/notification/refactor
CORE-90 updated notification interfaces and new routes
- Loading branch information
Showing
7 changed files
with
131 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,55 @@ | ||
import { GenericID } from "../../common/common.types"; | ||
import { GenericID, Query } from "../../common/common.types"; | ||
|
||
type NotificationType = "dashboard" | "bucket" | "analysis" | "profile" | "tago" | "limit_alert"; | ||
|
||
type Condition = "None" | "Pending" | "Accepted" | "Refused"; | ||
interface NotificationTriggerAnalysis { | ||
analysis_id: GenericID; | ||
} | ||
interface NotificationTriggerHTTP { | ||
url: string; | ||
method: "POST" | "GET" | "PUT" | "DELETE" | "REDIRECT"; | ||
body: { [key: string]: any }; | ||
} | ||
interface NotificationTriggerProfile { | ||
share_profile: "accept" | "refuse"; | ||
} | ||
interface NotificationButton { | ||
id: string; | ||
label: string; | ||
color?: string; | ||
triggers: (NotificationTriggerAnalysis | NotificationTriggerHTTP | NotificationTriggerProfile)[]; | ||
} | ||
|
||
interface NotificationQuery { | ||
type: NotificationType; | ||
start_date: Date; | ||
end_date: Date; | ||
ref_id: GenericID; | ||
interface NotificationIconImage { | ||
image_url: string; | ||
bg_color?: HexColor; | ||
fit?: "fill" | "contain" | "cover"; | ||
} | ||
|
||
interface NotificationInfo { | ||
id: GenericID; | ||
ref_id: GenericID | null; | ||
ref_from: { id: GenericID; name: string }; | ||
type: NotificationType; | ||
sub_type: string; | ||
type HexColor = string; | ||
interface NotificationIconSVG { | ||
svg_url: string; | ||
svg_color?: HexColor; | ||
bg_color?: HexColor; | ||
} | ||
interface NotificationCreate { | ||
title: string; | ||
message: string; | ||
read: boolean; | ||
condition: Condition; | ||
created_at: Date; | ||
read?: boolean; | ||
icon?: NotificationIconSVG | NotificationIconImage; | ||
buttons?: NotificationButton[]; | ||
buttons_enabled?: boolean; | ||
buttons_autodisable?: boolean; | ||
} | ||
type NotificationQuery = Query<{ read: boolean }, "created_at">; | ||
type NotificationInfo = { id: GenericID; created_at: Date } & Required<NotificationCreate>; | ||
|
||
export { NotificationQuery, NotificationInfo, NotificationType }; | ||
export { | ||
NotificationCreate, | ||
NotificationQuery, | ||
NotificationInfo, | ||
NotificationButton, | ||
NotificationTriggerProfile, | ||
NotificationTriggerHTTP, | ||
NotificationTriggerAnalysis, | ||
NotificationIconImage, | ||
NotificationIconSVG, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters