Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

テストデプロイ時に出たエラー #310

Merged
merged 9 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions api/migrations/default/1720521696814_auto/up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ ALTER TABLE ONLY public.prizes
ADD CONSTRAINT prizes_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.reach_logs
ADD CONSTRAINT reach_log_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.stamp_triggers
ADD CONSTRAINT stamp_triggers_name_key UNIQUE (name);
CREATE TRIGGER set_public_stamp_triggers_updated_at BEFORE UPDATE ON public.stamp_triggers FOR EACH ROW EXECUTE FUNCTION public.set_current_timestamp_updated_at();
COMMENT ON TRIGGER set_public_stamp_triggers_updated_at ON public.stamp_triggers IS 'trigger to set value of column "updated_at" to current timestamp on row update';
ALTER TABLE ONLY public.prizes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useState } from "react";
import styles from "./PrizeResult.module.css";
import { useMutation } from "@apollo/client";
import { UpdateOnePrizeIsWonDocument } from "@/type/graphql";
import Image from "next/image";
import type {
UpdateOnePrizeIsWonMutation,
UpdateOnePrizeIsWonMutationVariables,
Expand Down
2 changes: 1 addition & 1 deletion view-admin/src/gql/reach_log.gql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ query GetOneLatestReachLog {
}

# リーチログの最新のreachNumを継続取得(Subscription)
subscription SubscribeOneLatestReachlog {
subscription SubscribeOneLatestReachLog {
reachLogs(orderBy: { createdAt: DESC }, limit: 1) {
reachNum
}
Expand Down
58 changes: 0 additions & 58 deletions view-admin/src/type/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1154,12 +1154,6 @@ export type StampTriggersBoolExp = {
name?: InputMaybe<StringComparisonExp>;
};

/** unique or primary key constraints on table "stamp_triggers" */
export enum StampTriggersConstraint {
/** unique or primary key constraint on columns "id" */
stampTriggersPkey = "stamp_triggers_pkey",
}

/** input type for incrementing numeric columns in table "stamp_triggers" */
export type StampTriggersIncInput = {
id?: InputMaybe<Scalars["Int"]["input"]>;
Expand Down Expand Up @@ -1197,25 +1191,13 @@ export type StampTriggersMutationResponse = {
returning: Array<StampTriggers>;
};

/** on_conflict condition type for table "stamp_triggers" */
export type StampTriggersOnConflict = {
constraint: StampTriggersConstraint;
updateColumns?: Array<StampTriggersUpdateColumn>;
where?: InputMaybe<StampTriggersBoolExp>;
};

/** Ordering options when selecting data from "stamp_triggers". */
export type StampTriggersOrderBy = {
createdAt?: InputMaybe<OrderBy>;
id?: InputMaybe<OrderBy>;
name?: InputMaybe<OrderBy>;
};

/** primary key columns input for table: stamp_triggers */
export type StampTriggersPkColumnsInput = {
id: Scalars["Int"]["input"];
};

/** select columns of table "stamp_triggers" */
export enum StampTriggersSelectColumn {
/** column name */
Expand Down Expand Up @@ -1272,16 +1254,6 @@ export type StampTriggersSumFields = {
id?: Maybe<Scalars["Int"]["output"]>;
};

/** update columns of table "stamp_triggers" */
export enum StampTriggersUpdateColumn {
/** column name */
createdAt = "createdAt",
/** column name */
id = "id",
/** column name */
name = "name",
}

export type StampTriggersUpdates = {
/** increments the numeric columns with given value of the filtered values */
_inc?: InputMaybe<StampTriggersIncInput>;
Expand Down Expand Up @@ -1378,8 +1350,6 @@ export type MutationRoot = {
deleteReachLogsByPk?: Maybe<ReachLogs>;
/** delete data from the table: "stamp_triggers" */
deleteStampTriggers?: Maybe<StampTriggersMutationResponse>;
/** delete single row from the table: "stamp_triggers" */
deleteStampTriggersByPk?: Maybe<StampTriggers>;
/** execute VOLATILE function "increment_latest_reach_log" which returns "reach_logs" */
incrementLatestReachLog: Array<ReachLogs>;
/** insert data into the table: "images" */
Expand Down Expand Up @@ -1428,8 +1398,6 @@ export type MutationRoot = {
updateReachLogsMany?: Maybe<Array<Maybe<ReachLogsMutationResponse>>>;
/** update data of the table: "stamp_triggers" */
updateStampTriggers?: Maybe<StampTriggersMutationResponse>;
/** update single row of the table: "stamp_triggers" */
updateStampTriggersByPk?: Maybe<StampTriggers>;
/** update multiples rows of table: "stamp_triggers" */
updateStampTriggersMany?: Maybe<Array<Maybe<StampTriggersMutationResponse>>>;
};
Expand Down Expand Up @@ -1488,11 +1456,6 @@ export type MutationRootDeleteStampTriggersArgs = {
where: StampTriggersBoolExp;
};

/** mutation root */
export type MutationRootDeleteStampTriggersByPkArgs = {
id: Scalars["Int"]["input"];
};

/** mutation root */
export type MutationRootIncrementLatestReachLogArgs = {
distinctOn?: InputMaybe<Array<ReachLogsSelectColumn>>;
Expand Down Expand Up @@ -1553,13 +1516,11 @@ export type MutationRootInsertReachLogsOneArgs = {
/** mutation root */
export type MutationRootInsertStampTriggersArgs = {
objects: Array<StampTriggersInsertInput>;
onConflict?: InputMaybe<StampTriggersOnConflict>;
};

/** mutation root */
export type MutationRootInsertStampTriggersOneArgs = {
object: StampTriggersInsertInput;
onConflict?: InputMaybe<StampTriggersOnConflict>;
};

/** mutation root */
Expand Down Expand Up @@ -1645,13 +1606,6 @@ export type MutationRootUpdateStampTriggersArgs = {
where: StampTriggersBoolExp;
};

/** mutation root */
export type MutationRootUpdateStampTriggersByPkArgs = {
_inc?: InputMaybe<StampTriggersIncInput>;
_set?: InputMaybe<StampTriggersSetInput>;
pkColumns: StampTriggersPkColumnsInput;
};

/** mutation root */
export type MutationRootUpdateStampTriggersManyArgs = {
updates: Array<StampTriggersUpdates>;
Expand Down Expand Up @@ -1687,8 +1641,6 @@ export type QueryRoot = {
stampTriggers: Array<StampTriggers>;
/** fetch aggregated fields from the table: "stamp_triggers" */
stampTriggersAggregate: StampTriggersAggregate;
/** fetch data from the table: "stamp_triggers" using primary key columns */
stampTriggersByPk?: Maybe<StampTriggers>;
};

export type QueryRootImagesArgs = {
Expand Down Expand Up @@ -1787,10 +1739,6 @@ export type QueryRootStampTriggersAggregateArgs = {
where?: InputMaybe<StampTriggersBoolExp>;
};

export type QueryRootStampTriggersByPkArgs = {
id: Scalars["Int"]["input"];
};

export type SubscriptionRoot = {
__typename?: "subscription_root";
/** fetch data from the table: "images" */
Expand Down Expand Up @@ -1829,8 +1777,6 @@ export type SubscriptionRoot = {
stampTriggers: Array<StampTriggers>;
/** fetch aggregated fields from the table: "stamp_triggers" */
stampTriggersAggregate: StampTriggersAggregate;
/** fetch data from the table: "stamp_triggers" using primary key columns */
stampTriggersByPk?: Maybe<StampTriggers>;
/** fetch data from the table in a streaming manner: "stamp_triggers" */
stampTriggersStream: Array<StampTriggers>;
};
Expand Down Expand Up @@ -1955,10 +1901,6 @@ export type SubscriptionRootStampTriggersAggregateArgs = {
where?: InputMaybe<StampTriggersBoolExp>;
};

export type SubscriptionRootStampTriggersByPkArgs = {
id: Scalars["Int"]["input"];
};

export type SubscriptionRootStampTriggersStreamArgs = {
batchSize: Scalars["Int"]["input"];
cursor: Array<InputMaybe<StampTriggersStreamCursorInput>>;
Expand Down
11 changes: 6 additions & 5 deletions view-user/src/components/Layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { ja, en } from "@/locales";
const images = [
{ name: "crap", src: "/ReactionIcon/crap.png", alt: "crap icon" },
{ name: "good", src: "/ReactionIcon/good.png", alt: " good icon" },
{ name: "crakcer", src: "/ReactionIcon/cracker.png", alt: "cracker icon" },
{ name: "cracker", src: "/ReactionIcon/cracker.png", alt: "cracker icon" },
{ name: "heart", src: "/ReactionIcon/heart.png", alt: "heart icon" },
{ name: "smile", src: "/ReactionIcon/smile.png", alt: "smile icon" },
{ name: "angry", src: "/ReactionIcon/angry.png", alt: "angry icon" },
Expand Down Expand Up @@ -66,8 +66,9 @@ const Layout = (props: LayoutProps) => {
CreateOneStampTriggerMutation,
CreateOneStampTriggerMutationVariables
>(CreateOneStampTriggerDocument);
const [getLatestReachLog, { data: latestReachLogData }] =
useLazyQuery<GetOneLatestReachLogQuery>(GetOneLatestReachLogDocument);
const [getLatestReachLog] = useLazyQuery<GetOneLatestReachLogQuery>(
GetOneLatestReachLogDocument,
);

const [createOneReachRecord] = useMutation<
CreateOneReachRecordMutation,
Expand Down Expand Up @@ -99,7 +100,7 @@ const Layout = (props: LayoutProps) => {
}
}, []);

const handleReactionsiconClick = (name: string) => {
const handleReactionClick = (name: string) => {
createStampRecord({ variables: { name } });
};

Expand Down Expand Up @@ -180,7 +181,7 @@ const Layout = (props: LayoutProps) => {
position={position}
height={navBarHeight}
images={images}
onClick={handleReactionsiconClick}
onClick={handleReactionClick}
/>
)}
<Modal isOpened={isReachModalOpen} setIsOpened={setIsReachModalOpen}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface NumberCardLargeProps {
const NumberCardLarge = (props: NumberCardLargeProps) => {
return (
<div className={styles.container}>
<div className={styles.number}>{props.bingoNumber.number}</div>
<div className={styles.number}>{props?.bingoNumber?.number}</div>
</div>
);
};
Expand Down
2 changes: 1 addition & 1 deletion view-user/src/gql/reach_logs.gql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ query GetOneLatestReachLog {
}

# リーチログの最新のreachNumを継続取得(Subscription)
subscription SubscribeOneLatestReachlog {
subscription SubscribeOneLatestReachLog {
reachLogs(orderBy: { createdAt: DESC }, limit: 1) {
reachNum
}
Expand Down
2 changes: 1 addition & 1 deletion view-user/src/gql/stamp_triggers.gql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# triggerの取得(Get)
query GetStampTrrigers {
query GetStampTriggers {
stampTriggers {
id
name
Expand Down
4 changes: 3 additions & 1 deletion view-user/src/pages/prizes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ const Page: NextPage = () => {
setBingoPrize((prizes) =>
prizes.map((prize) => {
const updatePrize = subscription.prizes.find(
(subscriptionPrize) => subscriptionPrize.id === prize.id,
(
subscriptionPrize: SubscribeListPrizesIsWonSubscription["prizes"][0],
) => subscriptionPrize.id === prize.id,
);
return updatePrize ? { ...prize, isWon: updatePrize.isWon } : prize;
}),
Expand Down
19 changes: 11 additions & 8 deletions view-user/src/pages/screen/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import { useSubscription } from "@apollo/client";
import {
SubscribeListNumbersDocument,
SubscribeCreatedStampTriggerDocument,
SubscribeOneLatestReachlogDocument,
SubscribeOneLatestReachLogDocument,
} from "@/type/graphql";
import type {
SubscribeListNumbersSubscription,
SubscribeCreatedStampTriggerSubscription,
SubscribeOneLatestReachlogSubscription,
SubscribeOneLatestReachLogSubscription,
} from "@/type/graphql";
import {
NumberCardLarge,
Expand All @@ -37,13 +37,13 @@ const images: { [key: string]: string } = {
type Stamp = {
id: number;
name: string;
createdAt: string;
createdAt?: string;
};

type BingoNumbers = SubscribeListNumbersSubscription["numbers"];

const sortedBingoNumbers = (bingoNumbers: BingoNumbers) => {
return [...bingoNumbers].sort((a, b) => a.id - b.id); // idで昇順にソート
return [...bingoNumbers].sort((a, b) => a.id - b.id);
};

// 最後に追加されたビンゴ番号(最新の番号)を取得
Expand Down Expand Up @@ -94,18 +94,21 @@ const Page: NextPage = () => {
);
// リーチログのサブスクリプション
const { data: reachLog } =
useSubscription<SubscribeOneLatestReachlogSubscription>(
SubscribeOneLatestReachlogDocument,
useSubscription<SubscribeOneLatestReachLogSubscription>(
SubscribeOneLatestReachLogDocument,
);

useEffect(() => {
if (triggers?.stampTriggers && triggers?.stampTriggers.length > 0) {
if (triggers?.stampTriggers?.length) {
let latestCreatedAt = new Date(0).toISOString();

triggers.stampTriggers.forEach((stamp: Stamp) => {
addCircleById(stamp.name);

if (new Date(stamp.createdAt) > new Date(latestCreatedAt)) {
if (
stamp.createdAt &&
new Date(stamp.createdAt) > new Date(latestCreatedAt)
) {
latestCreatedAt = stamp.createdAt;
}
});
Expand Down
Loading
Loading