@checkstack/notification-backend 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +133 -0
- package/drizzle/0000_tan_stryfe.sql +28 -0
- package/drizzle/0001_futuristic_apocalypse.sql +11 -0
- package/drizzle/0002_early_the_spike.sql +3 -0
- package/drizzle/0003_tiny_wendell_vaughn.sql +1 -0
- package/drizzle/0004_regular_corsair.sql +4 -0
- package/drizzle/meta/0000_snapshot.json +188 -0
- package/drizzle/meta/0001_snapshot.json +260 -0
- package/drizzle/meta/0002_snapshot.json +278 -0
- package/drizzle/meta/0003_snapshot.json +188 -0
- package/drizzle/meta/0004_snapshot.json +188 -0
- package/drizzle/meta/_journal.json +41 -0
- package/drizzle.config.ts +8 -0
- package/package.json +37 -0
- package/src/index.ts +280 -0
- package/src/oauth-callback-handler.ts +209 -0
- package/src/retention-config.ts +30 -0
- package/src/router.test.ts +38 -0
- package/src/router.ts +1090 -0
- package/src/schema.ts +54 -0
- package/src/service.ts +216 -0
- package/src/strategy-service.test.ts +478 -0
- package/src/strategy-service.ts +551 -0
- package/tsconfig.json +6 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# @checkstack/notification-backend
|
|
2
|
+
|
|
3
|
+
## 0.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d20d274: Initial release of all @checkstack packages. Rebranded from Checkmate to Checkstack with new npm organization @checkstack and domain checkstack.dev.
|
|
8
|
+
- Updated dependencies [d20d274]
|
|
9
|
+
- @checkstack/auth-backend@0.0.2
|
|
10
|
+
- @checkstack/auth-common@0.0.2
|
|
11
|
+
- @checkstack/backend-api@0.0.2
|
|
12
|
+
- @checkstack/common@0.0.2
|
|
13
|
+
- @checkstack/notification-common@0.0.2
|
|
14
|
+
- @checkstack/queue-api@0.0.2
|
|
15
|
+
- @checkstack/signal-common@0.0.2
|
|
16
|
+
|
|
17
|
+
## 0.1.2
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- b4eb432: Fixed TypeScript generic contravariance issue in notification strategy registration.
|
|
22
|
+
|
|
23
|
+
The `register` and `addStrategy` methods now use generic type parameters instead of `unknown`, allowing notification strategy plugins with typed OAuth configurations to be registered without compiler errors. This fixes contravariance issues where function parameters in `StrategyOAuthConfig<TConfig>` could not be assigned when `TConfig` was a specific type.
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [b4eb432]
|
|
26
|
+
- Updated dependencies [a65e002]
|
|
27
|
+
- Updated dependencies [a65e002]
|
|
28
|
+
- @checkstack/backend-api@1.1.0
|
|
29
|
+
- @checkstack/common@0.2.0
|
|
30
|
+
- @checkstack/auth-common@0.2.1
|
|
31
|
+
- @checkstack/auth-backend@1.1.0
|
|
32
|
+
- @checkstack/queue-api@1.0.1
|
|
33
|
+
- @checkstack/notification-common@0.1.1
|
|
34
|
+
- @checkstack/signal-common@0.1.1
|
|
35
|
+
|
|
36
|
+
## 0.1.1
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- Updated dependencies [e26c08e]
|
|
41
|
+
- @checkstack/auth-common@0.2.0
|
|
42
|
+
- @checkstack/auth-backend@1.0.1
|
|
43
|
+
|
|
44
|
+
## 0.1.0
|
|
45
|
+
|
|
46
|
+
### Minor Changes
|
|
47
|
+
|
|
48
|
+
- b55fae6: Added realtime Signal Service for backend-to-frontend push notifications via WebSockets.
|
|
49
|
+
|
|
50
|
+
## New Packages
|
|
51
|
+
|
|
52
|
+
- **@checkstack/signal-common**: Shared types including `Signal`, `SignalService`, `createSignal()`, and WebSocket protocol messages
|
|
53
|
+
- **@checkstack/signal-backend**: `SignalServiceImpl` with EventBus integration and Bun WebSocket handler using native pub/sub
|
|
54
|
+
- **@checkstack/signal-frontend**: React `SignalProvider` and `useSignal()` hook for consuming typed signals
|
|
55
|
+
|
|
56
|
+
## Changes
|
|
57
|
+
|
|
58
|
+
- **@checkstack/backend-api**: Added `coreServices.signalService` reference for plugins to emit signals
|
|
59
|
+
- **@checkstack/backend**: Integrated WebSocket server at `/api/signals/ws` with session-based authentication
|
|
60
|
+
|
|
61
|
+
## Usage
|
|
62
|
+
|
|
63
|
+
Backend plugins can emit signals:
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
import { coreServices } from "@checkstack/backend-api";
|
|
67
|
+
import { NOTIFICATION_RECEIVED } from "@checkstack/notification-common";
|
|
68
|
+
|
|
69
|
+
const signalService = context.signalService;
|
|
70
|
+
await signalService.sendToUser(NOTIFICATION_RECEIVED, userId, { ... });
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Frontend components subscribe to signals:
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
import { useSignal } from "@checkstack/signal-frontend";
|
|
77
|
+
import { NOTIFICATION_RECEIVED } from "@checkstack/notification-common";
|
|
78
|
+
|
|
79
|
+
useSignal(NOTIFICATION_RECEIVED, (payload) => {
|
|
80
|
+
// Handle realtime notification
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
- b354ab3: # Strategy Instructions Support & Telegram Notification Plugin
|
|
85
|
+
|
|
86
|
+
## Strategy Instructions Interface
|
|
87
|
+
|
|
88
|
+
Added `adminInstructions` and `userInstructions` optional fields to the `NotificationStrategy` interface. These allow strategies to export markdown-formatted setup guides that are displayed in the configuration UI:
|
|
89
|
+
|
|
90
|
+
- **`adminInstructions`**: Shown when admins configure platform-wide strategy settings (e.g., how to create API keys)
|
|
91
|
+
- **`userInstructions`**: Shown when users configure their personal settings (e.g., how to link their account)
|
|
92
|
+
|
|
93
|
+
### Updated Components
|
|
94
|
+
|
|
95
|
+
- `StrategyConfigCard` now accepts an `instructions` prop and renders it before config sections
|
|
96
|
+
- `StrategyCard` passes `adminInstructions` to `StrategyConfigCard`
|
|
97
|
+
- `UserChannelCard` renders `userInstructions` when users need to connect
|
|
98
|
+
|
|
99
|
+
## New Telegram Notification Plugin
|
|
100
|
+
|
|
101
|
+
Added `@checkstack/notification-telegram-backend` plugin for sending notifications via Telegram:
|
|
102
|
+
|
|
103
|
+
- Uses [grammY](https://grammy.dev/) framework for Telegram Bot API integration
|
|
104
|
+
- Sends messages with MarkdownV2 formatting and inline keyboard buttons for actions
|
|
105
|
+
- Includes comprehensive admin instructions for bot setup via @BotFather
|
|
106
|
+
- Includes user instructions for account linking
|
|
107
|
+
|
|
108
|
+
### Configuration
|
|
109
|
+
|
|
110
|
+
Admins need to configure a Telegram Bot Token obtained from @BotFather.
|
|
111
|
+
|
|
112
|
+
### User Linking
|
|
113
|
+
|
|
114
|
+
The strategy uses `contactResolution: { type: "custom" }` for Telegram Login Widget integration. Full frontend integration for the Login Widget is pending future work.
|
|
115
|
+
|
|
116
|
+
### Patch Changes
|
|
117
|
+
|
|
118
|
+
- Updated dependencies [ffc28f6]
|
|
119
|
+
- Updated dependencies [e4d83fc]
|
|
120
|
+
- Updated dependencies [71275dd]
|
|
121
|
+
- Updated dependencies [ae19ff6]
|
|
122
|
+
- Updated dependencies [32f2535]
|
|
123
|
+
- Updated dependencies [b55fae6]
|
|
124
|
+
- Updated dependencies [b354ab3]
|
|
125
|
+
- Updated dependencies [8e889b4]
|
|
126
|
+
- Updated dependencies [81f3f85]
|
|
127
|
+
- @checkstack/common@0.1.0
|
|
128
|
+
- @checkstack/backend-api@1.0.0
|
|
129
|
+
- @checkstack/auth-backend@1.0.0
|
|
130
|
+
- @checkstack/auth-common@0.1.0
|
|
131
|
+
- @checkstack/notification-common@0.1.0
|
|
132
|
+
- @checkstack/queue-api@1.0.0
|
|
133
|
+
- @checkstack/signal-common@0.1.0
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
CREATE TABLE "notification_groups" (
|
|
2
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
3
|
+
"name" text NOT NULL,
|
|
4
|
+
"description" text NOT NULL,
|
|
5
|
+
"owner_plugin" text NOT NULL,
|
|
6
|
+
"created_at" timestamp DEFAULT now() NOT NULL
|
|
7
|
+
);
|
|
8
|
+
--> statement-breakpoint
|
|
9
|
+
CREATE TABLE "notification_subscriptions" (
|
|
10
|
+
"user_id" text NOT NULL,
|
|
11
|
+
"group_id" text NOT NULL,
|
|
12
|
+
"subscribed_at" timestamp DEFAULT now() NOT NULL,
|
|
13
|
+
CONSTRAINT "notification_subscriptions_user_id_group_id_pk" PRIMARY KEY("user_id","group_id")
|
|
14
|
+
);
|
|
15
|
+
--> statement-breakpoint
|
|
16
|
+
CREATE TABLE "notifications" (
|
|
17
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
18
|
+
"user_id" text NOT NULL,
|
|
19
|
+
"title" text NOT NULL,
|
|
20
|
+
"description" text NOT NULL,
|
|
21
|
+
"actions" jsonb,
|
|
22
|
+
"importance" text DEFAULT 'info' NOT NULL,
|
|
23
|
+
"is_read" boolean DEFAULT false NOT NULL,
|
|
24
|
+
"group_id" text,
|
|
25
|
+
"created_at" timestamp DEFAULT now() NOT NULL
|
|
26
|
+
);
|
|
27
|
+
--> statement-breakpoint
|
|
28
|
+
ALTER TABLE "notification_subscriptions" ADD CONSTRAINT "notification_subscriptions_group_id_notification_groups_id_fk" FOREIGN KEY ("group_id") REFERENCES "notification_groups"("id") ON DELETE cascade ON UPDATE no action;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
CREATE TABLE "user_notification_preferences" (
|
|
2
|
+
"user_id" text NOT NULL,
|
|
3
|
+
"strategy_id" text NOT NULL,
|
|
4
|
+
"config" jsonb,
|
|
5
|
+
"enabled" boolean DEFAULT true NOT NULL,
|
|
6
|
+
"external_id" text,
|
|
7
|
+
"linked_at" timestamp,
|
|
8
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
9
|
+
"updated_at" timestamp DEFAULT now() NOT NULL,
|
|
10
|
+
CONSTRAINT "user_notification_preferences_user_id_strategy_id_pk" PRIMARY KEY("user_id","strategy_id")
|
|
11
|
+
);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
ALTER TABLE "user_notification_preferences" ADD COLUMN "access_token" text;--> statement-breakpoint
|
|
2
|
+
ALTER TABLE "user_notification_preferences" ADD COLUMN "refresh_token" text;--> statement-breakpoint
|
|
3
|
+
ALTER TABLE "user_notification_preferences" ADD COLUMN "token_expires_at" timestamp;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
DROP TABLE "user_notification_preferences" CASCADE;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
ALTER TABLE "notifications" ADD COLUMN "body" text NOT NULL;--> statement-breakpoint
|
|
2
|
+
ALTER TABLE "notifications" ADD COLUMN "action" jsonb;--> statement-breakpoint
|
|
3
|
+
ALTER TABLE "notifications" DROP COLUMN "description";--> statement-breakpoint
|
|
4
|
+
ALTER TABLE "notifications" DROP COLUMN "actions";
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "3c779341-b676-429f-a7b3-a8e08728f95a",
|
|
3
|
+
"prevId": "00000000-0000-0000-0000-000000000000",
|
|
4
|
+
"version": "7",
|
|
5
|
+
"dialect": "postgresql",
|
|
6
|
+
"tables": {
|
|
7
|
+
"public.notification_groups": {
|
|
8
|
+
"name": "notification_groups",
|
|
9
|
+
"schema": "",
|
|
10
|
+
"columns": {
|
|
11
|
+
"id": {
|
|
12
|
+
"name": "id",
|
|
13
|
+
"type": "text",
|
|
14
|
+
"primaryKey": true,
|
|
15
|
+
"notNull": true
|
|
16
|
+
},
|
|
17
|
+
"name": {
|
|
18
|
+
"name": "name",
|
|
19
|
+
"type": "text",
|
|
20
|
+
"primaryKey": false,
|
|
21
|
+
"notNull": true
|
|
22
|
+
},
|
|
23
|
+
"description": {
|
|
24
|
+
"name": "description",
|
|
25
|
+
"type": "text",
|
|
26
|
+
"primaryKey": false,
|
|
27
|
+
"notNull": true
|
|
28
|
+
},
|
|
29
|
+
"owner_plugin": {
|
|
30
|
+
"name": "owner_plugin",
|
|
31
|
+
"type": "text",
|
|
32
|
+
"primaryKey": false,
|
|
33
|
+
"notNull": true
|
|
34
|
+
},
|
|
35
|
+
"created_at": {
|
|
36
|
+
"name": "created_at",
|
|
37
|
+
"type": "timestamp",
|
|
38
|
+
"primaryKey": false,
|
|
39
|
+
"notNull": true,
|
|
40
|
+
"default": "now()"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"indexes": {},
|
|
44
|
+
"foreignKeys": {},
|
|
45
|
+
"compositePrimaryKeys": {},
|
|
46
|
+
"uniqueConstraints": {},
|
|
47
|
+
"policies": {},
|
|
48
|
+
"checkConstraints": {},
|
|
49
|
+
"isRLSEnabled": false
|
|
50
|
+
},
|
|
51
|
+
"public.notification_subscriptions": {
|
|
52
|
+
"name": "notification_subscriptions",
|
|
53
|
+
"schema": "",
|
|
54
|
+
"columns": {
|
|
55
|
+
"user_id": {
|
|
56
|
+
"name": "user_id",
|
|
57
|
+
"type": "text",
|
|
58
|
+
"primaryKey": false,
|
|
59
|
+
"notNull": true
|
|
60
|
+
},
|
|
61
|
+
"group_id": {
|
|
62
|
+
"name": "group_id",
|
|
63
|
+
"type": "text",
|
|
64
|
+
"primaryKey": false,
|
|
65
|
+
"notNull": true
|
|
66
|
+
},
|
|
67
|
+
"subscribed_at": {
|
|
68
|
+
"name": "subscribed_at",
|
|
69
|
+
"type": "timestamp",
|
|
70
|
+
"primaryKey": false,
|
|
71
|
+
"notNull": true,
|
|
72
|
+
"default": "now()"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"indexes": {},
|
|
76
|
+
"foreignKeys": {
|
|
77
|
+
"notification_subscriptions_group_id_notification_groups_id_fk": {
|
|
78
|
+
"name": "notification_subscriptions_group_id_notification_groups_id_fk",
|
|
79
|
+
"tableFrom": "notification_subscriptions",
|
|
80
|
+
"tableTo": "notification_groups",
|
|
81
|
+
"columnsFrom": [
|
|
82
|
+
"group_id"
|
|
83
|
+
],
|
|
84
|
+
"columnsTo": [
|
|
85
|
+
"id"
|
|
86
|
+
],
|
|
87
|
+
"onDelete": "cascade",
|
|
88
|
+
"onUpdate": "no action"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"compositePrimaryKeys": {
|
|
92
|
+
"notification_subscriptions_user_id_group_id_pk": {
|
|
93
|
+
"name": "notification_subscriptions_user_id_group_id_pk",
|
|
94
|
+
"columns": [
|
|
95
|
+
"user_id",
|
|
96
|
+
"group_id"
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"uniqueConstraints": {},
|
|
101
|
+
"policies": {},
|
|
102
|
+
"checkConstraints": {},
|
|
103
|
+
"isRLSEnabled": false
|
|
104
|
+
},
|
|
105
|
+
"public.notifications": {
|
|
106
|
+
"name": "notifications",
|
|
107
|
+
"schema": "",
|
|
108
|
+
"columns": {
|
|
109
|
+
"id": {
|
|
110
|
+
"name": "id",
|
|
111
|
+
"type": "uuid",
|
|
112
|
+
"primaryKey": true,
|
|
113
|
+
"notNull": true,
|
|
114
|
+
"default": "gen_random_uuid()"
|
|
115
|
+
},
|
|
116
|
+
"user_id": {
|
|
117
|
+
"name": "user_id",
|
|
118
|
+
"type": "text",
|
|
119
|
+
"primaryKey": false,
|
|
120
|
+
"notNull": true
|
|
121
|
+
},
|
|
122
|
+
"title": {
|
|
123
|
+
"name": "title",
|
|
124
|
+
"type": "text",
|
|
125
|
+
"primaryKey": false,
|
|
126
|
+
"notNull": true
|
|
127
|
+
},
|
|
128
|
+
"description": {
|
|
129
|
+
"name": "description",
|
|
130
|
+
"type": "text",
|
|
131
|
+
"primaryKey": false,
|
|
132
|
+
"notNull": true
|
|
133
|
+
},
|
|
134
|
+
"actions": {
|
|
135
|
+
"name": "actions",
|
|
136
|
+
"type": "jsonb",
|
|
137
|
+
"primaryKey": false,
|
|
138
|
+
"notNull": false
|
|
139
|
+
},
|
|
140
|
+
"importance": {
|
|
141
|
+
"name": "importance",
|
|
142
|
+
"type": "text",
|
|
143
|
+
"primaryKey": false,
|
|
144
|
+
"notNull": true,
|
|
145
|
+
"default": "'info'"
|
|
146
|
+
},
|
|
147
|
+
"is_read": {
|
|
148
|
+
"name": "is_read",
|
|
149
|
+
"type": "boolean",
|
|
150
|
+
"primaryKey": false,
|
|
151
|
+
"notNull": true,
|
|
152
|
+
"default": false
|
|
153
|
+
},
|
|
154
|
+
"group_id": {
|
|
155
|
+
"name": "group_id",
|
|
156
|
+
"type": "text",
|
|
157
|
+
"primaryKey": false,
|
|
158
|
+
"notNull": false
|
|
159
|
+
},
|
|
160
|
+
"created_at": {
|
|
161
|
+
"name": "created_at",
|
|
162
|
+
"type": "timestamp",
|
|
163
|
+
"primaryKey": false,
|
|
164
|
+
"notNull": true,
|
|
165
|
+
"default": "now()"
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"indexes": {},
|
|
169
|
+
"foreignKeys": {},
|
|
170
|
+
"compositePrimaryKeys": {},
|
|
171
|
+
"uniqueConstraints": {},
|
|
172
|
+
"policies": {},
|
|
173
|
+
"checkConstraints": {},
|
|
174
|
+
"isRLSEnabled": false
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"enums": {},
|
|
178
|
+
"schemas": {},
|
|
179
|
+
"sequences": {},
|
|
180
|
+
"roles": {},
|
|
181
|
+
"policies": {},
|
|
182
|
+
"views": {},
|
|
183
|
+
"_meta": {
|
|
184
|
+
"columns": {},
|
|
185
|
+
"schemas": {},
|
|
186
|
+
"tables": {}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "48c3ed25-41a5-4baa-a7e4-59cdc42c7486",
|
|
3
|
+
"prevId": "3c779341-b676-429f-a7b3-a8e08728f95a",
|
|
4
|
+
"version": "7",
|
|
5
|
+
"dialect": "postgresql",
|
|
6
|
+
"tables": {
|
|
7
|
+
"public.notification_groups": {
|
|
8
|
+
"name": "notification_groups",
|
|
9
|
+
"schema": "",
|
|
10
|
+
"columns": {
|
|
11
|
+
"id": {
|
|
12
|
+
"name": "id",
|
|
13
|
+
"type": "text",
|
|
14
|
+
"primaryKey": true,
|
|
15
|
+
"notNull": true
|
|
16
|
+
},
|
|
17
|
+
"name": {
|
|
18
|
+
"name": "name",
|
|
19
|
+
"type": "text",
|
|
20
|
+
"primaryKey": false,
|
|
21
|
+
"notNull": true
|
|
22
|
+
},
|
|
23
|
+
"description": {
|
|
24
|
+
"name": "description",
|
|
25
|
+
"type": "text",
|
|
26
|
+
"primaryKey": false,
|
|
27
|
+
"notNull": true
|
|
28
|
+
},
|
|
29
|
+
"owner_plugin": {
|
|
30
|
+
"name": "owner_plugin",
|
|
31
|
+
"type": "text",
|
|
32
|
+
"primaryKey": false,
|
|
33
|
+
"notNull": true
|
|
34
|
+
},
|
|
35
|
+
"created_at": {
|
|
36
|
+
"name": "created_at",
|
|
37
|
+
"type": "timestamp",
|
|
38
|
+
"primaryKey": false,
|
|
39
|
+
"notNull": true,
|
|
40
|
+
"default": "now()"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"indexes": {},
|
|
44
|
+
"foreignKeys": {},
|
|
45
|
+
"compositePrimaryKeys": {},
|
|
46
|
+
"uniqueConstraints": {},
|
|
47
|
+
"policies": {},
|
|
48
|
+
"checkConstraints": {},
|
|
49
|
+
"isRLSEnabled": false
|
|
50
|
+
},
|
|
51
|
+
"public.notification_subscriptions": {
|
|
52
|
+
"name": "notification_subscriptions",
|
|
53
|
+
"schema": "",
|
|
54
|
+
"columns": {
|
|
55
|
+
"user_id": {
|
|
56
|
+
"name": "user_id",
|
|
57
|
+
"type": "text",
|
|
58
|
+
"primaryKey": false,
|
|
59
|
+
"notNull": true
|
|
60
|
+
},
|
|
61
|
+
"group_id": {
|
|
62
|
+
"name": "group_id",
|
|
63
|
+
"type": "text",
|
|
64
|
+
"primaryKey": false,
|
|
65
|
+
"notNull": true
|
|
66
|
+
},
|
|
67
|
+
"subscribed_at": {
|
|
68
|
+
"name": "subscribed_at",
|
|
69
|
+
"type": "timestamp",
|
|
70
|
+
"primaryKey": false,
|
|
71
|
+
"notNull": true,
|
|
72
|
+
"default": "now()"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"indexes": {},
|
|
76
|
+
"foreignKeys": {
|
|
77
|
+
"notification_subscriptions_group_id_notification_groups_id_fk": {
|
|
78
|
+
"name": "notification_subscriptions_group_id_notification_groups_id_fk",
|
|
79
|
+
"tableFrom": "notification_subscriptions",
|
|
80
|
+
"tableTo": "notification_groups",
|
|
81
|
+
"columnsFrom": [
|
|
82
|
+
"group_id"
|
|
83
|
+
],
|
|
84
|
+
"columnsTo": [
|
|
85
|
+
"id"
|
|
86
|
+
],
|
|
87
|
+
"onDelete": "cascade",
|
|
88
|
+
"onUpdate": "no action"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"compositePrimaryKeys": {
|
|
92
|
+
"notification_subscriptions_user_id_group_id_pk": {
|
|
93
|
+
"name": "notification_subscriptions_user_id_group_id_pk",
|
|
94
|
+
"columns": [
|
|
95
|
+
"user_id",
|
|
96
|
+
"group_id"
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"uniqueConstraints": {},
|
|
101
|
+
"policies": {},
|
|
102
|
+
"checkConstraints": {},
|
|
103
|
+
"isRLSEnabled": false
|
|
104
|
+
},
|
|
105
|
+
"public.notifications": {
|
|
106
|
+
"name": "notifications",
|
|
107
|
+
"schema": "",
|
|
108
|
+
"columns": {
|
|
109
|
+
"id": {
|
|
110
|
+
"name": "id",
|
|
111
|
+
"type": "uuid",
|
|
112
|
+
"primaryKey": true,
|
|
113
|
+
"notNull": true,
|
|
114
|
+
"default": "gen_random_uuid()"
|
|
115
|
+
},
|
|
116
|
+
"user_id": {
|
|
117
|
+
"name": "user_id",
|
|
118
|
+
"type": "text",
|
|
119
|
+
"primaryKey": false,
|
|
120
|
+
"notNull": true
|
|
121
|
+
},
|
|
122
|
+
"title": {
|
|
123
|
+
"name": "title",
|
|
124
|
+
"type": "text",
|
|
125
|
+
"primaryKey": false,
|
|
126
|
+
"notNull": true
|
|
127
|
+
},
|
|
128
|
+
"description": {
|
|
129
|
+
"name": "description",
|
|
130
|
+
"type": "text",
|
|
131
|
+
"primaryKey": false,
|
|
132
|
+
"notNull": true
|
|
133
|
+
},
|
|
134
|
+
"actions": {
|
|
135
|
+
"name": "actions",
|
|
136
|
+
"type": "jsonb",
|
|
137
|
+
"primaryKey": false,
|
|
138
|
+
"notNull": false
|
|
139
|
+
},
|
|
140
|
+
"importance": {
|
|
141
|
+
"name": "importance",
|
|
142
|
+
"type": "text",
|
|
143
|
+
"primaryKey": false,
|
|
144
|
+
"notNull": true,
|
|
145
|
+
"default": "'info'"
|
|
146
|
+
},
|
|
147
|
+
"is_read": {
|
|
148
|
+
"name": "is_read",
|
|
149
|
+
"type": "boolean",
|
|
150
|
+
"primaryKey": false,
|
|
151
|
+
"notNull": true,
|
|
152
|
+
"default": false
|
|
153
|
+
},
|
|
154
|
+
"group_id": {
|
|
155
|
+
"name": "group_id",
|
|
156
|
+
"type": "text",
|
|
157
|
+
"primaryKey": false,
|
|
158
|
+
"notNull": false
|
|
159
|
+
},
|
|
160
|
+
"created_at": {
|
|
161
|
+
"name": "created_at",
|
|
162
|
+
"type": "timestamp",
|
|
163
|
+
"primaryKey": false,
|
|
164
|
+
"notNull": true,
|
|
165
|
+
"default": "now()"
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"indexes": {},
|
|
169
|
+
"foreignKeys": {},
|
|
170
|
+
"compositePrimaryKeys": {},
|
|
171
|
+
"uniqueConstraints": {},
|
|
172
|
+
"policies": {},
|
|
173
|
+
"checkConstraints": {},
|
|
174
|
+
"isRLSEnabled": false
|
|
175
|
+
},
|
|
176
|
+
"public.user_notification_preferences": {
|
|
177
|
+
"name": "user_notification_preferences",
|
|
178
|
+
"schema": "",
|
|
179
|
+
"columns": {
|
|
180
|
+
"user_id": {
|
|
181
|
+
"name": "user_id",
|
|
182
|
+
"type": "text",
|
|
183
|
+
"primaryKey": false,
|
|
184
|
+
"notNull": true
|
|
185
|
+
},
|
|
186
|
+
"strategy_id": {
|
|
187
|
+
"name": "strategy_id",
|
|
188
|
+
"type": "text",
|
|
189
|
+
"primaryKey": false,
|
|
190
|
+
"notNull": true
|
|
191
|
+
},
|
|
192
|
+
"config": {
|
|
193
|
+
"name": "config",
|
|
194
|
+
"type": "jsonb",
|
|
195
|
+
"primaryKey": false,
|
|
196
|
+
"notNull": false
|
|
197
|
+
},
|
|
198
|
+
"enabled": {
|
|
199
|
+
"name": "enabled",
|
|
200
|
+
"type": "boolean",
|
|
201
|
+
"primaryKey": false,
|
|
202
|
+
"notNull": true,
|
|
203
|
+
"default": true
|
|
204
|
+
},
|
|
205
|
+
"external_id": {
|
|
206
|
+
"name": "external_id",
|
|
207
|
+
"type": "text",
|
|
208
|
+
"primaryKey": false,
|
|
209
|
+
"notNull": false
|
|
210
|
+
},
|
|
211
|
+
"linked_at": {
|
|
212
|
+
"name": "linked_at",
|
|
213
|
+
"type": "timestamp",
|
|
214
|
+
"primaryKey": false,
|
|
215
|
+
"notNull": false
|
|
216
|
+
},
|
|
217
|
+
"created_at": {
|
|
218
|
+
"name": "created_at",
|
|
219
|
+
"type": "timestamp",
|
|
220
|
+
"primaryKey": false,
|
|
221
|
+
"notNull": true,
|
|
222
|
+
"default": "now()"
|
|
223
|
+
},
|
|
224
|
+
"updated_at": {
|
|
225
|
+
"name": "updated_at",
|
|
226
|
+
"type": "timestamp",
|
|
227
|
+
"primaryKey": false,
|
|
228
|
+
"notNull": true,
|
|
229
|
+
"default": "now()"
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
"indexes": {},
|
|
233
|
+
"foreignKeys": {},
|
|
234
|
+
"compositePrimaryKeys": {
|
|
235
|
+
"user_notification_preferences_user_id_strategy_id_pk": {
|
|
236
|
+
"name": "user_notification_preferences_user_id_strategy_id_pk",
|
|
237
|
+
"columns": [
|
|
238
|
+
"user_id",
|
|
239
|
+
"strategy_id"
|
|
240
|
+
]
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
"uniqueConstraints": {},
|
|
244
|
+
"policies": {},
|
|
245
|
+
"checkConstraints": {},
|
|
246
|
+
"isRLSEnabled": false
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
"enums": {},
|
|
250
|
+
"schemas": {},
|
|
251
|
+
"sequences": {},
|
|
252
|
+
"roles": {},
|
|
253
|
+
"policies": {},
|
|
254
|
+
"views": {},
|
|
255
|
+
"_meta": {
|
|
256
|
+
"columns": {},
|
|
257
|
+
"schemas": {},
|
|
258
|
+
"tables": {}
|
|
259
|
+
}
|
|
260
|
+
}
|