migration add x rank placements

This commit is contained in:
Kalle (Sendou)
2020-10-28 23:22:25 +02:00
parent 47c9ac5173
commit ecee51fdae
19 changed files with 977 additions and 646 deletions

View File

@@ -13,7 +13,10 @@ const WeaponSelector: React.FC<Props> = ({ name, value, onChange }) => {
<>
<Select
name={name}
onChange={(e) => onChange(value.concat(e.target.value))}
onChange={(e) => {
if (!!e.target.value && !value.includes(e.target.value))
onChange(value.concat(e.target.value));
}}
>
{weaponsWithHeroCategorized.map((wpnCategory) => (
<optgroup key={wpnCategory.name} label={wpnCategory.name}>

View File

@@ -40,14 +40,8 @@ export const Profile = objectType({
t.model.youtubeId();
t.model.country();
t.model.bio();
t.float("sensStick", {
resolve: (root) =>
root.sensStick ? root.sensStick / 10 : root.sensStick,
});
t.float("sensMotion", {
resolve: (root) =>
root.sensMotion ? root.sensMotion / 10 : root.sensMotion,
});
t.model.sensStick();
t.model.sensMotion();
t.model.weaponPool();
},
});
@@ -126,15 +120,6 @@ export const Mutation = mutationType({
typeof args.profile.twitchName === "string"
? args.profile.twitchName.toLowerCase()
: args.profile.twitchName,
// sens is saved as integers in the database
sensStick:
typeof args.profile.sensStick === "number"
? args.profile.sensStick * 10
: args.profile.sensStick,
sensMotion:
typeof args.profile.sensMotion === "number"
? args.profile.sensMotion * 10
: args.profile.sensMotion,
};
profileSchemaBackend.parse(argsForDb);

257
package-lock.json generated
View File

@@ -13,7 +13,7 @@
"@chakra-ui/theme-tools": "^1.0.0-rc.7",
"@hookform/resolvers": "^1.0.0",
"@nexus/schema": "^0.16.0",
"@prisma/client": "^2.9.0",
"@prisma/client": "^2.10.0",
"@sendou/react-sketch": "^0.5.2",
"apollo-server-micro": "^2.18.2",
"countries-list": "^2.5.6",
@@ -22,8 +22,8 @@
"next": "^10.0.0",
"next-auth": "^3.1.0",
"next-google-fonts": "^1.2.1",
"next-images": "^1.6.0",
"nexus-plugin-prisma": "^0.22.0",
"next-images": "^1.6.2",
"nexus-plugin-prisma": "^0.23.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-draggable": "^4.4.3",
@@ -39,9 +39,10 @@
"@graphql-codegen/typescript": "1.17.11",
"@graphql-codegen/typescript-operations": "1.17.8",
"@graphql-codegen/typescript-react-apollo": "2.0.7",
"@prisma/cli": "^2.9.0",
"@prisma/cli": "^2.10.0",
"@types/next-auth": "^3.1.14",
"@types/react": "^16.9.53",
"@types/node": "^14.11.8",
"@types/react": "^16.9.54",
"cypress": "^5.5.0",
"prettier": "^2.1.2",
"ts-node": "^9.0.0",
@@ -3601,12 +3602,22 @@
"url": "https://opencollective.com/popperjs"
}
},
"node_modules/@prisma/bar": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/@prisma/bar/-/bar-0.0.0.tgz",
"integrity": "sha512-3nez9n/vMyAr4+nmqj6Xh3cGZbreYHr3RWX0vgtrFRpiN6otuCzL+9HW8MW/DfZNuFz5YyIdfwnRSPueUZPoWQ==",
"devOptional": true
},
"node_modules/@prisma/cli": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/@prisma/cli/-/cli-2.9.0.tgz",
"integrity": "sha512-wPk4ehyTtVM7ZarWs16MhOc6kwLV/gZFardMvUeh46rlBwrklMdKtNChzzPa3wurrUPQ5KTbuRBz5Mgf7AdD/w==",
"version": "2.10.0",
"resolved": "https://registry.npmjs.org/@prisma/cli/-/cli-2.10.0.tgz",
"integrity": "sha512-qJl891HvroM1oEWYeG8+h/JJ+wNi4MCyh7x+HAnmrIYGFW45QAsCWjHbn0mUuCSXCy3KwiN/iAwaY2Fr7ZNJEw==",
"devOptional": true,
"hasInstallScript": true,
"dependencies": {
"@prisma/bar": "^0.0.0",
"@prisma/engines": "2.10.0-16-af1ae11a423edfb5d24092a85be11fa77c5e499c"
},
"bin": {
"prisma": "build/index.js",
"prisma2": "build/index.js"
@@ -3616,12 +3627,12 @@
}
},
"node_modules/@prisma/client": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/@prisma/client/-/client-2.9.0.tgz",
"integrity": "sha512-VLXw6s13xakIrV9Z8Ftw0j+mbXuvbRkxYv3X5hRZdPN1NAwgeXJmrrTK9MS2HDvW8eGZL7P8OaUSNQ3Sfgvr/Q==",
"version": "2.10.0",
"resolved": "https://registry.npmjs.org/@prisma/client/-/client-2.10.0.tgz",
"integrity": "sha512-TZoT5SYmCkVqMt8rKp3NAUm6UTqjNUMp2W94IcVn2d5DVkOR5TZGkxP/u8KuSoY3KQWIG+KQy/azIKetKxc+LQ==",
"hasInstallScript": true,
"dependencies": {
"pkg-up": "^3.1.0"
"@prisma/engines-version": "2.10.0-16-af1ae11a423edfb5d24092a85be11fa77c5e499c"
},
"engines": {
"node": ">=10"
@@ -3635,6 +3646,18 @@
}
}
},
"node_modules/@prisma/engines": {
"version": "2.10.0-16-af1ae11a423edfb5d24092a85be11fa77c5e499c",
"resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-2.10.0-16-af1ae11a423edfb5d24092a85be11fa77c5e499c.tgz",
"integrity": "sha512-59htYpsqdVVe7aElozUZ3/eV/ujwrUvaE+KVcNyzFh0yFIL7FLbSly55KWlyUdDWyB+0eTyd/yV7E/iKYnOF/Q==",
"devOptional": true,
"hasInstallScript": true
},
"node_modules/@prisma/engines-version": {
"version": "2.10.0-16-af1ae11a423edfb5d24092a85be11fa77c5e499c",
"resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-2.10.0-16-af1ae11a423edfb5d24092a85be11fa77c5e499c.tgz",
"integrity": "sha512-8dW/oSDBv3fovNzTn2sjpITgD4IhHYPnmkbPp4Gv4rqjB14tpB0OuU1xkygVRIRJisTBRoYyjfiVaaWea/e57A=="
},
"node_modules/@protobufjs/aspromise": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
@@ -4112,9 +4135,9 @@
"integrity": "sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA=="
},
"node_modules/@types/react": {
"version": "16.9.53",
"resolved": "https://registry.npmjs.org/@types/react/-/react-16.9.53.tgz",
"integrity": "sha512-4nW60Sd4L7+WMXH1D6jCdVftuW7j4Za6zdp6tJ33Rqv0nk1ZAmQKML9ZLD4H0dehA3FZxXR/GM8gXplf82oNGw==",
"version": "16.9.54",
"resolved": "https://registry.npmjs.org/@types/react/-/react-16.9.54.tgz",
"integrity": "sha512-GhawhYraQZpGFO2hVMArjPrYbnA/6+DS8SubK8IPhhVClmKqANihsRenOm5E0mvqK0m/BKoqVktA1O1+Xvlz9w==",
"dependencies": {
"@types/prop-types": "*",
"csstype": "^3.0.2"
@@ -8093,9 +8116,9 @@
}
},
"node_modules/fs-jetpack": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/fs-jetpack/-/fs-jetpack-3.2.0.tgz",
"integrity": "sha512-LMUQxf85b3y/IuQZM9gz7bPMH60Y+NpulmHdhv8nHvgu6daYd7DiSZJSgiHKk1h6vfv1VCOqpdJcR+ThO7sFVA==",
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/fs-jetpack/-/fs-jetpack-4.0.1.tgz",
"integrity": "sha512-GkDbdjAy0Qye+TGrZ12g5gxmGWg0qFz1Ujwx4pEV0Rh8hh92kZ9Nsf3Ql+wshcycq2yfnzbe68AI0pjxP8Pj0Q==",
"dependencies": {
"minimatch": "^3.0.2",
"rimraf": "^2.6.3"
@@ -11074,9 +11097,9 @@
}
},
"node_modules/next-images": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/next-images/-/next-images-1.6.0.tgz",
"integrity": "sha512-Ub395DSBkRcNNLV1N9h/tkzmdvQMF5cXZwmPnNI25OcW3ruN+zrGlFsWN7bBgLoH/Xuiw2kS99zCXE2cxbs63w==",
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/next-images/-/next-images-1.6.2.tgz",
"integrity": "sha512-tmINk0NzJ/D7Kk16x9gOgTd9wlcVG4IfyEcQqt/SY31miwuv5pzUhT7fakO2fYPrXimHOEPBaacCz1G6jADcbQ==",
"dependencies": {
"file-loader": "^6.0.0",
"url-loader": "^4.0.0"
@@ -11169,20 +11192,20 @@
}
},
"node_modules/nexus-plugin-prisma": {
"version": "0.22.0",
"resolved": "https://registry.npmjs.org/nexus-plugin-prisma/-/nexus-plugin-prisma-0.22.0.tgz",
"integrity": "sha512-PSAjATeaaGta4mypSPff2dA4mk8Ux59CKzN58aF4pgVhgGTaZIalvVnmGNyDOHUYfp/G5lZ/kSNjJOfJoHZ2mg==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/nexus-plugin-prisma/-/nexus-plugin-prisma-0.23.0.tgz",
"integrity": "sha512-RHdEqEyPCI5g9Evzg/dMm45joVHkk1TPNobDZY20SA1PgU41qmMzYqOZammhiIYaJuYkdt0JxUCS73kt3fcDGg==",
"hasInstallScript": true,
"dependencies": {
"camelcase": "^6.0.0",
"fs-jetpack": "^3.0.0",
"fs-jetpack": "^4.0.0",
"lodash": "^4.17.20",
"outdent": "^0.7.1",
"pluralize": "^8.0.0"
},
"peerDependencies": {
"@nexus/schema": "^0.15.0",
"@prisma/client": "2.8.0 || 2.8.1 || 2.9.0",
"@nexus/schema": "^0.15.0 || ^0.16.0 || ^0.17.0",
"@prisma/client": "2.10.0",
"graphql": "^15.3.0"
}
},
@@ -12000,73 +12023,6 @@
"node": ">=8"
}
},
"node_modules/pkg-up": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-3.1.0.tgz",
"integrity": "sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==",
"dependencies": {
"find-up": "^3.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/pkg-up/node_modules/find-up": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
"integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
"dependencies": {
"locate-path": "^3.0.0"
},
"engines": {
"node": ">=6"
}
},
"node_modules/pkg-up/node_modules/locate-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
"integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
"dependencies": {
"p-locate": "^3.0.0",
"path-exists": "^3.0.0"
},
"engines": {
"node": ">=6"
}
},
"node_modules/pkg-up/node_modules/p-limit": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
"dependencies": {
"p-try": "^2.0.0"
},
"engines": {
"node": ">=6"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/pkg-up/node_modules/p-locate": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
"integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
"dependencies": {
"p-limit": "^2.0.0"
},
"engines": {
"node": ">=6"
}
},
"node_modules/pkg-up/node_modules/path-exists": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
"engines": {
"node": ">=4"
}
},
"node_modules/platform": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/platform/-/platform-1.3.3.tgz",
@@ -19821,20 +19777,41 @@
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.4.4.tgz",
"integrity": "sha512-1oO6+dN5kdIA3sKPZhRGJTfGVP4SWV6KqlMOwry4J3HfyD68sl/3KmG7DeYUzvN+RbhXDnv/D8vNNB8168tAMg=="
},
"@prisma/cli": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/@prisma/cli/-/cli-2.9.0.tgz",
"integrity": "sha512-wPk4ehyTtVM7ZarWs16MhOc6kwLV/gZFardMvUeh46rlBwrklMdKtNChzzPa3wurrUPQ5KTbuRBz5Mgf7AdD/w==",
"@prisma/bar": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/@prisma/bar/-/bar-0.0.0.tgz",
"integrity": "sha512-3nez9n/vMyAr4+nmqj6Xh3cGZbreYHr3RWX0vgtrFRpiN6otuCzL+9HW8MW/DfZNuFz5YyIdfwnRSPueUZPoWQ==",
"devOptional": true
},
"@prisma/client": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/@prisma/client/-/client-2.9.0.tgz",
"integrity": "sha512-VLXw6s13xakIrV9Z8Ftw0j+mbXuvbRkxYv3X5hRZdPN1NAwgeXJmrrTK9MS2HDvW8eGZL7P8OaUSNQ3Sfgvr/Q==",
"@prisma/cli": {
"version": "2.10.0",
"resolved": "https://registry.npmjs.org/@prisma/cli/-/cli-2.10.0.tgz",
"integrity": "sha512-qJl891HvroM1oEWYeG8+h/JJ+wNi4MCyh7x+HAnmrIYGFW45QAsCWjHbn0mUuCSXCy3KwiN/iAwaY2Fr7ZNJEw==",
"devOptional": true,
"requires": {
"pkg-up": "^3.1.0"
"@prisma/bar": "^0.0.0",
"@prisma/engines": "2.10.0-16-af1ae11a423edfb5d24092a85be11fa77c5e499c"
}
},
"@prisma/client": {
"version": "2.10.0",
"resolved": "https://registry.npmjs.org/@prisma/client/-/client-2.10.0.tgz",
"integrity": "sha512-TZoT5SYmCkVqMt8rKp3NAUm6UTqjNUMp2W94IcVn2d5DVkOR5TZGkxP/u8KuSoY3KQWIG+KQy/azIKetKxc+LQ==",
"requires": {
"@prisma/engines-version": "2.10.0-16-af1ae11a423edfb5d24092a85be11fa77c5e499c"
}
},
"@prisma/engines": {
"version": "2.10.0-16-af1ae11a423edfb5d24092a85be11fa77c5e499c",
"resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-2.10.0-16-af1ae11a423edfb5d24092a85be11fa77c5e499c.tgz",
"integrity": "sha512-59htYpsqdVVe7aElozUZ3/eV/ujwrUvaE+KVcNyzFh0yFIL7FLbSly55KWlyUdDWyB+0eTyd/yV7E/iKYnOF/Q==",
"devOptional": true
},
"@prisma/engines-version": {
"version": "2.10.0-16-af1ae11a423edfb5d24092a85be11fa77c5e499c",
"resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-2.10.0-16-af1ae11a423edfb5d24092a85be11fa77c5e499c.tgz",
"integrity": "sha512-8dW/oSDBv3fovNzTn2sjpITgD4IhHYPnmkbPp4Gv4rqjB14tpB0OuU1xkygVRIRJisTBRoYyjfiVaaWea/e57A=="
},
"@protobufjs/aspromise": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
@@ -20277,9 +20254,9 @@
"integrity": "sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA=="
},
"@types/react": {
"version": "16.9.53",
"resolved": "https://registry.npmjs.org/@types/react/-/react-16.9.53.tgz",
"integrity": "sha512-4nW60Sd4L7+WMXH1D6jCdVftuW7j4Za6zdp6tJ33Rqv0nk1ZAmQKML9ZLD4H0dehA3FZxXR/GM8gXplf82oNGw==",
"version": "16.9.54",
"resolved": "https://registry.npmjs.org/@types/react/-/react-16.9.54.tgz",
"integrity": "sha512-GhawhYraQZpGFO2hVMArjPrYbnA/6+DS8SubK8IPhhVClmKqANihsRenOm5E0mvqK0m/BKoqVktA1O1+Xvlz9w==",
"requires": {
"@types/prop-types": "*",
"csstype": "^3.0.2"
@@ -23582,9 +23559,9 @@
}
},
"fs-jetpack": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/fs-jetpack/-/fs-jetpack-3.2.0.tgz",
"integrity": "sha512-LMUQxf85b3y/IuQZM9gz7bPMH60Y+NpulmHdhv8nHvgu6daYd7DiSZJSgiHKk1h6vfv1VCOqpdJcR+ThO7sFVA==",
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/fs-jetpack/-/fs-jetpack-4.0.1.tgz",
"integrity": "sha512-GkDbdjAy0Qye+TGrZ12g5gxmGWg0qFz1Ujwx4pEV0Rh8hh92kZ9Nsf3Ql+wshcycq2yfnzbe68AI0pjxP8Pj0Q==",
"requires": {
"minimatch": "^3.0.2",
"rimraf": "^2.6.3"
@@ -25981,9 +25958,9 @@
"requires": {}
},
"next-images": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/next-images/-/next-images-1.6.0.tgz",
"integrity": "sha512-Ub395DSBkRcNNLV1N9h/tkzmdvQMF5cXZwmPnNI25OcW3ruN+zrGlFsWN7bBgLoH/Xuiw2kS99zCXE2cxbs63w==",
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/next-images/-/next-images-1.6.2.tgz",
"integrity": "sha512-tmINk0NzJ/D7Kk16x9gOgTd9wlcVG4IfyEcQqt/SY31miwuv5pzUhT7fakO2fYPrXimHOEPBaacCz1G6jADcbQ==",
"requires": {
"file-loader": "^6.0.0",
"url-loader": "^4.0.0"
@@ -25995,12 +25972,12 @@
"integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw="
},
"nexus-plugin-prisma": {
"version": "0.22.0",
"resolved": "https://registry.npmjs.org/nexus-plugin-prisma/-/nexus-plugin-prisma-0.22.0.tgz",
"integrity": "sha512-PSAjATeaaGta4mypSPff2dA4mk8Ux59CKzN58aF4pgVhgGTaZIalvVnmGNyDOHUYfp/G5lZ/kSNjJOfJoHZ2mg==",
"version": "0.23.0",
"resolved": "https://registry.npmjs.org/nexus-plugin-prisma/-/nexus-plugin-prisma-0.23.0.tgz",
"integrity": "sha512-RHdEqEyPCI5g9Evzg/dMm45joVHkk1TPNobDZY20SA1PgU41qmMzYqOZammhiIYaJuYkdt0JxUCS73kt3fcDGg==",
"requires": {
"camelcase": "^6.0.0",
"fs-jetpack": "^3.0.0",
"fs-jetpack": "^4.0.0",
"lodash": "^4.17.20",
"outdent": "^0.7.1",
"pluralize": "^8.0.0"
@@ -26667,54 +26644,6 @@
"find-up": "^4.0.0"
}
},
"pkg-up": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-3.1.0.tgz",
"integrity": "sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==",
"requires": {
"find-up": "^3.0.0"
},
"dependencies": {
"find-up": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
"integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
"requires": {
"locate-path": "^3.0.0"
}
},
"locate-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
"integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
"requires": {
"p-locate": "^3.0.0",
"path-exists": "^3.0.0"
}
},
"p-limit": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
"requires": {
"p-try": "^2.0.0"
}
},
"p-locate": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
"integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
"requires": {
"p-limit": "^2.0.0"
}
},
"path-exists": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU="
}
}
},
"platform": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/platform/-/platform-1.3.3.tgz",

View File

@@ -22,7 +22,7 @@
"@chakra-ui/theme-tools": "^1.0.0-rc.7",
"@hookform/resolvers": "^1.0.0",
"@nexus/schema": "^0.16.0",
"@prisma/client": "^2.9.0",
"@prisma/client": "^2.10.0",
"@sendou/react-sketch": "^0.5.2",
"apollo-server-micro": "^2.18.2",
"countries-list": "^2.5.6",
@@ -31,8 +31,8 @@
"next": "^10.0.0",
"next-auth": "^3.1.0",
"next-google-fonts": "^1.2.1",
"next-images": "^1.6.0",
"nexus-plugin-prisma": "^0.22.0",
"next-images": "^1.6.2",
"nexus-plugin-prisma": "^0.23.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-draggable": "^4.4.3",
@@ -48,9 +48,10 @@
"@graphql-codegen/typescript": "1.17.11",
"@graphql-codegen/typescript-operations": "1.17.8",
"@graphql-codegen/typescript-react-apollo": "2.0.7",
"@prisma/cli": "^2.9.0",
"@prisma/cli": "^2.10.0",
"@types/next-auth": "^3.1.14",
"@types/react": "^16.9.53",
"@types/node": "^14.11.8",
"@types/react": "^16.9.54",
"cypress": "^5.5.0",
"prettier": "^2.1.2",
"ts-node": "^9.0.0",

View File

@@ -1,77 +0,0 @@
# Migration `20201013141255-init`
This migration has been generated by Kalle (Sendou) at 10/13/2020, 5:12:55 PM.
You can check out the [state of the schema](./schema.prisma) after the migration.
## Database Steps
```sql
CREATE TABLE "public"."User" (
"id" SERIAL,
"username" text NOT NULL ,
"discriminator" text NOT NULL ,
"discordId" text NOT NULL ,
"discordAvatar" text ,
PRIMARY KEY ("id")
)
CREATE TABLE "public"."Profile" (
"twitchName" text ,
"youtubeId" text ,
"country" text ,
"sensMotion" integer ,
"sensStick" integer ,
"bio" text ,
"weaponPool" text [] ,
"customUrlPath" text ,
"userId" integer NOT NULL
)
CREATE UNIQUE INDEX "User.discordId_unique" ON "public"."User"("discordId")
CREATE UNIQUE INDEX "Profile.customUrlPath_unique" ON "public"."Profile"("customUrlPath")
CREATE UNIQUE INDEX "Profile.userId_unique" ON "public"."Profile"("userId")
ALTER TABLE "public"."Profile" ADD FOREIGN KEY ("userId")REFERENCES "public"."User"("id") ON DELETE CASCADE ON UPDATE CASCADE
```
## Changes
```diff
diff --git schema.prisma schema.prisma
migration ..20201013141255-init
--- datamodel.dml
+++ datamodel.dml
@@ -1,0 +1,30 @@
+datasource db {
+ provider = "postgresql"
+ url = "***"
+}
+
+generator client {
+ provider = "prisma-client-js"
+}
+
+model User {
+ id Int @id @default(autoincrement())
+ username String
+ discriminator String
+ discordId String @unique
+ discordAvatar String?
+ profile Profile?
+}
+
+model Profile {
+ twitchName String?
+ youtubeId String?
+ country String?
+ sensMotion Int?
+ sensStick Int?
+ bio String?
+ weaponPool String[]
+ customUrlPath String? @unique
+ user User @relation(fields: [userId], references: [id])
+ userId Int @unique
+}
```

View File

@@ -1,30 +0,0 @@
datasource db {
provider = "postgresql"
url = "***"
}
generator client {
provider = "prisma-client-js"
}
model User {
id Int @id @default(autoincrement())
username String
discriminator String
discordId String @unique
discordAvatar String?
profile Profile?
}
model Profile {
twitchName String?
youtubeId String?
country String?
sensMotion Int?
sensStick Int?
bio String?
weaponPool String[]
customUrlPath String? @unique
user User @relation(fields: [userId], references: [id])
userId Int @unique
}

View File

@@ -1,255 +0,0 @@
{
"version": "0.3.14-fixed",
"steps": [
{
"tag": "CreateSource",
"source": "db"
},
{
"tag": "CreateArgument",
"location": {
"tag": "Source",
"source": "db"
},
"argument": "provider",
"value": "\"postgresql\""
},
{
"tag": "CreateArgument",
"location": {
"tag": "Source",
"source": "db"
},
"argument": "url",
"value": "\"***\""
},
{
"tag": "CreateModel",
"model": "User"
},
{
"tag": "CreateField",
"model": "User",
"field": "id",
"type": "Int",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "User",
"field": "id"
},
"directive": "id"
}
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "User",
"field": "id"
},
"directive": "default"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "User",
"field": "id"
},
"directive": "default"
},
"argument": "",
"value": "autoincrement()"
},
{
"tag": "CreateField",
"model": "User",
"field": "username",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateField",
"model": "User",
"field": "discriminator",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateField",
"model": "User",
"field": "discordId",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "User",
"field": "discordId"
},
"directive": "unique"
}
},
{
"tag": "CreateField",
"model": "User",
"field": "discordAvatar",
"type": "String",
"arity": "Optional"
},
{
"tag": "CreateField",
"model": "User",
"field": "profile",
"type": "Profile",
"arity": "Optional"
},
{
"tag": "CreateModel",
"model": "Profile"
},
{
"tag": "CreateField",
"model": "Profile",
"field": "twitchName",
"type": "String",
"arity": "Optional"
},
{
"tag": "CreateField",
"model": "Profile",
"field": "youtubeId",
"type": "String",
"arity": "Optional"
},
{
"tag": "CreateField",
"model": "Profile",
"field": "country",
"type": "String",
"arity": "Optional"
},
{
"tag": "CreateField",
"model": "Profile",
"field": "sensMotion",
"type": "Int",
"arity": "Optional"
},
{
"tag": "CreateField",
"model": "Profile",
"field": "sensStick",
"type": "Int",
"arity": "Optional"
},
{
"tag": "CreateField",
"model": "Profile",
"field": "bio",
"type": "String",
"arity": "Optional"
},
{
"tag": "CreateField",
"model": "Profile",
"field": "weaponPool",
"type": "String",
"arity": "List"
},
{
"tag": "CreateField",
"model": "Profile",
"field": "customUrlPath",
"type": "String",
"arity": "Optional"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "Profile",
"field": "customUrlPath"
},
"directive": "unique"
}
},
{
"tag": "CreateField",
"model": "Profile",
"field": "user",
"type": "User",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "Profile",
"field": "user"
},
"directive": "relation"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "Profile",
"field": "user"
},
"directive": "relation"
},
"argument": "fields",
"value": "[userId]"
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "Profile",
"field": "user"
},
"directive": "relation"
},
"argument": "references",
"value": "[id]"
},
{
"tag": "CreateField",
"model": "Profile",
"field": "userId",
"type": "Int",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "Profile",
"field": "userId"
},
"directive": "unique"
}
}
]
}

View File

@@ -1,39 +0,0 @@
# Migration `20201017224027-init`
This migration has been generated by Kalle (Sendou) at 10/18/2020, 1:40:27 AM.
You can check out the [state of the schema](./schema.prisma) after the migration.
## Database Steps
```sql
ALTER TABLE "public"."Profile" ADD COLUMN "twitterName" text
```
## Changes
```diff
diff --git schema.prisma schema.prisma
migration 20201013141255-init..20201017224027-init
--- datamodel.dml
+++ datamodel.dml
@@ -1,7 +1,8 @@
datasource db {
provider = "postgresql"
- url = "***"
+ // FIXME: should use same .env system as Next.JS
+ url = "***"
}
generator client {
provider = "prisma-client-js"
@@ -16,8 +17,9 @@
profile Profile?
}
model Profile {
+ twitterName String?
twitchName String?
youtubeId String?
country String?
sensMotion Int?
```

View File

@@ -1,32 +0,0 @@
datasource db {
provider = "postgresql"
// FIXME: should use same .env system as Next.JS
url = "***"
}
generator client {
provider = "prisma-client-js"
}
model User {
id Int @id @default(autoincrement())
username String
discriminator String
discordId String @unique
discordAvatar String?
profile Profile?
}
model Profile {
twitterName String?
twitchName String?
youtubeId String?
country String?
sensMotion Int?
sensStick Int?
bio String?
weaponPool String[]
customUrlPath String? @unique
user User @relation(fields: [userId], references: [id])
userId Int @unique
}

View File

@@ -1,12 +0,0 @@
{
"version": "0.3.14-fixed",
"steps": [
{
"tag": "CreateField",
"model": "Profile",
"field": "twitterName",
"type": "String",
"arity": "Optional"
}
]
}

View File

@@ -0,0 +1,148 @@
# Migration `20201028083612-init`
This migration has been generated by Kalle (Sendou) at 10/28/2020, 10:36:12 AM.
You can check out the [state of the schema](./schema.prisma) after the migration.
## Database Steps
```sql
CREATE TABLE "public"."User" (
"id" SERIAL,
"username" text NOT NULL ,
"discriminator" text NOT NULL ,
"discordId" text NOT NULL ,
"discordAvatar" text ,
PRIMARY KEY ("id")
)
CREATE TABLE "public"."Profile" (
"twitterName" text ,
"twitchName" text ,
"youtubeId" text ,
"country" text ,
"sensMotion" Decimal(65,30) ,
"sensStick" Decimal(65,30) ,
"bio" text ,
"weaponPool" text [] ,
"customUrlPath" text ,
"userId" integer NOT NULL
)
CREATE TABLE "public"."XRankPlacement" (
"id" SERIAL,
"playerId" text NOT NULL ,
"playerName" text NOT NULL ,
"playerNameLower" text NOT NULL ,
"ranking" integer NOT NULL ,
"xPower" Decimal(65,30) NOT NULL ,
"weapon" text NOT NULL ,
"mode" "RankedMode" NOT NULL ,
"month" integer NOT NULL ,
"year" integer NOT NULL ,
PRIMARY KEY ("id")
)
CREATE TABLE "public"."Player" (
"playerId" text NOT NULL ,
"userId" integer ,
"names" text []
)
CREATE UNIQUE INDEX "User.discordId_unique" ON "public"."User"("discordId")
CREATE UNIQUE INDEX "Profile.customUrlPath_unique" ON "public"."Profile"("customUrlPath")
CREATE UNIQUE INDEX "Profile.userId_unique" ON "public"."Profile"("userId")
CREATE UNIQUE INDEX "XRankPlacement.playerId_mode_month_year_unique" ON "public"."XRankPlacement"("playerId", "mode", "month", "year")
CREATE INDEX "XRankPlacement.playerNameLower_index" ON "public"."XRankPlacement"("playerNameLower")
CREATE UNIQUE INDEX "Player.playerId_unique" ON "public"."Player"("playerId")
CREATE UNIQUE INDEX "Player.userId_unique" ON "public"."Player"("userId")
ALTER TABLE "public"."Profile" ADD FOREIGN KEY("userId")REFERENCES "public"."User"("id") ON DELETE CASCADE ON UPDATE CASCADE
ALTER TABLE "public"."XRankPlacement" ADD FOREIGN KEY("playerId")REFERENCES "public"."Player"("playerId") ON DELETE CASCADE ON UPDATE CASCADE
ALTER TABLE "public"."Player" ADD FOREIGN KEY("userId")REFERENCES "public"."User"("id") ON DELETE SET NULL ON UPDATE CASCADE
```
## Changes
```diff
diff --git schema.prisma schema.prisma
migration ..20201028083612-init
--- datamodel.dml
+++ datamodel.dml
@@ -1,0 +1,66 @@
+datasource db {
+ provider = "postgresql"
+ // FIXME: should use same .env system as Next.JS
+ url = "***"
+}
+
+generator client {
+ provider = "prisma-client-js"
+}
+
+model User {
+ id Int @id @default(autoincrement())
+ username String
+ discriminator String
+ discordId String @unique
+ discordAvatar String?
+ profile Profile?
+ player Player?
+}
+
+model Profile {
+ twitterName String?
+ twitchName String?
+ youtubeId String?
+ country String?
+ sensMotion Float?
+ sensStick Float?
+ bio String?
+ weaponPool String[]
+ customUrlPath String? @unique
+ user User @relation(fields: [userId], references: [id])
+ userId Int @unique
+
+}
+
+enum RankedMode {
+ SZ
+ TC
+ RM
+ CB
+}
+
+model XRankPlacement {
+ id Int @id @default(autoincrement())
+ playerId String
+ player Player @relation(fields: [playerId], references: [playerId])
+ playerName String
+ playerNameLower String
+ ranking Int
+ xPower Float
+ weapon String
+ mode RankedMode
+ month Int
+ year Int
+
+ @@unique([playerId, mode, month, year])
+ @@index([playerNameLower])
+}
+
+model Player {
+ playerId String @unique
+ user User? @relation(fields: [userId], references: [id])
+ userId Int? @unique
+ names String[]
+ placements XRankPlacement[]
+}
```

View File

@@ -0,0 +1,66 @@
datasource db {
provider = "postgresql"
// FIXME: should use same .env system as Next.JS
url = "***"
}
generator client {
provider = "prisma-client-js"
}
model User {
id Int @id @default(autoincrement())
username String
discriminator String
discordId String @unique
discordAvatar String?
profile Profile?
player Player?
}
model Profile {
twitterName String?
twitchName String?
youtubeId String?
country String?
sensMotion Float?
sensStick Float?
bio String?
weaponPool String[]
customUrlPath String? @unique
user User @relation(fields: [userId], references: [id])
userId Int @unique
}
enum RankedMode {
SZ
TC
RM
CB
}
model XRankPlacement {
id Int @id @default(autoincrement())
playerId String
player Player @relation(fields: [playerId], references: [playerId])
playerName String
playerNameLower String
ranking Int
xPower Float
weapon String
mode RankedMode
month Int
year Int
@@unique([playerId, mode, month, year])
@@index([playerNameLower])
}
model Player {
playerId String @unique
user User? @relation(fields: [userId], references: [id])
userId Int? @unique
names String[]
placements XRankPlacement[]
}

View File

@@ -0,0 +1,567 @@
{
"version": "0.3.14-fixed",
"steps": [
{
"tag": "CreateEnum",
"enum": "RankedMode",
"values": [
"SZ",
"TC",
"RM",
"CB"
]
},
{
"tag": "CreateSource",
"source": "db"
},
{
"tag": "CreateArgument",
"location": {
"tag": "Source",
"source": "db"
},
"argument": "provider",
"value": "\"postgresql\""
},
{
"tag": "CreateArgument",
"location": {
"tag": "Source",
"source": "db"
},
"argument": "url",
"value": "\"***\""
},
{
"tag": "CreateModel",
"model": "User"
},
{
"tag": "CreateField",
"model": "User",
"field": "id",
"type": "Int",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "User",
"field": "id"
},
"directive": "id"
}
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "User",
"field": "id"
},
"directive": "default"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "User",
"field": "id"
},
"directive": "default"
},
"argument": "",
"value": "autoincrement()"
},
{
"tag": "CreateField",
"model": "User",
"field": "username",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateField",
"model": "User",
"field": "discriminator",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateField",
"model": "User",
"field": "discordId",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "User",
"field": "discordId"
},
"directive": "unique"
}
},
{
"tag": "CreateField",
"model": "User",
"field": "discordAvatar",
"type": "String",
"arity": "Optional"
},
{
"tag": "CreateField",
"model": "User",
"field": "profile",
"type": "Profile",
"arity": "Optional"
},
{
"tag": "CreateField",
"model": "User",
"field": "player",
"type": "Player",
"arity": "Optional"
},
{
"tag": "CreateModel",
"model": "Profile"
},
{
"tag": "CreateField",
"model": "Profile",
"field": "twitterName",
"type": "String",
"arity": "Optional"
},
{
"tag": "CreateField",
"model": "Profile",
"field": "twitchName",
"type": "String",
"arity": "Optional"
},
{
"tag": "CreateField",
"model": "Profile",
"field": "youtubeId",
"type": "String",
"arity": "Optional"
},
{
"tag": "CreateField",
"model": "Profile",
"field": "country",
"type": "String",
"arity": "Optional"
},
{
"tag": "CreateField",
"model": "Profile",
"field": "sensMotion",
"type": "Float",
"arity": "Optional"
},
{
"tag": "CreateField",
"model": "Profile",
"field": "sensStick",
"type": "Float",
"arity": "Optional"
},
{
"tag": "CreateField",
"model": "Profile",
"field": "bio",
"type": "String",
"arity": "Optional"
},
{
"tag": "CreateField",
"model": "Profile",
"field": "weaponPool",
"type": "String",
"arity": "List"
},
{
"tag": "CreateField",
"model": "Profile",
"field": "customUrlPath",
"type": "String",
"arity": "Optional"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "Profile",
"field": "customUrlPath"
},
"directive": "unique"
}
},
{
"tag": "CreateField",
"model": "Profile",
"field": "user",
"type": "User",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "Profile",
"field": "user"
},
"directive": "relation"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "Profile",
"field": "user"
},
"directive": "relation"
},
"argument": "fields",
"value": "[userId]"
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "Profile",
"field": "user"
},
"directive": "relation"
},
"argument": "references",
"value": "[id]"
},
{
"tag": "CreateField",
"model": "Profile",
"field": "userId",
"type": "Int",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "Profile",
"field": "userId"
},
"directive": "unique"
}
},
{
"tag": "CreateModel",
"model": "XRankPlacement"
},
{
"tag": "CreateField",
"model": "XRankPlacement",
"field": "id",
"type": "Int",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "XRankPlacement",
"field": "id"
},
"directive": "id"
}
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "XRankPlacement",
"field": "id"
},
"directive": "default"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "XRankPlacement",
"field": "id"
},
"directive": "default"
},
"argument": "",
"value": "autoincrement()"
},
{
"tag": "CreateField",
"model": "XRankPlacement",
"field": "playerId",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateField",
"model": "XRankPlacement",
"field": "player",
"type": "Player",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "XRankPlacement",
"field": "player"
},
"directive": "relation"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "XRankPlacement",
"field": "player"
},
"directive": "relation"
},
"argument": "fields",
"value": "[playerId]"
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "XRankPlacement",
"field": "player"
},
"directive": "relation"
},
"argument": "references",
"value": "[playerId]"
},
{
"tag": "CreateField",
"model": "XRankPlacement",
"field": "playerName",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateField",
"model": "XRankPlacement",
"field": "playerNameLower",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateField",
"model": "XRankPlacement",
"field": "ranking",
"type": "Int",
"arity": "Required"
},
{
"tag": "CreateField",
"model": "XRankPlacement",
"field": "xPower",
"type": "Float",
"arity": "Required"
},
{
"tag": "CreateField",
"model": "XRankPlacement",
"field": "weapon",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateField",
"model": "XRankPlacement",
"field": "mode",
"type": "RankedMode",
"arity": "Required"
},
{
"tag": "CreateField",
"model": "XRankPlacement",
"field": "month",
"type": "Int",
"arity": "Required"
},
{
"tag": "CreateField",
"model": "XRankPlacement",
"field": "year",
"type": "Int",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Model",
"model": "XRankPlacement",
"arguments": [
{
"name": "",
"value": "[playerId, mode, month, year]"
}
]
},
"directive": "unique"
}
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Model",
"model": "XRankPlacement",
"arguments": [
{
"name": "",
"value": "[playerNameLower]"
}
]
},
"directive": "index"
}
},
{
"tag": "CreateModel",
"model": "Player"
},
{
"tag": "CreateField",
"model": "Player",
"field": "playerId",
"type": "String",
"arity": "Required"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "Player",
"field": "playerId"
},
"directive": "unique"
}
},
{
"tag": "CreateField",
"model": "Player",
"field": "user",
"type": "User",
"arity": "Optional"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "Player",
"field": "user"
},
"directive": "relation"
}
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "Player",
"field": "user"
},
"directive": "relation"
},
"argument": "fields",
"value": "[userId]"
},
{
"tag": "CreateArgument",
"location": {
"tag": "Directive",
"path": {
"tag": "Field",
"model": "Player",
"field": "user"
},
"directive": "relation"
},
"argument": "references",
"value": "[id]"
},
{
"tag": "CreateField",
"model": "Player",
"field": "userId",
"type": "Int",
"arity": "Optional"
},
{
"tag": "CreateDirective",
"location": {
"path": {
"tag": "Field",
"model": "Player",
"field": "userId"
},
"directive": "unique"
}
},
{
"tag": "CreateField",
"model": "Player",
"field": "names",
"type": "String",
"arity": "List"
},
{
"tag": "CreateField",
"model": "Player",
"field": "placements",
"type": "XRankPlacement",
"arity": "List"
}
]
}

View File

@@ -1,4 +1,3 @@
# Prisma Migrate lockfile v1
20201013141255-init
20201017224027-init
20201028083612-init

View File

@@ -15,6 +15,7 @@ model User {
discordId String @unique
discordAvatar String?
profile Profile?
player Player?
}
model Profile {
@@ -22,11 +23,44 @@ model Profile {
twitchName String?
youtubeId String?
country String?
sensMotion Int?
sensStick Int?
sensMotion Float?
sensStick Float?
bio String?
weaponPool String[]
customUrlPath String? @unique
user User @relation(fields: [userId], references: [id])
userId Int @unique
}
enum RankedMode {
SZ
TC
RM
CB
}
model XRankPlacement {
id Int @id @default(autoincrement())
playerId String
player Player @relation(fields: [playerId], references: [playerId])
playerName String
playerNameLower String
ranking Int
xPower Float
weapon String
mode RankedMode
month Int
year Int
@@unique([playerId, mode, month, year])
@@index([playerNameLower])
}
model Player {
playerId String @unique
user User? @relation(fields: [userId], references: [id])
userId Int? @unique
names String[]
placements XRankPlacement[]
}

View File

@@ -1,4 +1,5 @@
import { PrismaClient } from "@prisma/client";
const { PrismaClient } = require("@prisma/client");
//import { PrismaClient } from "@prisma/client";
const fs = require("fs");
const path = require("path");
@@ -36,8 +37,8 @@ const main = async () => {
bio: "My cool bio! Supports markdown too: **bolded**",
country: "US",
customUrlPath: "tester",
sensMotion: 45,
sensStick: -20,
sensMotion: 4.5,
sensStick: -2.0,
weaponPool: [
"Tenta Brella",
"Range Blaster",
@@ -53,6 +54,46 @@ const main = async () => {
});
console.log("User created");
await prisma.xRankPlacement.deleteMany({});
await prisma.player.deleteMany({});
const getMode = (i: number) => {
const j = i + 1;
if (j % 1 === 0) return "SZ";
if (j % 2 === 0) return "TC";
if (j % 3 === 0) return "RM";
return "CB";
};
await Promise.all(
Array(100)
.fill(null)
.map((_, i) => {
const playerName = i % 2 === 0 ? `Player${i}` : `選手${i}`;
return prisma.xRankPlacement.create({
data: {
playerName,
playerNameLower: i % 2 === 0 ? `player${i}` : `選手${i}`,
mode: getMode(i),
month: 12,
year: 2020,
ranking: Math.ceil((i + 1) / 4),
xPower: 3000 - i,
weapon: "Splattershot Jr.",
player: {
create: {
playerId: "" + i,
names: [playerName],
},
},
},
});
})
);
console.log("X Rank placements created");
};
main()

View File

@@ -62,7 +62,7 @@ const sensOptions = [
];
const sensToString = (sens: number | undefined | null) => {
if (sens === undefined || sens === null) return undefined;
if (sens === undefined || sens === null) return "";
return sens > 0 ? `+${sens}` : `${sens}`;
};
@@ -251,6 +251,7 @@ const ProfileModal: React.FC<Props> = ({
<FormLabel htmlFor="country" mt={4}>
{t("users;Country")}
</FormLabel>
{/* FIXME: placeholders for dropdowns */}
<Select ref={register} name="country">
{(Object.keys(countries) as Array<keyof typeof countries>).map(
(countryCode) => (

View File

@@ -18,7 +18,8 @@
},
"ts-node": {
"compilerOptions": {
"module": "commonjs"
"module": "commonjs",
"types": ["node"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],

View File

@@ -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(),
});