generated from jphacks/JP_sample
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into yama/fix-ranking-design
- Loading branch information
Showing
23 changed files
with
693 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import type { latestAssignment } from "@/types"; | ||
import { prisma } from "@lib/prisma"; | ||
|
||
// 最新の課題を取得 | ||
export async function GET() { | ||
const assignment = await prisma.assignment.findFirst({ | ||
include: { word: true }, | ||
orderBy: { | ||
date: "desc", | ||
}, | ||
}); | ||
|
||
if (!assignment) { | ||
return new Response(JSON.stringify({ message: "No assignment found for today." }), { | ||
status: 404, | ||
headers: { "Content-Type": "application/json" }, | ||
}); | ||
} | ||
|
||
const latestAssignment: latestAssignment = { | ||
assignmentId: assignment.id, | ||
english: assignment.word.english, | ||
}; | ||
|
||
return new Response(JSON.stringify(latestAssignment), { | ||
status: 200, | ||
headers: { "Content-Type": "application/json" }, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,36 @@ | ||
;import { prisma } from "@lib/prisma"; | ||
import type { Assignment, todayAssignment } from "@/types"; | ||
import { prisma } from "@lib/prisma"; | ||
|
||
// 課題新規作成(ランダム) | ||
export async function GET() { | ||
const startOfToday = new Date(); | ||
startOfToday.setHours(0, 0, 0, 0); // 今日の開始時間を設定 (00:00:00) | ||
|
||
const endOfToday = new Date(); | ||
endOfToday.setHours(23, 59, 59, 999); // 今日の終了時間を設定 (23:59:59) | ||
|
||
const assignments = await prisma.assignment.findMany({ | ||
where: { | ||
date: { | ||
gte: startOfToday, // 今日の開始時間以上 | ||
lte: endOfToday, // 今日の終了時間以下 | ||
gte: startOfToday, // 今日の開始時間以上 | ||
lte: endOfToday, // 今日の終了時間以下 | ||
}, | ||
}, | ||
include: { word: true }, | ||
}, | ||
include: { word: true }, | ||
}); | ||
console.log(assignments); | ||
|
||
const todayAssignments: todayAssignment[] = assignments.map((assignment) => { | ||
const todayAssignment: todayAssignment = { | ||
assignmentId: assignment.id, | ||
english: assignment.word.english, | ||
assignTime: assignment.date, | ||
}; | ||
return todayAssignment; | ||
}) | ||
}); | ||
|
||
return new Response(JSON.stringify(todayAssignments), { | ||
status: 200, | ||
headers: { "Content-Type": "application/json" }, | ||
}); | ||
} | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.