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

ワークフロー作成 #41

Merged
merged 19 commits into from
Nov 12, 2024
36 changes: 36 additions & 0 deletions .github/workflows/auto_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build and Test

on:
push


jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

- name: Set environment variables from .env file1
run: |
echo "${{ secrets.DB_ENV_FILE }}" > .env

- name: Set environment variables from .env file2
working-directory: app
run: |
echo "${{ secrets.ENV_FILE }}" > .env

- name: Build Docker compose up
run: docker compose -f compose.dev.yml up --build -d

- name: npm install
run: docker compose exec app npm install

- name: npm run build
run: docker compose exec app npm run build

- name: Build Docker compose down
run: docker compose down
11 changes: 11 additions & 0 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"@svgr/webpack": "^8.1.0",
"@types/formidable": "^3.4.5",
"@types/node": "^20.17.1",
"@types/nodemailer": "^6.4.16",
"@types/react": "^18",
"@types/react-dom": "^18",
"postcss": "^8",
Expand Down
2 changes: 0 additions & 2 deletions app/src/app/api/image/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import type { NextApiResponse } from "next";
import type { NextRequest } from "next/server";

import { OpenAI } from "openai";
import fs from "fs";
import path from "path";

type ResponseData = {
message: string;
Expand Down
21 changes: 21 additions & 0 deletions app/src/app/api/score/assignment/[id]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,32 @@ export async function GET(req: NextRequest) {
include: { user: true, assignment: true },
});

if (!scores[0].assignment){
return new Response(JSON.stringify({ message: "Not Found" }), {
status: 404,
headers: { "Content-Type": "application/json" },
});
}

const word: Word | null = await prisma.word.findFirst({
where: { id: scores[0].assignment.wordId },
});



const scoreDetails: ScoreDetail[] = scores.map((score) => {
if(!score.assignment){
return {
id: 0,
assignment: "",
answerIntervalTime: 0,
userName: "",
imageUrl: "",
point: 0,
similarity: 0,
};
}

const answerIntervalTimeMilliseconds =
score.answerTime.getTime() - score.assignment.date.getTime();
const answerIntervalTimeSeconds = answerIntervalTimeMilliseconds / 1000;
Expand Down
Loading