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 3 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
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
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
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
17 changes: 10 additions & 7 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,7 +37,7 @@ const images: { [key: string]: string } = {
type Stamp = {
id: number;
name: string;
createdAt: string;
createdAt?: string;
};

type BingoNumbers = SubscribeListNumbersSubscription["numbers"];
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
26 changes: 13 additions & 13 deletions view-user/src/type/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2140,11 +2140,11 @@ export type GetOneLatestReachLogQuery = {
reachLogs: Array<{ __typename?: "ReachLogs"; reachNum: number }>;
};

export type SubscribeOneLatestReachlogSubscriptionVariables = Exact<{
export type SubscribeOneLatestReachLogSubscriptionVariables = Exact<{
[key: string]: never;
}>;

export type SubscribeOneLatestReachlogSubscription = {
export type SubscribeOneLatestReachLogSubscription = {
__typename?: "subscription_root";
reachLogs: Array<{ __typename?: "ReachLogs"; reachNum: number }>;
};
Expand Down Expand Up @@ -2180,9 +2180,9 @@ export type CreateOneReachRecordMutation = {
} | null;
};

export type GetStampTrrigersQueryVariables = Exact<{ [key: string]: never }>;
export type GetStampTriggersQueryVariables = Exact<{ [key: string]: never }>;

export type GetStampTrrigersQuery = {
export type GetStampTriggersQuery = {
__typename?: "query_root";
stampTriggers: Array<{
__typename?: "StampTriggers";
Expand Down Expand Up @@ -2516,15 +2516,15 @@ export type GetOneLatestReachLogQueryResult = Apollo.QueryResult<
GetOneLatestReachLogQuery,
GetOneLatestReachLogQueryVariables
>;
export const SubscribeOneLatestReachlogDocument = gql`
subscription SubscribeOneLatestReachlog {
export const SubscribeOneLatestReachLogDocument = gql`
subscription SubscribeOneLatestReachLog {
reachLogs(orderBy: { createdAt: DESC }, limit: 1) {
reachNum
}
}
`;
export type SubscribeOneLatestReachlogSubscriptionResult =
Apollo.SubscriptionResult<SubscribeOneLatestReachlogSubscription>;
export type SubscribeOneLatestReachLogSubscriptionResult =
Apollo.SubscriptionResult<SubscribeOneLatestReachLogSubscription>;
export const GetListReachLogsAfterTimestampDocument = gql`
query GetListReachLogsAfterTimestamp($timestamp: timestamptz!) {
reachLogs(
Expand Down Expand Up @@ -2564,17 +2564,17 @@ export type CreateOneReachRecordMutationOptions = Apollo.BaseMutationOptions<
CreateOneReachRecordMutation,
CreateOneReachRecordMutationVariables
>;
export const GetStampTrrigersDocument = gql`
query GetStampTrrigers {
export const GetStampTriggersDocument = gql`
query GetStampTriggers {
stampTriggers {
id
name
}
}
`;
export type GetStampTrrigersQueryResult = Apollo.QueryResult<
GetStampTrrigersQuery,
GetStampTrrigersQueryVariables
export type GetStampTriggersQueryResult = Apollo.QueryResult<
GetStampTriggersQuery,
GetStampTriggersQueryVariables
>;
export const CreateOneStampTriggerDocument = gql`
mutation CreateOneStampTrigger($name: String!) {
Expand Down
Loading