feat: secrets expire either with time or views

This commit is contained in:
ShubhamPalriwala
2024-05-31 12:47:19 +05:30
parent e7d32b5f2d
commit 29b106c5bd
15 changed files with 88 additions and 134 deletions
@@ -8,8 +8,7 @@ export async function up(knex: Knex): Promise<void> {
await knex.schema.alterTable(TableName.SecretSharing, (t) => {
if (!hasExpiresAfterViewsColumn) {
t.integer("expiresAfterViews").nullable();
t.timestamp("expiresAt").nullable().alter();
t.integer("expiresAfterViews");
}
if (hasSecretNameColumn) {
@@ -25,7 +24,6 @@ export async function down(knex: Knex): Promise<void> {
await knex.schema.alterTable(TableName.SecretSharing, (t) => {
if (hasExpiresAfterViewsColumn) {
t.dropColumn("expiresAfterViews");
t.timestamp("expiresAt").notNullable().alter();
}
if (!hasSecretNameColumn) {
+1 -1
View File
@@ -13,7 +13,7 @@ export const SecretSharingSchema = z.object({
iv: z.string(),
tag: z.string(),
hashedHex: z.string(),
expiresAt: z.date().nullable().optional(),
expiresAt: z.date(),
userId: z.string().uuid(),
orgId: z.string().uuid(),
createdAt: z.date(),