Skip to content

Commit

Permalink
🗃️ Add updatedAt fields where missing
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Feb 3, 2023
1 parent bf60728 commit 0b34321
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 29 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ dump.tar
__env.js

typebotsToFix.json
**/scripts/logs
**/scripts/logs

snapshots
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down
39 changes: 27 additions & 12 deletions apps/docs/openapi/builder/_spec_.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -195,8 +199,9 @@
},
"required": [
"id",
"name",
"createdAt",
"updatedAt",
"name",
"icon",
"plan",
"stripeId",
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -331,8 +340,9 @@
},
"required": [
"id",
"name",
"createdAt",
"updatedAt",
"name",
"icon",
"plan",
"stripeId",
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -484,8 +498,9 @@
},
"required": [
"id",
"name",
"createdAt",
"updatedAt",
"name",
"icon",
"plan",
"stripeId",
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
24 changes: 15 additions & 9 deletions packages/db/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -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[]
Expand All @@ -92,6 +92,8 @@ model Workspace {
}

model MemberInWorkspace {
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
userId String
workspaceId String
role WorkspaceRole
Expand All @@ -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
Expand Down Expand Up @@ -180,6 +183,7 @@ model Typebot {

model Invitation {
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
email String
typebotId String
type CollaborationType
Expand All @@ -189,6 +193,8 @@ model Invitation {
}

model CollaboratorsOnTypebots {
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
userId String
typebotId String
type CollaborationType
Expand Down Expand Up @@ -240,7 +246,7 @@ model Log {
}

model Answer {
createdAt DateTime @default(now())
createdAt DateTime @default(now()) @updatedAt
resultId String
blockId String
groupId String
Expand Down
1 change: 1 addition & 0 deletions packages/models/features/answer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const answerInputSchema =
answerSchema
.omit({
createdAt: true,
updatedAt: true,
resultId: true,
variableId: true,
storageUsed: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/models/features/webhooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [],
Expand Down
8 changes: 5 additions & 3 deletions packages/models/features/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'>
}
>()(
Expand All @@ -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(),
Expand Down

3 comments on commit 0b34321

@vercel
Copy link

@vercel vercel bot commented on 0b34321 Feb 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

app.typebot.io
builder-v2-typebot-io.vercel.app
builder-v2-git-main-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 0b34321 Feb 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

viewer-v2 – ./apps/viewer

stan.vselise.com
start.taxtree.io
typebot.aloe.bot
voicehelp.cr8.ai
zap.fundviser.in
app.chatforms.net
bot.hostnation.de
bot.maitempah.com
bot.phuonghub.com
bot.reviewzer.com
bot.rihabilita.it
cares.urlabout.me
chat.gaswadern.de
fmm.wpwakanda.com
gentleman-shop.fr
k1.kandabrand.com
lb.ticketfute.com
ov1.wpwakanda.com
ov2.wpwakanda.com
ov3.wpwakanda.com
support.triplo.ai
viewer.typebot.io
1988.bouclidom.com
andreimayer.com.br
bot.danyservice.it
bot.iconicbrows.it
bot.megafox.com.br
bot.neferlopez.com
bots.robomotion.io
cadu.uninta.edu.br
dicanatural.online
digitalhelp.com.au
goalsettingbot.com
pant.maxbot.com.br
positivobra.com.br
survey.digienge.io
this-is-a-test.com
zap.techadviser.in
bot.boston-voip.com
bot.cabinpromos.com
bot.digitalbled.com
bot.dsignagency.com
bot.eventhub.com.au
bot.jepierre.com.br
bot.viralsangat.com
bot.upgradesolutions.eu
bots.baptiste-arnaud.fr
help.comebackreward.com
link.venturasuceder.com
mainmenu.diddancing.com
manualhandlingcourse.ie
register.kandabrand.com
signup.hypemarketing.in
subfooter.wpwakanda.com
survey.hypemarketing.in
testbot.afterorigin.com
91181264.your-access.one
homepageonly.wpwakanda.com
liveconvert.kandalearn.com
mainmenu1one.wpwakanda.com
tarian.theiofoundation.org
ted.meujalecobrasil.com.br
type.dericsoncalari.com.br
bot.pinpointinteractive.com
bot.polychromes-project.com
bot.seidinembroseanchetu.it
chatbot.berbelanjabiz.trade
designguide.techyscouts.com
liveconvert2.kandalearn.com
presente.empresarias.com.mx
sell.sellthemotorhome.co.uk
anamnese.odontopavani.com.br
austin.channelautomation.com
bot.marketingplusmindset.com
bot.seidibergamoseanchetu.it
desabafe.sergiolimajr.com.br
download.venturemarketing.in
piazzatorre.barrettamario.it
type.cookieacademyonline.com
bot.brigadeirosemdrama.com.br
forms.escoladeautomacao.com.br
onboarding.libertydreamcare.ie
type.talitasouzamarques.com.br
agendamento.sergiolimajr.com.br
anamnese.clinicamegasjdr.com.br
bookings.littlepartymonkeys.com
bot.comercializadoraomicron.com
elevateyourmind.groovepages.com
viewer-v2-typebot-io.vercel.app
yourfeedback.comebackreward.com
gerador.verificadordehospedes.com
personal-trainer.barrettamario.it
preagendamento.sergiolimajr.com.br
studiotecnicoimmobiliaremerelli.it
download.thailandmicespecialist.com
register.thailandmicespecialist.com
bot.studiotecnicoimmobiliaremerelli.it
pesquisa.escolamodacomproposito.com.br
anamnese.clinicaramosodontologia.com.br
viewer-v2-git-main-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 0b34321 Feb 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./apps/docs

docs.typebot.io
docs-git-main-typebot-io.vercel.app
docs-typebot-io.vercel.app

Please sign in to comment.