diff --git a/tests/sandbox/configs/all-the-things.ts b/tests/sandbox/configs/all-the-things.ts index 3c24ccaffbb..6ae9b9686f1 100644 --- a/tests/sandbox/configs/all-the-things.ts +++ b/tests/sandbox/configs/all-the-things.ts @@ -1,28 +1,30 @@ import { list, graphql, config, group } from '@keystone-6/core' import { allowAll } from '@keystone-6/core/access' import { + bigInt, + calendarDay, checkbox, + decimal, + file, + float, + image, + integer, + json, + multiselect, password, relationship, + select, text, timestamp, - file, virtual, - select, - json, - integer, - image, - float, - bigInt, - calendarDay, - multiselect, } from '@keystone-6/core/fields' import { document, structure } from '@keystone-6/fields-document' import { componentBlocks } from '../component-blocks' import { schema as structureSchema } from '../structure' import { schema as structureNestedSchema } from '../structure-nested' import { schema as structureRelationshipsSchema } from '../structure-relationships' -import { dbConfig, localStorageConfig, trackingFields } from '../utils' +import { localStorageConfig, trackingFields } from '../utils' +// import { type Lists } from '.keystone/types' // TODO const description = 'Some thing to describe to test the length of the text for width, blah blah blah blah blah blah blah blah blah' @@ -152,6 +154,11 @@ export const lists = { }), json: json({ ui: { description } }), integer: integer({ ui: { description } }), + decimal: decimal({ + precision: 32, + scale: 8, + ui: { description } + }), bigInt: bigInt({ isIndexed: 'unique', ui: { description } }), float: float({ ui: { description } }), image: image({ ui: { description }, storage: 'images' }), @@ -222,7 +229,10 @@ export const lists = { } export default config({ - db: dbConfig, + db: { + provider: 'postgresql', + url: process.env.DATABASE_URL ?? '' + }, storage: localStorageConfig, lists, }) diff --git a/tests/sandbox/schema.graphql b/tests/sandbox/schema.graphql index 94412dbd4c2..6bf41715e93 100644 --- a/tests/sandbox/schema.graphql +++ b/tests/sandbox/schema.graphql @@ -26,6 +26,7 @@ type Thing { multiselect: [String!] json: JSON integer: Int + decimal: Decimal bigInt: BigInt float: Float image: ImageFieldOutput @@ -65,6 +66,8 @@ type PasswordState { scalar CalendarDay @specifiedBy(url: "https://datatracker.ietf.org/doc/html/rfc3339#section-5.6") +scalar Decimal + scalar BigInt type ImageFieldOutput { @@ -138,6 +141,7 @@ input ThingWhereInput { selectOnSideItemViewOnly: StringNullableFilter selectSegmentedControl: StringNullableFilter integer: IntNullableFilter + decimal: DecimalNullableFilter bigInt: BigIntNullableFilter float: FloatNullableFilter } @@ -164,9 +168,15 @@ input StringFilter { contains: String startsWith: String endsWith: String + mode: QueryMode not: NestedStringFilter } +enum QueryMode { + default + insensitive +} + input NestedStringFilter { equals: String in: [String!] @@ -229,6 +239,7 @@ input StringNullableFilter { contains: String startsWith: String endsWith: String + mode: QueryMode not: StringNullableFilter } @@ -243,6 +254,17 @@ input IntNullableFilter { not: IntNullableFilter } +input DecimalNullableFilter { + equals: Decimal + in: [Decimal!] + notIn: [Decimal!] + lt: Decimal + lte: Decimal + gt: Decimal + gte: Decimal + not: DecimalNullableFilter +} + input BigIntNullableFilter { equals: BigInt in: [BigInt!] @@ -276,6 +298,7 @@ input ThingOrderByInput { selectOnSideItemViewOnly: OrderDirection selectSegmentedControl: OrderDirection integer: OrderDirection + decimal: OrderDirection bigInt: OrderDirection float: OrderDirection } @@ -306,6 +329,7 @@ input ThingUpdateInput { multiselect: [String!] json: JSON integer: Int + decimal: Decimal bigInt: BigInt float: Float image: ImageFieldInput @@ -389,6 +413,7 @@ input ThingCreateInput { multiselect: [String!] json: JSON integer: Int + decimal: Decimal bigInt: BigInt float: Float image: ImageFieldInput @@ -732,11 +757,6 @@ enum KeystoneAdminUIFieldMetaItemViewFieldPosition { sidebar } -enum QueryMode { - default - insensitive -} - type KeystoneAdminUIFieldGroupMeta { label: String! description: String diff --git a/tests/sandbox/schema.prisma b/tests/sandbox/schema.prisma index f0406ea1872..f58d7e80c27 100644 --- a/tests/sandbox/schema.prisma +++ b/tests/sandbox/schema.prisma @@ -1,24 +1,23 @@ // This file is automatically generated by Keystone, do not modify it manually. // Modify your Keystone config when you want to change this. -datasource sqlite { +datasource postgresql { url = env("DATABASE_URL") shadowDatabaseUrl = env("SHADOW_DATABASE_URL") - provider = "sqlite" + provider = "postgresql" } generator client { provider = "prisma-client-js" - output = "node_modules/.testprisma/client" } model Thing { id String @id @default(cuid()) text String @default("") timestamp DateTime? - structure String @default("{\"integer\":0,\"array\":[]}") - structureNested String @default("[]") - structureRelationships String @default("[]") + structure Json @default("{\"integer\":0,\"array\":[]}") + structureNested Json @default("[]") + structureRelationships Json @default("[]") checkbox Boolean @default(false) password String? toOneRelationship User? @relation("Thing_toOneRelationship", fields: [toOneRelationshipId], references: [id]) @@ -29,14 +28,15 @@ model Thing { toOneRelationshipCard User? @relation("Thing_toOneRelationshipCard", fields: [toOneRelationshipCardId], references: [id]) toOneRelationshipCardId String? @map("toOneRelationshipCard") toManyRelationshipCard Todo[] @relation("Thing_toManyRelationshipCard") - calendarDay String? + calendarDay DateTime? @postgresql.Date select String? selectOnSide String? selectOnSideItemViewOnly String? selectSegmentedControl String? - multiselect String @default("[]") - json String? + multiselect Json @default("[]") + json Json? integer Int? + decimal Decimal? @postgresql.Decimal(32, 8) bigInt BigInt? @unique float Float? image_filesize Int? @@ -46,7 +46,7 @@ model Thing { image_id String? file_filesize Int? file_filename String? - document String @default("[{\"type\":\"paragraph\",\"children\":[{\"text\":\"\"}]}]") + document Json @default("[{\"type\":\"paragraph\",\"children\":[{\"text\":\"\"}]}]") @@index([toOneRelationshipId]) @@index([toOneRelationshipAlternateLabelId])