xp update

This commit is contained in:
Seroxdesign
2023-08-09 12:07:07 -04:00
parent 3549798f0a
commit f81dd7767a
8 changed files with 1283 additions and 1770 deletions

View File

@@ -16,7 +16,7 @@ COPY packages/backend/*.json ./packages/backend/
COPY packages/utils/*.json ./packages/utils/
COPY packages/discord-bot/*.json ./packages/discord-bot/
RUN yarn install --pure-lockfile
RUN yarn install --pure-lockfile --network-timeout 1000000000
# Dev environment doesn't run this stage or beyond
FROM base as build

View File

@@ -0,0 +1 @@
ALTER TABLE "public"."xp" DROP COLUMN "initial";

View File

@@ -0,0 +1 @@
ALTER TABLE "public"."xp" ADD COLUMN "initial" float8 NULL DEFAULT 0;

View File

@@ -76,9 +76,9 @@ export default async (req: Request, res: Response): Promise<void> => {
await Promise.all(players.map( async (player) => {
const total = await client.GetTotalForPlayer({ tokenAddress: address, playerAddress: player.Player.ethereumAddress })
const balance = total.balance_aggregate.aggregate?.sum?.amount
if (balance != null) {
await client.UpsertXP({ balance: total.balance_aggregate.aggregate?.sum?.amount, playerId: player.Player.id, tokenAddress: address })
}
const { xp: [{ initial } = { initial: 0 }] } = await client.GetInitialXP({ playerId: player.Player.id })
console.log({initial})
await client.UpsertXP({ balance: (balance ?? 0) + initial, playerId: player.Player.id, tokenAddress: address })
}))
}),
);

View File

@@ -25,4 +25,10 @@ export const TokenQueries = /* GraphQL */ `
}
}
}
query GetInitialXP($playerId: uuid!) {
xp(where: {playerId: {_eq: $playerId}}) {
initial
}
}
`;

File diff suppressed because it is too large Load Diff

View File

@@ -10615,6 +10615,7 @@ export type Uuid_Comparison_Exp = {
export type Xp = {
balance: Scalars['float8'];
id: Scalars['uuid'];
initial?: Maybe<Scalars['float8']>;
/** An object relationship */
player: Player;
playerId: Scalars['uuid'];
@@ -10674,11 +10675,13 @@ export type Xp_Arr_Rel_Insert_Input = {
/** aggregate avg on columns */
export type Xp_Avg_Fields = {
balance?: Maybe<Scalars['Float']>;
initial?: Maybe<Scalars['Float']>;
};
/** order by avg() on columns of table "xp" */
export type Xp_Avg_Order_By = {
balance?: InputMaybe<Order_By>;
initial?: InputMaybe<Order_By>;
};
/** Boolean expression to filter rows from the table "xp". All fields are combined with a logical 'AND'. */
@@ -10688,6 +10691,7 @@ export type Xp_Bool_Exp = {
_or?: InputMaybe<Array<InputMaybe<Xp_Bool_Exp>>>;
balance?: InputMaybe<Float8_Comparison_Exp>;
id?: InputMaybe<Uuid_Comparison_Exp>;
initial?: InputMaybe<Float8_Comparison_Exp>;
player?: InputMaybe<Player_Bool_Exp>;
playerId?: InputMaybe<Uuid_Comparison_Exp>;
token?: InputMaybe<Token_Bool_Exp>;
@@ -10705,12 +10709,14 @@ export enum Xp_Constraint {
/** input type for incrementing integer column in table "xp" */
export type Xp_Inc_Input = {
balance?: InputMaybe<Scalars['float8']>;
initial?: InputMaybe<Scalars['float8']>;
};
/** input type for inserting data into table "xp" */
export type Xp_Insert_Input = {
balance?: InputMaybe<Scalars['float8']>;
id?: InputMaybe<Scalars['uuid']>;
initial?: InputMaybe<Scalars['float8']>;
player?: InputMaybe<Player_Obj_Rel_Insert_Input>;
playerId?: InputMaybe<Scalars['uuid']>;
token?: InputMaybe<Token_Obj_Rel_Insert_Input>;
@@ -10721,6 +10727,7 @@ export type Xp_Insert_Input = {
export type Xp_Max_Fields = {
balance?: Maybe<Scalars['float8']>;
id?: Maybe<Scalars['uuid']>;
initial?: Maybe<Scalars['float8']>;
playerId?: Maybe<Scalars['uuid']>;
tokenAddress?: Maybe<Scalars['String']>;
};
@@ -10729,6 +10736,7 @@ export type Xp_Max_Fields = {
export type Xp_Max_Order_By = {
balance?: InputMaybe<Order_By>;
id?: InputMaybe<Order_By>;
initial?: InputMaybe<Order_By>;
playerId?: InputMaybe<Order_By>;
tokenAddress?: InputMaybe<Order_By>;
};
@@ -10737,6 +10745,7 @@ export type Xp_Max_Order_By = {
export type Xp_Min_Fields = {
balance?: Maybe<Scalars['float8']>;
id?: Maybe<Scalars['uuid']>;
initial?: Maybe<Scalars['float8']>;
playerId?: Maybe<Scalars['uuid']>;
tokenAddress?: Maybe<Scalars['String']>;
};
@@ -10745,6 +10754,7 @@ export type Xp_Min_Fields = {
export type Xp_Min_Order_By = {
balance?: InputMaybe<Order_By>;
id?: InputMaybe<Order_By>;
initial?: InputMaybe<Order_By>;
playerId?: InputMaybe<Order_By>;
tokenAddress?: InputMaybe<Order_By>;
};
@@ -10774,6 +10784,7 @@ export type Xp_On_Conflict = {
export type Xp_Order_By = {
balance?: InputMaybe<Order_By>;
id?: InputMaybe<Order_By>;
initial?: InputMaybe<Order_By>;
player?: InputMaybe<Player_Order_By>;
playerId?: InputMaybe<Order_By>;
token?: InputMaybe<Token_Order_By>;
@@ -10792,6 +10803,8 @@ export enum Xp_Select_Column {
/** column name */
Id = 'id',
/** column name */
Initial = 'initial',
/** column name */
PlayerId = 'playerId',
/** column name */
TokenAddress = 'tokenAddress',
@@ -10801,6 +10814,7 @@ export enum Xp_Select_Column {
export type Xp_Set_Input = {
balance?: InputMaybe<Scalars['float8']>;
id?: InputMaybe<Scalars['uuid']>;
initial?: InputMaybe<Scalars['float8']>;
playerId?: InputMaybe<Scalars['uuid']>;
tokenAddress?: InputMaybe<Scalars['String']>;
};
@@ -10808,41 +10822,49 @@ export type Xp_Set_Input = {
/** aggregate stddev on columns */
export type Xp_Stddev_Fields = {
balance?: Maybe<Scalars['Float']>;
initial?: Maybe<Scalars['Float']>;
};
/** order by stddev() on columns of table "xp" */
export type Xp_Stddev_Order_By = {
balance?: InputMaybe<Order_By>;
initial?: InputMaybe<Order_By>;
};
/** aggregate stddev_pop on columns */
export type Xp_Stddev_Pop_Fields = {
balance?: Maybe<Scalars['Float']>;
initial?: Maybe<Scalars['Float']>;
};
/** order by stddev_pop() on columns of table "xp" */
export type Xp_Stddev_Pop_Order_By = {
balance?: InputMaybe<Order_By>;
initial?: InputMaybe<Order_By>;
};
/** aggregate stddev_samp on columns */
export type Xp_Stddev_Samp_Fields = {
balance?: Maybe<Scalars['Float']>;
initial?: Maybe<Scalars['Float']>;
};
/** order by stddev_samp() on columns of table "xp" */
export type Xp_Stddev_Samp_Order_By = {
balance?: InputMaybe<Order_By>;
initial?: InputMaybe<Order_By>;
};
/** aggregate sum on columns */
export type Xp_Sum_Fields = {
balance?: Maybe<Scalars['float8']>;
initial?: Maybe<Scalars['float8']>;
};
/** order by sum() on columns of table "xp" */
export type Xp_Sum_Order_By = {
balance?: InputMaybe<Order_By>;
initial?: InputMaybe<Order_By>;
};
/** update columns of table "xp" */
@@ -10852,6 +10874,8 @@ export enum Xp_Update_Column {
/** column name */
Id = 'id',
/** column name */
Initial = 'initial',
/** column name */
PlayerId = 'playerId',
/** column name */
TokenAddress = 'tokenAddress',
@@ -10860,31 +10884,37 @@ export enum Xp_Update_Column {
/** aggregate var_pop on columns */
export type Xp_Var_Pop_Fields = {
balance?: Maybe<Scalars['Float']>;
initial?: Maybe<Scalars['Float']>;
};
/** order by var_pop() on columns of table "xp" */
export type Xp_Var_Pop_Order_By = {
balance?: InputMaybe<Order_By>;
initial?: InputMaybe<Order_By>;
};
/** aggregate var_samp on columns */
export type Xp_Var_Samp_Fields = {
balance?: Maybe<Scalars['Float']>;
initial?: Maybe<Scalars['Float']>;
};
/** order by var_samp() on columns of table "xp" */
export type Xp_Var_Samp_Order_By = {
balance?: InputMaybe<Order_By>;
initial?: InputMaybe<Order_By>;
};
/** aggregate variance on columns */
export type Xp_Variance_Fields = {
balance?: Maybe<Scalars['Float']>;
initial?: Maybe<Scalars['Float']>;
};
/** order by variance() on columns of table "xp" */
export type Xp_Variance_Order_By = {
balance?: InputMaybe<Order_By>;
initial?: InputMaybe<Order_By>;
};
export type PlayerFragment = {

View File

@@ -13441,6 +13441,7 @@ columns and relationships of "xp"
type xp {
balance: float8!
id: uuid!
initial: float8
"""An object relationship"""
player: player!
@@ -13504,6 +13505,7 @@ input xp_arr_rel_insert_input {
"""aggregate avg on columns"""
type xp_avg_fields {
balance: Float
initial: Float
}
"""
@@ -13511,6 +13513,7 @@ order by avg() on columns of table "xp"
"""
input xp_avg_order_by {
balance: order_by
initial: order_by
}
"""
@@ -13522,6 +13525,7 @@ input xp_bool_exp {
_or: [xp_bool_exp]
balance: float8_comparison_exp
id: uuid_comparison_exp
initial: float8_comparison_exp
player: player_bool_exp
playerId: uuid_comparison_exp
token: token_bool_exp
@@ -13544,6 +13548,7 @@ input type for incrementing integer column in table "xp"
"""
input xp_inc_input {
balance: float8
initial: float8
}
"""
@@ -13552,6 +13557,7 @@ input type for inserting data into table "xp"
input xp_insert_input {
balance: float8
id: uuid
initial: float8
player: player_obj_rel_insert_input
playerId: uuid
token: token_obj_rel_insert_input
@@ -13562,6 +13568,7 @@ input xp_insert_input {
type xp_max_fields {
balance: float8
id: uuid
initial: float8
playerId: uuid
tokenAddress: String
}
@@ -13572,6 +13579,7 @@ order by max() on columns of table "xp"
input xp_max_order_by {
balance: order_by
id: order_by
initial: order_by
playerId: order_by
tokenAddress: order_by
}
@@ -13580,6 +13588,7 @@ input xp_max_order_by {
type xp_min_fields {
balance: float8
id: uuid
initial: float8
playerId: uuid
tokenAddress: String
}
@@ -13590,6 +13599,7 @@ order by min() on columns of table "xp"
input xp_min_order_by {
balance: order_by
id: order_by
initial: order_by
playerId: order_by
tokenAddress: order_by
}
@@ -13628,6 +13638,7 @@ ordering options when selecting data from "xp"
input xp_order_by {
balance: order_by
id: order_by
initial: order_by
player: player_order_by
playerId: order_by
token: token_order_by
@@ -13651,6 +13662,9 @@ enum xp_select_column {
"""column name"""
id
"""column name"""
initial
"""column name"""
playerId
@@ -13664,6 +13678,7 @@ input type for updating data in table "xp"
input xp_set_input {
balance: float8
id: uuid
initial: float8
playerId: uuid
tokenAddress: String
}
@@ -13671,6 +13686,7 @@ input xp_set_input {
"""aggregate stddev on columns"""
type xp_stddev_fields {
balance: Float
initial: Float
}
"""
@@ -13678,11 +13694,13 @@ order by stddev() on columns of table "xp"
"""
input xp_stddev_order_by {
balance: order_by
initial: order_by
}
"""aggregate stddev_pop on columns"""
type xp_stddev_pop_fields {
balance: Float
initial: Float
}
"""
@@ -13690,11 +13708,13 @@ order by stddev_pop() on columns of table "xp"
"""
input xp_stddev_pop_order_by {
balance: order_by
initial: order_by
}
"""aggregate stddev_samp on columns"""
type xp_stddev_samp_fields {
balance: Float
initial: Float
}
"""
@@ -13702,11 +13722,13 @@ order by stddev_samp() on columns of table "xp"
"""
input xp_stddev_samp_order_by {
balance: order_by
initial: order_by
}
"""aggregate sum on columns"""
type xp_sum_fields {
balance: float8
initial: float8
}
"""
@@ -13714,6 +13736,7 @@ order by sum() on columns of table "xp"
"""
input xp_sum_order_by {
balance: order_by
initial: order_by
}
"""
@@ -13726,6 +13749,9 @@ enum xp_update_column {
"""column name"""
id
"""column name"""
initial
"""column name"""
playerId
@@ -13736,6 +13762,7 @@ enum xp_update_column {
"""aggregate var_pop on columns"""
type xp_var_pop_fields {
balance: Float
initial: Float
}
"""
@@ -13743,11 +13770,13 @@ order by var_pop() on columns of table "xp"
"""
input xp_var_pop_order_by {
balance: order_by
initial: order_by
}
"""aggregate var_samp on columns"""
type xp_var_samp_fields {
balance: Float
initial: Float
}
"""
@@ -13755,11 +13784,13 @@ order by var_samp() on columns of table "xp"
"""
input xp_var_samp_order_by {
balance: order_by
initial: order_by
}
"""aggregate variance on columns"""
type xp_variance_fields {
balance: Float
initial: Float
}
"""
@@ -13767,5 +13798,6 @@ order by variance() on columns of table "xp"
"""
input xp_variance_order_by {
balance: order_by
initial: order_by
}