From ecee51fdae64024558c5d01f9bec34e8c0fe956c Mon Sep 17 00:00:00 2001 From: "Kalle (Sendou)" <38327916+Sendouc@users.noreply.github.com> Date: Wed, 28 Oct 2020 23:22:25 +0200 Subject: [PATCH] migration add x rank placements --- components/WeaponSelector.tsx | 5 +- graphql/schema/user.ts | 19 +- package-lock.json | 257 +++----- package.json | 11 +- .../migrations/20201013141255-init/README.md | 77 --- .../20201013141255-init/schema.prisma | 30 - .../migrations/20201013141255-init/steps.json | 255 -------- .../migrations/20201017224027-init/README.md | 39 -- .../20201017224027-init/schema.prisma | 32 - .../migrations/20201017224027-init/steps.json | 12 - .../migrations/20201028083612-init/README.md | 148 +++++ .../20201028083612-init/schema.prisma | 66 ++ .../migrations/20201028083612-init/steps.json | 567 ++++++++++++++++++ prisma/migrations/migrate.lock | 3 +- prisma/schema.prisma | 38 +- prisma/seed.ts | 47 +- scenes/Profile/components/ProfileModal.tsx | 3 +- tsconfig.json | 3 +- validators/Profile.ts | 11 +- 19 files changed, 977 insertions(+), 646 deletions(-) delete mode 100644 prisma/migrations/20201013141255-init/README.md delete mode 100644 prisma/migrations/20201013141255-init/schema.prisma delete mode 100644 prisma/migrations/20201013141255-init/steps.json delete mode 100644 prisma/migrations/20201017224027-init/README.md delete mode 100644 prisma/migrations/20201017224027-init/schema.prisma delete mode 100644 prisma/migrations/20201017224027-init/steps.json create mode 100644 prisma/migrations/20201028083612-init/README.md create mode 100644 prisma/migrations/20201028083612-init/schema.prisma create mode 100644 prisma/migrations/20201028083612-init/steps.json diff --git a/components/WeaponSelector.tsx b/components/WeaponSelector.tsx index e3e424e95..ac74b7213 100644 --- a/components/WeaponSelector.tsx +++ b/components/WeaponSelector.tsx @@ -13,7 +13,10 @@ const WeaponSelector: React.FC = ({ name, value, onChange }) => { <> {(Object.keys(countries) as Array).map( (countryCode) => ( diff --git a/tsconfig.json b/tsconfig.json index a5efb59d1..6eada9173 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,7 +18,8 @@ }, "ts-node": { "compilerOptions": { - "module": "commonjs" + "module": "commonjs", + "types": ["node"] } }, "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], diff --git a/validators/Profile.ts b/validators/Profile.ts index 4d225c4ba..a1f9c3d9f 100644 --- a/validators/Profile.ts +++ b/validators/Profile.ts @@ -26,7 +26,8 @@ const profileRootSchema = z.object({ weaponPool: z .array(z.string()) .max(5) - .refine((arr) => arr.every((val) => weaponsWithHero.includes(val as any))), + .refine((arr) => arr.every((val) => weaponsWithHero.includes(val as any))) + .refine((arr) => new Set(arr).size === arr.length), }); export const profileSchemaFrontend = profileRootSchema.extend({ @@ -37,16 +38,16 @@ export const profileSchemaFrontend = profileRootSchema.extend({ export const profileSchemaBackend = profileRootSchema.extend({ sensMotion: z .number() - .min(-50) - .max(50) - .refine((val) => val % 5 === 0) + .min(-5) + .max(5) + .refine((val) => (val * 10) % 5 === 0) .optional() .nullable(), sensStick: z .number() .min(-50) .max(50) - .refine((val) => val % 5 === 0) + .refine((val) => (val * 10) % 5 === 0) .optional() .nullable(), });