-
Notifications
You must be signed in to change notification settings - Fork 0
バグの除去が完了したかも #29
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
バグの除去が完了したかも #29
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,5 +1,5 @@ | ||||||
| // drizzle | ||||||
| import { pgTable, text, timestamp, index, uuid, uniqueIndex, integer } from 'drizzle-orm/pg-core'; | ||||||
| import { pgTable, text, timestamp, index, uuid, uniqueIndex, integer, date } from 'drizzle-orm/pg-core'; | ||||||
| //auth-schema | ||||||
| import { user } from './auth-schema'; | ||||||
|
|
||||||
|
|
@@ -8,7 +8,7 @@ export const group = pgTable( | |||||
| { | ||||||
| id: uuid('id').primaryKey(), | ||||||
| name: text('name').notNull(), | ||||||
| invite_id: text('invite_id').notNull().unique(), | ||||||
| inviteId: text('invite_id').notNull().unique(), | ||||||
|
||||||
| inviteId: text('invite_id').notNull().unique(), | |
| invite_id: text('invite_id').notNull().unique(), |
Copilot
AI
Jan 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the column type from timestamp to date removes time information from debt records. This is a breaking change that could result in data loss if existing records contain time information. Consider using a migration strategy to handle existing data appropriately.
| occurredAt: date('occurred_at').notNull(), | |
| occurredAt: timestamp('occurred_at').notNull(), |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,8 +18,6 @@ import { | |||||||||
| type GetGroupDebtHistoryResponseSchemaType, | ||||||||||
| GetGroupInfoResponseMemberElementSchemaType, | ||||||||||
| registerGroupDebtRequestSchema, | ||||||||||
| registerGroupDebtResponseSchema, | ||||||||||
| type RegisterGroupDebtResponseSchemaType, | ||||||||||
| deleteGroupDebtRequestSchema, | ||||||||||
| } from 'validator'; | ||||||||||
| // error schema | ||||||||||
|
|
@@ -67,9 +65,6 @@ hono.openapi(createGroupSchema, async (c) => { | |||||||||
| const loginUser = c.get('user'); | ||||||||||
| const body = c.req.valid('json'); | ||||||||||
|
|
||||||||||
| // 現在時刻の取得 | ||||||||||
| const now = new Date(); | ||||||||||
|
|
||||||||||
| // データベース接続 | ||||||||||
| const db = drizzle({ connection: c.env.HYPERDRIVE }); | ||||||||||
|
|
||||||||||
|
|
@@ -79,29 +74,26 @@ hono.openapi(createGroupSchema, async (c) => { | |||||||||
| .values({ | ||||||||||
| id: crypto.randomUUID(), | ||||||||||
| name: body.group_name, | ||||||||||
| invite_id: `${crypto.randomUUID()}-${crypto.randomUUID()}`, | ||||||||||
| inviteId: `${crypto.randomUUID()}-${crypto.randomUUID()}`, | ||||||||||
| createdBy: loginUser.id, | ||||||||||
|
||||||||||
| createdBy: loginUser.id, | |
| createdBy: loginUser.id, | |
| createdAt: new Date(), | |
| updatedAt: new Date(), |
Copilot
AI
Jan 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the joinedAt field assignment means this field will rely solely on the database default. If the database schema doesn't have a proper defaultNow() or equivalent default configured for this column, it could result in null values. Verify that the database schema has the appropriate default configured.
| userId: loginUser.id, | |
| userId: loginUser.id, | |
| joinedAt: new Date(), |
Copilot
AI
Jan 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the joinedAt field assignment means this field will rely solely on the database default. If the database schema doesn't have a proper defaultNow() or equivalent default configured for this column, it could result in null values. Verify that the database schema has the appropriate default configured.
| userId: user.id, | |
| userId: user.id, | |
| joinedAt: new Date(), |
Copilot
AI
Jan 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The occurredAt field from the database is of type date, which is returned directly in the response. Depending on the database driver, this might be returned as a Date object rather than a string. The response schema expects a string matching the pattern /^\d{4}-\d{2}-\d{2}$/. Ensure that the date is properly formatted as a string (e.g., using toISOString().split('T')[0] or similar) before returning it in the response.
Copilot
AI
Jan 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The backend is setting occurredAt to body.occurred_at directly as a string, but the database schema expects a date type. This type mismatch may cause runtime errors depending on the database driver's handling. The date string should be converted to a proper Date object before insertion.
| occurredAt: body.occurred_at, | |
| occurredAt: new Date(body.occurred_at), |
Copilot
AI
Jan 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the updatedAt field update on deletion is inconsistent with typical soft-delete patterns. When a record is soft-deleted (by setting deletedAt and deletedBy), it's common practice to also update the updatedAt timestamp to track when the deletion occurred. Consider whether this removal was intentional or if it could cause issues with audit trails or timestamp-based queries.
| deletedAt: now, | |
| deletedAt: now, | |
| updatedAt: now, |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -298,7 +298,6 @@ hono.openapi(infoUserRepaymentSchema, async (c) => { | |
| .set({ | ||
| deletedBy: loginUser.id, | ||
| deletedAt: now, | ||
|
Comment on lines
298
to
300
|
||
| updatedAt: now, | ||
| }) | ||
| .where( | ||
| or( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
dateimport from 'drizzle-orm/pg-core' is added but should be verified that it's correctly used for theoccurredAtfield. Ensure that the date type correctly handles the YYYY-MM-DD format expected by the API validators and doesn't introduce timezone-related issues.