mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 05:19:49 +00:00
Make some notifications be scoped to certain orgs to prevent redirect
issues.
This commit is contained in:
@@ -9,6 +9,7 @@ export async function up(knex: Knex): Promise<void> {
|
||||
.createTable(TableName.UserNotifications, (t) => {
|
||||
t.uuid("id").defaultTo(knex.fn.uuid());
|
||||
t.uuid("userId").notNullable();
|
||||
t.uuid("orgId").nullable();
|
||||
|
||||
t.string("type").notNullable();
|
||||
t.string("title").notNullable(); // Markdown
|
||||
@@ -32,10 +33,11 @@ export async function up(knex: Knex): Promise<void> {
|
||||
|
||||
await knex.schema.alterTable(TableName.UserNotifications, (t) => {
|
||||
t.foreign("userId").references("id").inTable(TableName.Users).onDelete("CASCADE");
|
||||
t.foreign("orgId").references("id").inTable(TableName.Organization).onDelete("CASCADE");
|
||||
|
||||
t.index("type");
|
||||
t.index(["userId", "isRead"]);
|
||||
t.index(["userId", "createdAt"]);
|
||||
t.index(["userId", "createdAt", "orgId"]);
|
||||
});
|
||||
|
||||
await createOnUpdateTrigger(knex, TableName.UserNotifications);
|
||||
|
||||
@@ -10,6 +10,7 @@ import { TImmutableDBKeys } from "./models";
|
||||
export const UserNotificationsSchema = z.object({
|
||||
id: z.string().uuid(),
|
||||
userId: z.string().uuid(),
|
||||
orgId: z.string().uuid().nullable().optional(),
|
||||
type: z.string(),
|
||||
title: z.string(),
|
||||
body: z.string().nullable().optional(),
|
||||
|
||||
Reference in New Issue
Block a user