2
0

🚸 (editor) Add graph gesture notification

This commit is contained in:
Baptiste Arnaud
2024-01-24 10:15:40 +01:00
parent d85a03f621
commit bf6c258edc
17 changed files with 154 additions and 59 deletions

View File

@@ -1,4 +1,5 @@
import { User } from '@typebot.io/prisma'
import { graphGestureNotficationKey } from '@typebot.io/schemas/features/user/constants'
export const mockedUser: User = {
id: 'userId',
@@ -13,4 +14,7 @@ export const mockedUser: User = {
lastActivityAt: new Date('2022-01-01'),
onboardingCategories: [],
updatedAt: new Date('2022-01-01'),
displayedInAppNotifications: {
[graphGestureNotficationKey]: true,
},
}

View File

@@ -144,6 +144,8 @@ export const updateUser = (data: Partial<User>) =>
data: {
...data,
onboardingCategories: data.onboardingCategories ?? [],
displayedInAppNotifications:
data.displayedInAppNotifications ?? Prisma.DbNull,
},
where: {
id: userId,

View File

@@ -41,24 +41,25 @@ model Session {
}
model User {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
lastActivityAt DateTime @default(now())
name String? @db.VarChar(255)
email String? @unique
emailVerified DateTime?
image String? @db.VarChar(1000)
company String?
onboardingCategories Json
graphNavigation GraphNavigation?
preferredAppAppearance String?
accounts Account[]
apiTokens ApiToken[]
CollaboratorsOnTypebots CollaboratorsOnTypebots[]
workspaces MemberInWorkspace[]
sessions Session[]
bannedIps BannedIp[]
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
lastActivityAt DateTime @default(now())
name String? @db.VarChar(255)
email String? @unique
emailVerified DateTime?
image String? @db.VarChar(1000)
company String?
onboardingCategories Json
graphNavigation GraphNavigation?
preferredAppAppearance String?
accounts Account[]
apiTokens ApiToken[]
CollaboratorsOnTypebots CollaboratorsOnTypebots[]
workspaces MemberInWorkspace[]
sessions Session[]
bannedIps BannedIp[]
displayedInAppNotifications Json?
}
model ApiToken {

View File

@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "User" ADD COLUMN "displayedInAppNotifications" JSONB;

View File

@@ -37,24 +37,25 @@ model Session {
}
model User {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
lastActivityAt DateTime @default(now())
name String?
email String? @unique
emailVerified DateTime?
image String?
company String?
onboardingCategories Json
graphNavigation GraphNavigation?
preferredAppAppearance String?
accounts Account[]
apiTokens ApiToken[]
CollaboratorsOnTypebots CollaboratorsOnTypebots[]
workspaces MemberInWorkspace[]
sessions Session[]
bannedIps BannedIp[]
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
lastActivityAt DateTime @default(now())
name String?
email String? @unique
emailVerified DateTime?
image String?
company String?
onboardingCategories Json
graphNavigation GraphNavigation?
preferredAppAppearance String?
accounts Account[]
apiTokens ApiToken[]
CollaboratorsOnTypebots CollaboratorsOnTypebots[]
workspaces MemberInWorkspace[]
sessions Session[]
bannedIps BannedIp[]
displayedInAppNotifications Json?
}
model ApiToken {

View File

@@ -0,0 +1 @@
export const graphGestureNotficationKey = 'graphGestureNotification'

View File

@@ -0,0 +1,22 @@
import { GraphNavigation, User as PrismaUser } from '@typebot.io/prisma'
import { z } from '../../zod'
const displayedInAppNotificationsSchema = z.record(z.boolean())
export const userSchema = z.object({
id: z.string(),
createdAt: z.date(),
updatedAt: z.date(),
lastActivityAt: z.date(),
name: z.string().nullable(),
email: z.string().nullable(),
emailVerified: z.date().nullable(),
image: z.string().nullable(),
company: z.string().nullable(),
onboardingCategories: z.array(z.string()),
graphNavigation: z.nativeEnum(GraphNavigation),
preferredAppAppearance: z.string().nullable(),
displayedInAppNotifications: displayedInAppNotificationsSchema.nullable(),
}) satisfies z.ZodType<PrismaUser>
export type User = z.infer<typeof userSchema>

View File

@@ -13,3 +13,4 @@ export * from './features/workspace'
export * from './features/items'
export * from './features/analytics'
export * from './features/events'
export * from './features/user/schema'

View File

@@ -18,6 +18,7 @@ const inspectUser = async () => {
},
select: {
name: true,
createdAt: true,
lastActivityAt: true,
company: true,
onboardingCategories: true,