🚸 (editor) Add graph gesture notification
This commit is contained in:
@@ -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,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -144,6 +144,8 @@ export const updateUser = (data: Partial<User>) =>
|
||||
data: {
|
||||
...data,
|
||||
onboardingCategories: data.onboardingCategories ?? [],
|
||||
displayedInAppNotifications:
|
||||
data.displayedInAppNotifications ?? Prisma.DbNull,
|
||||
},
|
||||
where: {
|
||||
id: userId,
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" ADD COLUMN "displayedInAppNotifications" JSONB;
|
||||
@@ -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 {
|
||||
|
||||
1
packages/schemas/features/user/constants.ts
Normal file
1
packages/schemas/features/user/constants.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const graphGestureNotficationKey = 'graphGestureNotification'
|
||||
22
packages/schemas/features/user/schema.ts
Normal file
22
packages/schemas/features/user/schema.ts
Normal 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>
|
||||
@@ -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'
|
||||
|
||||
@@ -18,6 +18,7 @@ const inspectUser = async () => {
|
||||
},
|
||||
select: {
|
||||
name: true,
|
||||
createdAt: true,
|
||||
lastActivityAt: true,
|
||||
company: true,
|
||||
onboardingCategories: true,
|
||||
|
||||
Reference in New Issue
Block a user