Skip to content
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
4 changes: 2 additions & 2 deletions bun.lock

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

4 changes: 2 additions & 2 deletions server/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ model User {
faculty String
department String
intro String
pictureUrl String
pictureUrl String @default("/avatar.svg")

// bindings to other parts of this app
enrollments Enrollment[]
Expand Down Expand Up @@ -67,7 +67,7 @@ model InterestSubject {
// User->Interest->InterestSubject
model Interest {
userId Int
user User @relation(fields: [userId], references: [id])
user User @relation(fields: [userId], references: [id], onDelete: Cascade )
subjectId Int
subject InterestSubject @relation(fields: [subjectId], references: [id], onDelete: Cascade)

Expand Down
2 changes: 1 addition & 1 deletion server/src/router/picture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { error } from "../lib/error";
import * as hashing from "../lib/hash";

const largeLimit = bodyLimit({
maxSize: 50 * 1024, // 50kb
maxSize: 50 * 1024 * 1024, // 50mb
onError: (c) => {
return c.text("overflow :(", 413);
},
Expand Down
4 changes: 2 additions & 2 deletions server/src/router/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const router = new Hono()

// INSERT INTO "User" VALUES (body...)
.post("/", async (c) => {
const partialUser = InitUserSchema.parse(c.body);
const partialUser = InitUserSchema.parse(await c.req.json());
const user = await createUser(partialUser);

//ユーザー作成と同時にメモとマッチング
Expand All @@ -119,7 +119,7 @@ const router = new Hono()
// ユーザーの更新エンドポイント
.put("/me", async (c) => {
const id = await getUserId(c);
const user = UpdateUserSchema.parse(c.body);
const user = UpdateUserSchema.parse(await c.req.json());
const updated = await updateUser(id, user);
c.status(200);
return c.json(updated);
Expand Down
16 changes: 13 additions & 3 deletions web/app/chat/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,33 @@ import Link from "next/link";
import { useEffect, useState } from "react";
import * as chat from "~/api/chat/chat";
import { RoomWindow } from "~/components/chat/RoomWindow";
import FullScreenCircularProgress from "~/components/common/FullScreenCircularProgress";

export default function Page({ params }: { params: { id: string } }) {
const id = Number.parseInt(params.id);
const [room, setRoom] = useState<(DMRoom & PersonalizedDMRoom) | null>(null);
const [loading, setLoading] = useState(true);

useEffect(() => {
(async () => {
const room = await chat.getDM(id);
setRoom(room);
try {
const room = await chat.getDM(id);
setRoom(room);
} finally {
setLoading(false);
}
})();
}, [id]);

if (loading) {
return <FullScreenCircularProgress />;
}

return (
<>
{room ? (
<RoomWindow friendId={id} room={room} />
) : (
// FIXME: this isn't an error when it's just loading
<p>
Sorry, an unexpected error has occurred.
<Link href="/home" className="text-blue-600">
Expand Down
10 changes: 7 additions & 3 deletions web/app/home/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ export default function Home() {
const [recommended, setRecommended] = useState<
Queue<UserWithCoursesAndSubjects>
>(() => new Queue([]));
const [loading, setLoading] = useState<boolean>(true);

useEffect(() => {
if (data) setRecommended(new Queue(data));
if (data) {
setRecommended(new Queue(data));
setLoading(false);
}
}, [data]);

const displayedUser = recommended.peek(0);
Expand Down Expand Up @@ -77,13 +81,13 @@ export default function Home() {
[recommended, controls, backCardControls],
);

if (data === undefined) {
if (loading) {
return <FullScreenCircularProgress />;
}
if (currentUser == null) {
return <FullScreenCircularProgress />;
}
if (recommended.size() === 0) {
if (recommended.size() === 0 && loading === false) {
return <NoMoreUser />;
}
if (error) throw error;
Expand Down
5 changes: 4 additions & 1 deletion web/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ export default function RootLayout({
<head>
<meta charSet="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/course-mate-icon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0"
/>
<title>CourseMate</title>
</head>
<body className="h-full">
Expand Down
4 changes: 0 additions & 4 deletions web/app/signup/steps/step2_img.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ export default function Step2({
}, []);

async function next() {
if (!url) {
notify("画像は必須です");
return;
}
const data = {
pictureUrl: url,
};
Expand Down