mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-14 07:06:14 -05:00
refactor player table
This commit is contained in:
@@ -55,7 +55,7 @@ export type QueryGetXRankPlacementsArgs = {
|
||||
|
||||
|
||||
export type QueryGetPlayersXRankPlacementsArgs = {
|
||||
playerId: Scalars['String'];
|
||||
switchAccountId: Scalars['String'];
|
||||
};
|
||||
|
||||
export type UpdateUserProfileInput = {
|
||||
@@ -83,7 +83,7 @@ export type MutationUpdateUserProfileArgs = {
|
||||
export type XRankPlacement = {
|
||||
__typename?: 'XRankPlacement';
|
||||
id: Scalars['Int'];
|
||||
playerId: Scalars['String'];
|
||||
switchAccountId: Scalars['String'];
|
||||
playerName: Scalars['String'];
|
||||
ranking: Scalars['Int'];
|
||||
xPower: Scalars['Float'];
|
||||
@@ -96,9 +96,8 @@ export type XRankPlacement = {
|
||||
|
||||
export type Player = {
|
||||
__typename?: 'Player';
|
||||
playerId: Scalars['String'];
|
||||
/** Set of names player has had in Top 500 results. The most recent one is the first one of the list. */
|
||||
names: Array<Scalars['String']>;
|
||||
switchAccountId: Scalars['String'];
|
||||
name: Scalars['String'];
|
||||
user?: Maybe<User>;
|
||||
placements: Array<XRankPlacement>;
|
||||
};
|
||||
@@ -120,18 +119,18 @@ export enum RankedMode {
|
||||
|
||||
export type XRankPlacementWhereUniqueInput = {
|
||||
id?: Maybe<Scalars['Int']>;
|
||||
playerId_mode_month_year?: Maybe<PlayerIdModeMonthYearCompoundUniqueInput>;
|
||||
switchAccountId_mode_month_year?: Maybe<SwitchAccountIdModeMonthYearCompoundUniqueInput>;
|
||||
};
|
||||
|
||||
export type PlayerIdModeMonthYearCompoundUniqueInput = {
|
||||
playerId: Scalars['String'];
|
||||
export type SwitchAccountIdModeMonthYearCompoundUniqueInput = {
|
||||
switchAccountId: Scalars['String'];
|
||||
mode: RankedMode;
|
||||
month: Scalars['Int'];
|
||||
year: Scalars['Int'];
|
||||
};
|
||||
|
||||
export type GetPlayersXRankPlacementsQueryVariables = Exact<{
|
||||
playerId: Scalars['String'];
|
||||
switchAccountId: Scalars['String'];
|
||||
}>;
|
||||
|
||||
|
||||
@@ -188,7 +187,7 @@ export type GetXRankPlacementsQuery = (
|
||||
{ __typename?: 'Query' }
|
||||
& { getXRankPlacements: Array<(
|
||||
{ __typename?: 'XRankPlacement' }
|
||||
& Pick<XRankPlacement, 'playerId' | 'playerName' | 'ranking' | 'xPower' | 'weapon' | 'mode'>
|
||||
& Pick<XRankPlacement, 'switchAccountId' | 'playerName' | 'ranking' | 'xPower' | 'weapon' | 'mode'>
|
||||
& { player: (
|
||||
{ __typename?: 'Player' }
|
||||
& { user?: Maybe<(
|
||||
@@ -201,8 +200,8 @@ export type GetXRankPlacementsQuery = (
|
||||
|
||||
|
||||
export const GetPlayersXRankPlacementsDocument = gql`
|
||||
query getPlayersXRankPlacements($playerId: String!) {
|
||||
getPlayersXRankPlacements(playerId: $playerId) {
|
||||
query getPlayersXRankPlacements($switchAccountId: String!) {
|
||||
getPlayersXRankPlacements(switchAccountId: $switchAccountId) {
|
||||
id
|
||||
playerName
|
||||
ranking
|
||||
@@ -234,7 +233,7 @@ export const GetPlayersXRankPlacementsDocument = gql`
|
||||
* @example
|
||||
* const { data, loading, error } = useGetPlayersXRankPlacementsQuery({
|
||||
* variables: {
|
||||
* playerId: // value for 'playerId'
|
||||
* switchAccountId: // value for 'switchAccountId'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
@@ -326,7 +325,7 @@ export type GetUserByIdentifierQueryResult = Apollo.QueryResult<GetUserByIdentif
|
||||
export const GetXRankPlacementsDocument = gql`
|
||||
query getXRankPlacements($month: Int!, $year: Int!, $mode: RankedMode!) {
|
||||
getXRankPlacements(month: $month, year: $year, mode: $mode) {
|
||||
playerId
|
||||
switchAccountId
|
||||
playerName
|
||||
ranking
|
||||
xPower
|
||||
|
||||
@@ -4,7 +4,7 @@ export const XRankPlacmement = objectType({
|
||||
name: "XRankPlacement",
|
||||
definition(t) {
|
||||
t.model.id();
|
||||
t.model.playerId();
|
||||
t.model.switchAccountId();
|
||||
t.model.playerName();
|
||||
t.model.ranking();
|
||||
t.model.xPower();
|
||||
@@ -19,11 +19,8 @@ export const XRankPlacmement = objectType({
|
||||
export const Player = objectType({
|
||||
name: "Player",
|
||||
definition(t) {
|
||||
t.model.playerId();
|
||||
t.model.names({
|
||||
description:
|
||||
"Set of names player has had in Top 500 results. The most recent one is the first one of the list.",
|
||||
});
|
||||
t.model.switchAccountId();
|
||||
t.model.name();
|
||||
t.model.user();
|
||||
t.model.placements();
|
||||
},
|
||||
@@ -55,11 +52,11 @@ export const Query = extendType({
|
||||
nullable: false,
|
||||
list: [true],
|
||||
args: {
|
||||
playerId: stringArg({ nullable: false }),
|
||||
switchAccountId: stringArg({ nullable: false }),
|
||||
},
|
||||
resolve: (_root, args, ctx) => {
|
||||
return ctx.prisma.xRankPlacement.findMany({
|
||||
where: { playerId: args.playerId },
|
||||
where: { switchAccountId: args.switchAccountId },
|
||||
orderBy: [{ month: "desc" }, { year: "desc" }],
|
||||
});
|
||||
},
|
||||
|
||||
@@ -20,10 +20,10 @@ declare global {
|
||||
}
|
||||
|
||||
export interface NexusGenInputs {
|
||||
PlayerIdModeMonthYearCompoundUniqueInput: { // input type
|
||||
SwitchAccountIdModeMonthYearCompoundUniqueInput: { // input type
|
||||
mode: NexusGenEnums['RankedMode']; // RankedMode!
|
||||
month: number; // Int!
|
||||
playerId: string; // String!
|
||||
switchAccountId: string; // String!
|
||||
year: number; // Int!
|
||||
}
|
||||
UpdateUserProfileInput: { // input type
|
||||
@@ -39,7 +39,7 @@ export interface NexusGenInputs {
|
||||
}
|
||||
XRankPlacementWhereUniqueInput: { // input type
|
||||
id?: number | null; // Int
|
||||
playerId_mode_month_year?: NexusGenInputs['PlayerIdModeMonthYearCompoundUniqueInput'] | null; // PlayerIdModeMonthYearCompoundUniqueInput
|
||||
switchAccountId_mode_month_year?: NexusGenInputs['SwitchAccountIdModeMonthYearCompoundUniqueInput'] | null; // SwitchAccountIdModeMonthYearCompoundUniqueInput
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ export interface NexusGenRootTypes {
|
||||
}
|
||||
|
||||
export interface NexusGenAllTypes extends NexusGenRootTypes {
|
||||
PlayerIdModeMonthYearCompoundUniqueInput: NexusGenInputs['PlayerIdModeMonthYearCompoundUniqueInput'];
|
||||
SwitchAccountIdModeMonthYearCompoundUniqueInput: NexusGenInputs['SwitchAccountIdModeMonthYearCompoundUniqueInput'];
|
||||
UpdateUserProfileInput: NexusGenInputs['UpdateUserProfileInput'];
|
||||
XRankPlacementWhereUniqueInput: NexusGenInputs['XRankPlacementWhereUniqueInput'];
|
||||
RankedMode: NexusGenEnums['RankedMode'];
|
||||
@@ -81,9 +81,9 @@ export interface NexusGenFieldTypes {
|
||||
updateUserProfile: boolean; // Boolean!
|
||||
}
|
||||
Player: { // field return type
|
||||
names: string[]; // [String!]!
|
||||
name: string; // String!
|
||||
placements: NexusGenRootTypes['XRankPlacement'][]; // [XRankPlacement!]!
|
||||
playerId: string; // String!
|
||||
switchAccountId: string; // String!
|
||||
user: NexusGenRootTypes['User'] | null; // User
|
||||
}
|
||||
Profile: { // field return type
|
||||
@@ -115,9 +115,9 @@ export interface NexusGenFieldTypes {
|
||||
mode: NexusGenEnums['RankedMode']; // RankedMode!
|
||||
month: number; // Int!
|
||||
player: NexusGenRootTypes['Player']; // Player!
|
||||
playerId: string; // String!
|
||||
playerName: string; // String!
|
||||
ranking: number; // Int!
|
||||
switchAccountId: string; // String!
|
||||
weapon: string; // String!
|
||||
xPower: number; // Float!
|
||||
year: number; // Int!
|
||||
@@ -129,9 +129,9 @@ export interface NexusGenFieldTypeNames {
|
||||
updateUserProfile: 'Boolean'
|
||||
}
|
||||
Player: { // field return type name
|
||||
names: 'String'
|
||||
name: 'String'
|
||||
placements: 'XRankPlacement'
|
||||
playerId: 'String'
|
||||
switchAccountId: 'String'
|
||||
user: 'User'
|
||||
}
|
||||
Profile: { // field return type name
|
||||
@@ -163,9 +163,9 @@ export interface NexusGenFieldTypeNames {
|
||||
mode: 'RankedMode'
|
||||
month: 'Int'
|
||||
player: 'Player'
|
||||
playerId: 'String'
|
||||
playerName: 'String'
|
||||
ranking: 'Int'
|
||||
switchAccountId: 'String'
|
||||
weapon: 'String'
|
||||
xPower: 'Float'
|
||||
year: 'Int'
|
||||
@@ -188,7 +188,7 @@ export interface NexusGenArgTypes {
|
||||
}
|
||||
Query: {
|
||||
getPlayersXRankPlacements: { // args
|
||||
playerId: string; // String!
|
||||
switchAccountId: string; // String!
|
||||
}
|
||||
getUserByIdentifier: { // args
|
||||
identifier: string; // String!
|
||||
@@ -208,7 +208,7 @@ export interface NexusGenInheritedFields {}
|
||||
|
||||
export type NexusGenObjectNames = "Mutation" | "Player" | "Profile" | "Query" | "User" | "XRankPlacement";
|
||||
|
||||
export type NexusGenInputNames = "PlayerIdModeMonthYearCompoundUniqueInput" | "UpdateUserProfileInput" | "XRankPlacementWhereUniqueInput";
|
||||
export type NexusGenInputNames = "SwitchAccountIdModeMonthYearCompoundUniqueInput" | "UpdateUserProfileInput" | "XRankPlacementWhereUniqueInput";
|
||||
|
||||
export type NexusGenEnumNames = "RankedMode";
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ const prisma = new PrismaClient();
|
||||
export const getStaticPaths: GetStaticPaths = async () => {
|
||||
const players = await prisma.player.findMany({});
|
||||
return {
|
||||
paths: players.map((p) => ({ params: { id: p.playerId } })),
|
||||
paths: players.map((p) => ({ params: { id: p.switchAccountId } })),
|
||||
fallback: true,
|
||||
};
|
||||
};
|
||||
@@ -27,7 +27,7 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
|
||||
query: GetPlayersXRankPlacementsDocument,
|
||||
variables: {
|
||||
// FIXME: why ! needed?
|
||||
playerId: params!.id,
|
||||
switchAccountId: params!.id,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -37,17 +37,17 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
|
||||
return {
|
||||
props: {
|
||||
initialApolloState: apolloClient.cache.extract(),
|
||||
playerId: params!.id,
|
||||
switchAccountId: params!.id,
|
||||
},
|
||||
//notfound
|
||||
};
|
||||
};
|
||||
|
||||
const PlayerPage = ({ playerId }: { playerId: string }) => {
|
||||
const PlayerPage = ({ switchAccountId }: { switchAccountId: string }) => {
|
||||
const router = useRouter();
|
||||
|
||||
const { data } = useGetPlayersXRankPlacementsQuery({
|
||||
variables: { playerId },
|
||||
variables: { switchAccountId },
|
||||
skip: router.isFallback,
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Migration `20201028083612-init`
|
||||
# Migration `20201103144752-init`
|
||||
|
||||
This migration has been generated by Kalle (Sendou) at 10/28/2020, 10:36:12 AM.
|
||||
This migration has been generated by Kalle (Sendou) at 11/3/2020, 4:47:52 PM.
|
||||
You can check out the [state of the schema](./schema.prisma) after the migration.
|
||||
|
||||
## Database Steps
|
||||
@@ -30,9 +30,8 @@ CREATE TABLE "public"."Profile" (
|
||||
|
||||
CREATE TABLE "public"."XRankPlacement" (
|
||||
"id" SERIAL,
|
||||
"playerId" text NOT NULL ,
|
||||
"switchAccountId" 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 ,
|
||||
@@ -43,9 +42,9 @@ PRIMARY KEY ("id")
|
||||
)
|
||||
|
||||
CREATE TABLE "public"."Player" (
|
||||
"playerId" text NOT NULL ,
|
||||
"switchAccountId" text NOT NULL ,
|
||||
"userId" integer ,
|
||||
"names" text []
|
||||
"name" text NOT NULL
|
||||
)
|
||||
|
||||
CREATE UNIQUE INDEX "User.discordId_unique" ON "public"."User"("discordId")
|
||||
@@ -54,17 +53,15 @@ CREATE UNIQUE INDEX "Profile.customUrlPath_unique" ON "public"."Profile"("custom
|
||||
|
||||
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 UNIQUE INDEX "XRankPlacement.switchAccountId_mode_month_year_unique" ON "public"."XRankPlacement"("switchAccountId", "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.switchAccountId_unique" ON "public"."Player"("switchAccountId")
|
||||
|
||||
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"."XRankPlacement" ADD FOREIGN KEY("switchAccountId")REFERENCES "public"."Player"("switchAccountId") 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
|
||||
```
|
||||
@@ -73,10 +70,10 @@ ALTER TABLE "public"."Player" ADD FOREIGN KEY("userId")REFERENCES "public"."User
|
||||
|
||||
```diff
|
||||
diff --git schema.prisma schema.prisma
|
||||
migration ..20201028083612-init
|
||||
migration ..20201103144752-init
|
||||
--- datamodel.dml
|
||||
+++ datamodel.dml
|
||||
@@ -1,0 +1,66 @@
|
||||
@@ -1,0 +1,64 @@
|
||||
+datasource db {
|
||||
+ provider = "postgresql"
|
||||
+ // FIXME: should use same .env system as Next.JS
|
||||
@@ -121,10 +118,9 @@ migration ..20201028083612-init
|
||||
+
|
||||
+model XRankPlacement {
|
||||
+ id Int @id @default(autoincrement())
|
||||
+ playerId String
|
||||
+ player Player @relation(fields: [playerId], references: [playerId])
|
||||
+ switchAccountId String
|
||||
+ player Player @relation(fields: [switchAccountId], references: [switchAccountId])
|
||||
+ playerName String
|
||||
+ playerNameLower String
|
||||
+ ranking Int
|
||||
+ xPower Float
|
||||
+ weapon String
|
||||
@@ -132,16 +128,15 @@ migration ..20201028083612-init
|
||||
+ month Int
|
||||
+ year Int
|
||||
+
|
||||
+ @@unique([playerId, mode, month, year])
|
||||
+ @@index([playerNameLower])
|
||||
+ @@unique([switchAccountId, mode, month, year])
|
||||
+}
|
||||
+
|
||||
+model Player {
|
||||
+ playerId String @unique
|
||||
+ user User? @relation(fields: [userId], references: [id])
|
||||
+ userId Int? @unique
|
||||
+ names String[]
|
||||
+ placements XRankPlacement[]
|
||||
+ switchAccountId String @unique
|
||||
+ user User? @relation(fields: [userId], references: [id])
|
||||
+ userId Int? @unique
|
||||
+ name String
|
||||
+ placements XRankPlacement[]
|
||||
+}
|
||||
```
|
||||
|
||||
@@ -42,10 +42,9 @@ enum RankedMode {
|
||||
|
||||
model XRankPlacement {
|
||||
id Int @id @default(autoincrement())
|
||||
playerId String
|
||||
player Player @relation(fields: [playerId], references: [playerId])
|
||||
switchAccountId String
|
||||
player Player @relation(fields: [switchAccountId], references: [switchAccountId])
|
||||
playerName String
|
||||
playerNameLower String
|
||||
ranking Int
|
||||
xPower Float
|
||||
weapon String
|
||||
@@ -53,14 +52,13 @@ model XRankPlacement {
|
||||
month Int
|
||||
year Int
|
||||
|
||||
@@unique([playerId, mode, month, year])
|
||||
@@index([playerNameLower])
|
||||
@@unique([switchAccountId, mode, month, year])
|
||||
}
|
||||
|
||||
model Player {
|
||||
playerId String @unique
|
||||
user User? @relation(fields: [userId], references: [id])
|
||||
userId Int? @unique
|
||||
names String[]
|
||||
placements XRankPlacement[]
|
||||
switchAccountId String @unique
|
||||
user User? @relation(fields: [userId], references: [id])
|
||||
userId Int? @unique
|
||||
name String
|
||||
placements XRankPlacement[]
|
||||
}
|
||||
@@ -325,7 +325,7 @@
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "XRankPlacement",
|
||||
"field": "playerId",
|
||||
"field": "switchAccountId",
|
||||
"type": "String",
|
||||
"arity": "Required"
|
||||
},
|
||||
@@ -359,7 +359,7 @@
|
||||
"directive": "relation"
|
||||
},
|
||||
"argument": "fields",
|
||||
"value": "[playerId]"
|
||||
"value": "[switchAccountId]"
|
||||
},
|
||||
{
|
||||
"tag": "CreateArgument",
|
||||
@@ -373,7 +373,7 @@
|
||||
"directive": "relation"
|
||||
},
|
||||
"argument": "references",
|
||||
"value": "[playerId]"
|
||||
"value": "[switchAccountId]"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
@@ -382,13 +382,6 @@
|
||||
"type": "String",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "XRankPlacement",
|
||||
"field": "playerNameLower",
|
||||
"type": "String",
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "XRankPlacement",
|
||||
@@ -440,29 +433,13 @@
|
||||
"arguments": [
|
||||
{
|
||||
"name": "",
|
||||
"value": "[playerId, mode, month, year]"
|
||||
"value": "[switchAccountId, mode, month, year]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"directive": "unique"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "CreateDirective",
|
||||
"location": {
|
||||
"path": {
|
||||
"tag": "Model",
|
||||
"model": "XRankPlacement",
|
||||
"arguments": [
|
||||
{
|
||||
"name": "",
|
||||
"value": "[playerNameLower]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"directive": "index"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "CreateModel",
|
||||
"model": "Player"
|
||||
@@ -470,7 +447,7 @@
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "Player",
|
||||
"field": "playerId",
|
||||
"field": "switchAccountId",
|
||||
"type": "String",
|
||||
"arity": "Required"
|
||||
},
|
||||
@@ -480,7 +457,7 @@
|
||||
"path": {
|
||||
"tag": "Field",
|
||||
"model": "Player",
|
||||
"field": "playerId"
|
||||
"field": "switchAccountId"
|
||||
},
|
||||
"directive": "unique"
|
||||
}
|
||||
@@ -552,9 +529,9 @@
|
||||
{
|
||||
"tag": "CreateField",
|
||||
"model": "Player",
|
||||
"field": "names",
|
||||
"field": "name",
|
||||
"type": "String",
|
||||
"arity": "List"
|
||||
"arity": "Required"
|
||||
},
|
||||
{
|
||||
"tag": "CreateField",
|
||||
@@ -1,3 +1,3 @@
|
||||
# Prisma Migrate lockfile v1
|
||||
|
||||
20201028083612-init
|
||||
20201103144752-init
|
||||
@@ -42,10 +42,9 @@ enum RankedMode {
|
||||
|
||||
model XRankPlacement {
|
||||
id Int @id @default(autoincrement())
|
||||
playerId String
|
||||
player Player @relation(fields: [playerId], references: [playerId])
|
||||
switchAccountId String
|
||||
player Player @relation(fields: [switchAccountId], references: [switchAccountId])
|
||||
playerName String
|
||||
playerNameLower String
|
||||
ranking Int
|
||||
xPower Float
|
||||
weapon String
|
||||
@@ -53,14 +52,13 @@ model XRankPlacement {
|
||||
month Int
|
||||
year Int
|
||||
|
||||
@@unique([playerId, mode, month, year])
|
||||
@@index([playerNameLower])
|
||||
@@unique([switchAccountId, mode, month, year])
|
||||
}
|
||||
|
||||
model Player {
|
||||
playerId String @unique
|
||||
user User? @relation(fields: [userId], references: [id])
|
||||
userId Int? @unique
|
||||
names String[]
|
||||
placements XRankPlacement[]
|
||||
switchAccountId String @unique
|
||||
user User? @relation(fields: [userId], references: [id])
|
||||
userId Int? @unique
|
||||
name String
|
||||
placements XRankPlacement[]
|
||||
}
|
||||
|
||||
@@ -75,7 +75,6 @@ const main = async () => {
|
||||
return prisma.xRankPlacement.create({
|
||||
data: {
|
||||
playerName,
|
||||
playerNameLower: i % 2 === 0 ? `player${i}` : `選手${i}`,
|
||||
mode: getMode(i),
|
||||
month: 12,
|
||||
year: 2020,
|
||||
@@ -84,8 +83,8 @@ const main = async () => {
|
||||
weapon: "Splattershot Jr.",
|
||||
player: {
|
||||
create: {
|
||||
playerId: "" + i,
|
||||
names: [playerName],
|
||||
switchAccountId: "" + i,
|
||||
name: playerName,
|
||||
user:
|
||||
i === 0
|
||||
? {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
query getPlayersXRankPlacements($playerId: String!) {
|
||||
getPlayersXRankPlacements(playerId: $playerId) {
|
||||
query getPlayersXRankPlacements($switchAccountId: String!) {
|
||||
getPlayersXRankPlacements(switchAccountId: $switchAccountId) {
|
||||
id
|
||||
playerName
|
||||
ranking
|
||||
|
||||
@@ -47,7 +47,7 @@ const XSearch: React.FC<Props> = ({ placements }) => {
|
||||
<TableBody>
|
||||
{placements.map((record) => {
|
||||
return (
|
||||
<TableRow key={record.playerId}>
|
||||
<TableRow key={record.switchAccountId}>
|
||||
<TableCell color={gray}>
|
||||
{getRankingString(record.ranking)}
|
||||
</TableCell>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
query getXRankPlacements($month: Int!, $year: Int!, $mode: RankedMode!) {
|
||||
getXRankPlacements(month: $month, year: $year, mode: $mode) {
|
||||
playerId
|
||||
switchAccountId
|
||||
playerName
|
||||
ranking
|
||||
xPower
|
||||
|
||||
@@ -7,22 +7,12 @@ type Mutation {
|
||||
}
|
||||
|
||||
type Player {
|
||||
"""
|
||||
Set of names player has had in Top 500 results. The most recent one is the first one of the list.
|
||||
"""
|
||||
names: [String!]!
|
||||
name: String!
|
||||
placements(after: XRankPlacementWhereUniqueInput, before: XRankPlacementWhereUniqueInput, first: Int, last: Int): [XRankPlacement!]!
|
||||
playerId: String!
|
||||
switchAccountId: String!
|
||||
user: User
|
||||
}
|
||||
|
||||
input PlayerIdModeMonthYearCompoundUniqueInput {
|
||||
mode: RankedMode!
|
||||
month: Int!
|
||||
playerId: String!
|
||||
year: Int!
|
||||
}
|
||||
|
||||
type Profile {
|
||||
bio: String
|
||||
country: String
|
||||
@@ -36,7 +26,7 @@ type Profile {
|
||||
}
|
||||
|
||||
type Query {
|
||||
getPlayersXRankPlacements(playerId: String!): [XRankPlacement!]!
|
||||
getPlayersXRankPlacements(switchAccountId: String!): [XRankPlacement!]!
|
||||
getUserByIdentifier(identifier: String!): User
|
||||
getXRankPlacements(mode: RankedMode!, month: Int!, year: Int!): [XRankPlacement!]!
|
||||
}
|
||||
@@ -48,6 +38,13 @@ enum RankedMode {
|
||||
TC
|
||||
}
|
||||
|
||||
input SwitchAccountIdModeMonthYearCompoundUniqueInput {
|
||||
mode: RankedMode!
|
||||
month: Int!
|
||||
switchAccountId: String!
|
||||
year: Int!
|
||||
}
|
||||
|
||||
input UpdateUserProfileInput {
|
||||
bio: String
|
||||
country: String
|
||||
@@ -74,9 +71,9 @@ type XRankPlacement {
|
||||
mode: RankedMode!
|
||||
month: Int!
|
||||
player: Player!
|
||||
playerId: String!
|
||||
playerName: String!
|
||||
ranking: Int!
|
||||
switchAccountId: String!
|
||||
weapon: String!
|
||||
xPower: Float!
|
||||
year: Int!
|
||||
@@ -84,5 +81,5 @@ type XRankPlacement {
|
||||
|
||||
input XRankPlacementWhereUniqueInput {
|
||||
id: Int
|
||||
playerId_mode_month_year: PlayerIdModeMonthYearCompoundUniqueInput
|
||||
switchAccountId_mode_month_year: SwitchAccountIdModeMonthYearCompoundUniqueInput
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user