🗃️ Add updatedAt fields where missing
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@ -32,4 +32,6 @@ dump.tar
|
||||
__env.js
|
||||
|
||||
typebotsToFix.json
|
||||
**/scripts/logs
|
||||
**/scripts/logs
|
||||
|
||||
snapshots
|
@ -4,7 +4,7 @@ import { sendRequest } from 'utils'
|
||||
export const updateCollaboratorQuery = (
|
||||
typebotId: string,
|
||||
userId: string,
|
||||
collaborator: CollaboratorsOnTypebots
|
||||
collaborator: Omit<CollaboratorsOnTypebots, 'createdAt' | 'updatedAt'>
|
||||
) =>
|
||||
sendRequest({
|
||||
method: 'PATCH',
|
||||
|
@ -4,7 +4,7 @@ import { sendRequest } from 'utils'
|
||||
export const updateInvitationQuery = (
|
||||
typebotId: string,
|
||||
email: string,
|
||||
invitation: Omit<Invitation, 'createdAt' | 'id'>
|
||||
invitation: Omit<Invitation, 'createdAt' | 'id' | 'updatedAt'>
|
||||
) =>
|
||||
sendRequest({
|
||||
method: 'PATCH',
|
||||
|
@ -3,7 +3,7 @@ import { sendRequest } from 'utils'
|
||||
import { Member } from '../types'
|
||||
|
||||
export const sendInvitationQuery = (
|
||||
invitation: Omit<WorkspaceInvitation, 'id' | 'createdAt'>
|
||||
invitation: Omit<WorkspaceInvitation, 'id' | 'createdAt' | 'updatedAt'>
|
||||
) =>
|
||||
sendRequest<{ invitation?: WorkspaceInvitation; member?: Member }>({
|
||||
url: `/api/workspaces/${invitation.workspaceId}/invitations`,
|
||||
|
@ -127,13 +127,17 @@
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"icon": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
@ -195,8 +199,9 @@
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"name",
|
||||
"createdAt",
|
||||
"updatedAt",
|
||||
"name",
|
||||
"icon",
|
||||
"plan",
|
||||
"stripeId",
|
||||
@ -263,13 +268,17 @@
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"icon": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
@ -331,8 +340,9 @@
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"name",
|
||||
"createdAt",
|
||||
"updatedAt",
|
||||
"name",
|
||||
"icon",
|
||||
"plan",
|
||||
"stripeId",
|
||||
@ -416,13 +426,17 @@
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"icon": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
@ -484,8 +498,9 @@
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"name",
|
||||
"createdAt",
|
||||
"updatedAt",
|
||||
"name",
|
||||
"icon",
|
||||
"plan",
|
||||
"stripeId",
|
||||
|
@ -0,0 +1,25 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `lastUsedAt` on the `ApiToken` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "ApiToken" DROP COLUMN "lastUsedAt";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "CollaboratorsOnTypebots" ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Invitation" ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "MemberInWorkspace" ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Workspace" ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "WorkspaceInvitation" ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
@ -57,20 +57,20 @@ model User {
|
||||
}
|
||||
|
||||
model ApiToken {
|
||||
id String @id @default(cuid())
|
||||
token String @unique
|
||||
name String
|
||||
ownerId String
|
||||
lastUsedAt DateTime @default(now())
|
||||
createdAt DateTime @default(now())
|
||||
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
token String @unique
|
||||
name String
|
||||
ownerId String
|
||||
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model Workspace {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
name String
|
||||
icon String?
|
||||
createdAt DateTime @default(now())
|
||||
plan Plan @default(FREE)
|
||||
stripeId String? @unique
|
||||
credentials Credentials[]
|
||||
@ -92,6 +92,8 @@ model Workspace {
|
||||
}
|
||||
|
||||
model MemberInWorkspace {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
userId String
|
||||
workspaceId String
|
||||
role WorkspaceRole
|
||||
@ -104,6 +106,7 @@ model MemberInWorkspace {
|
||||
model WorkspaceInvitation {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
email String
|
||||
workspaceId String
|
||||
type WorkspaceRole
|
||||
@ -180,6 +183,7 @@ model Typebot {
|
||||
|
||||
model Invitation {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
email String
|
||||
typebotId String
|
||||
type CollaborationType
|
||||
@ -189,6 +193,8 @@ model Invitation {
|
||||
}
|
||||
|
||||
model CollaboratorsOnTypebots {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
userId String
|
||||
typebotId String
|
||||
type CollaborationType
|
||||
@ -240,7 +246,7 @@ model Log {
|
||||
}
|
||||
|
||||
model Answer {
|
||||
createdAt DateTime @default(now())
|
||||
createdAt DateTime @default(now()) @updatedAt
|
||||
resultId String
|
||||
blockId String
|
||||
groupId String
|
||||
|
@ -19,6 +19,7 @@ export const answerInputSchema =
|
||||
answerSchema
|
||||
.omit({
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
resultId: true,
|
||||
variableId: true,
|
||||
storageUsed: true,
|
||||
|
@ -30,7 +30,7 @@ export type WebhookResponse = {
|
||||
|
||||
export const defaultWebhookAttributes: Omit<
|
||||
Webhook,
|
||||
'id' | 'body' | 'url' | 'typebotId'
|
||||
'id' | 'body' | 'url' | 'typebotId' | 'createdAt' | 'updatedAt'
|
||||
> = {
|
||||
method: HttpMethod.POST,
|
||||
headers: [],
|
||||
|
@ -10,7 +10,7 @@ import {
|
||||
} from 'db'
|
||||
|
||||
export const workspaceMemberSchema = schemaForType<
|
||||
Omit<MemberInWorkspacePrisma, 'userId'> & {
|
||||
Omit<MemberInWorkspacePrisma, 'userId' | 'createdAt' | 'updatedAt'> & {
|
||||
user: Pick<UserPrisma, 'name' | 'email' | 'image'>
|
||||
}
|
||||
>()(
|
||||
@ -29,17 +29,19 @@ export const workspaceInvitationSchema = schemaForType<
|
||||
Omit<WorkspaceInvitationPrisma, 'workspaceId' | 'userId' | 'id'>
|
||||
>()(
|
||||
z.object({
|
||||
createdAt: z.date(),
|
||||
updatedAt: z.date(),
|
||||
email: z.string(),
|
||||
type: z.nativeEnum(WorkspaceRole),
|
||||
createdAt: z.date(),
|
||||
})
|
||||
)
|
||||
|
||||
export const workspaceSchema = schemaForType<WorkspacePrisma>()(
|
||||
z.object({
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
createdAt: z.date(),
|
||||
updatedAt: z.date(),
|
||||
name: z.string(),
|
||||
icon: z.string().nullable(),
|
||||
plan: z.nativeEnum(Plan),
|
||||
stripeId: z.string().nullable(),
|
||||
|
Reference in New Issue
Block a user