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
6 changes: 3 additions & 3 deletions products/backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ app.onError((error, c) => {
app.doc('/openapi', {
openapi: '3.1.0',
info: {
title: 'Echo API',
version: '1.0.0',
description: '受け取った入力値をそのまま応答するAPI',
title: 'Pay Crew2 API',
version: '0.0.1',
description: 'API documentation for Pay Crew2 backend',
},

Copilot AI Jan 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The OpenAPI specification includes a global security configuration (lines 3-7 in openapi.json), but the backend code that generates the OpenAPI spec doesn't include this global security field in the app.doc configuration. To ensure consistency between the generated spec and the JSON file, consider adding a global security field to the app.doc call in index.ts. This would automatically apply the SessionCookie security requirement to all endpoints unless explicitly overridden.

Suggested change
},
},
security: [
{
SessionCookie: [],
},
],

Copilot uses AI. Check for mistakes.
});

Expand Down
2 changes: 0 additions & 2 deletions products/backend/src/presentation/api.protected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import honoFactory from './factory/hono';
// better-auth object factory
import { AuthFactoryType } from './factory/auth';
// routes
import sample from './routes/sample';
import info from './routes/info';
import group from './routes/group';
import userProfile from './routes/userProfile';
Expand All @@ -31,7 +30,6 @@ const apiProtected = (auth: AuthFactoryType) => {
});

//* endpoint registration *//
app.route('/', sample);
app.route('/', info);
app.route('/', group);
app.route('/', userProfile);
Expand Down
7 changes: 7 additions & 0 deletions products/backend/src/presentation/factory/hono.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ const honoFactory = () => {
},
});

// セキュリティスキームの登録
app.openAPIRegistry.registerComponent('securitySchemes', 'SessionCookie', {
type: 'apiKey',
in: 'cookie',
name: 'better-auth.session_token',
});

return app;
};

Expand Down
6 changes: 6 additions & 0 deletions products/backend/src/presentation/routes/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const createGroupSchema = route.createSchema(
path: '/api/group/create',
method: 'post',
description: 'create a new group',
security: [{ SessionCookie: [] }],
request: {
body: {
required: true,
Expand Down Expand Up @@ -125,6 +126,7 @@ const joinGroupSchema = route.createSchema(
path: '/api/group/join',
method: 'post',
description: 'join an existing group',
security: [{ SessionCookie: [] }],
request: {
body: {
required: true,
Expand Down Expand Up @@ -197,6 +199,7 @@ const getGroupInfoSchema = route.createSchema(
path: '/api/group/info',
method: 'post',
description: 'get group information',
security: [{ SessionCookie: [] }],
request: {
body: {
required: true,
Expand Down Expand Up @@ -331,6 +334,7 @@ const getGroupDebtHistorySchema = route.createSchema(
path: '/api/group/debt/history',
method: 'post',
description: 'get group debt history',
security: [{ SessionCookie: [] }],
request: {
body: {
required: true,
Expand Down Expand Up @@ -456,6 +460,7 @@ const registerGroupDebtSchema = route.createSchema(
path: '/api/group/debt/register',
method: 'post',
description: 'register group debt entry',
security: [{ SessionCookie: [] }],
request: {
body: {
required: true,
Expand Down Expand Up @@ -542,6 +547,7 @@ const deleteGroupDebtSchema = route.createSchema(
path: '/api/group/debt/delete',
method: 'delete',
description: 'delete group debt entry',
security: [{ SessionCookie: [] }],
request: {
body: {
required: true,
Expand Down
3 changes: 3 additions & 0 deletions products/backend/src/presentation/routes/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const infoAboutGroupsTheUserBelongsToSchema = route.createSchema(
path: '/api/info/group',
method: 'get',
description: 'get info about groups the user belongs to',
security: [{ SessionCookie: [] }],
request: {},
responses: {
200: {
Expand Down Expand Up @@ -129,6 +130,7 @@ const infoAboutUserTransactionsSchema = route.createSchema(
path: '/api/info/transaction',
method: 'get',
description: 'get info about user transactions',
security: [{ SessionCookie: [] }],
request: {},
responses: {
200: {
Expand Down Expand Up @@ -247,6 +249,7 @@ const infoUserRepaymentSchema = route.createSchema(
path: '/api/info/transaction',
method: 'delete',
description: 'do user repayment',
security: [{ SessionCookie: [] }],
request: {
body: {
required: true,
Expand Down
45 changes: 0 additions & 45 deletions products/backend/src/presentation/routes/sample.ts

This file was deleted.

2 changes: 2 additions & 0 deletions products/backend/src/presentation/routes/userProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const getUserProfile = route.createSchema(
path: '/api/profile',
method: 'get',
description: 'get user profile',
security: [{ SessionCookie: [] }],
request: {},
responses: {
200: {
Expand Down Expand Up @@ -80,6 +81,7 @@ const updateUserProfile = route.createSchema(
path: '/api/profile',
method: 'put',
description: 'update user profile',
security: [{ SessionCookie: [] }],
request: {
body: {
required: true,
Expand Down
Loading
Loading