-
Notifications
You must be signed in to change notification settings - Fork 0
プラン設定機能追加 #7
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
プラン設定機能追加 #7
Conversation
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.
Pull Request Overview
This PR adds billing plan configuration functionality, introducing new API endpoints to retrieve pricing plans, tax rates, and manage tenant plan information.
- Added endpoints to fetch pricing plans and tax rates
- Added tenant plan management endpoints for retrieving and updating plan configurations
- Implemented proper authentication and authorization checks for billing operations
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/routes/billingRoutes.ts
Outdated
|
|
||
| const userInfo = req.userInfo; | ||
| if (!userInfo) { | ||
| return res.status(401).json({ error: "Internal server error" }); |
Copilot
AI
Oct 2, 2025
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 error message 'Internal server error' is misleading for a 401 status code. This should be an authentication error message like 'Unauthorized' or 'Authentication required'.
| return res.status(401).json({ error: "Internal server error" }); | |
| return res.status(401).json({ error: "Unauthorized" }); |
src/routes/billingRoutes.ts
Outdated
|
|
||
| const userInfo = req.userInfo; | ||
| if (!userInfo) { | ||
| return res.status(401).json({ error: "Internal server error" }); |
Copilot
AI
Oct 2, 2025
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 error message 'Internal server error' is misleading for a 401 status code. This should be an authentication error message like 'Unauthorized' or 'Authentication required'.
| return res.status(401).json({ error: "Internal server error" }); | |
| return res.status(401).json({ error: "Unauthorized" }); |
src/routes/billingRoutes.ts
Outdated
| } | ||
|
|
||
| // レスポンスを構築 | ||
| const response: any = { |
Copilot
AI
Oct 2, 2025
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.
Using 'any' type reduces type safety. Consider defining a proper interface for the response object to improve maintainability and catch potential type errors.
src/routes/billingRoutes.ts
Outdated
| const authCli = new AuthClient(); | ||
|
|
||
| // テナントプランを更新 | ||
| const updateTenantPlanParam: any = { |
Copilot
AI
Oct 2, 2025
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.
Using 'any' type reduces type safety. Consider defining a proper interface for the updateTenantPlanParam object to improve maintainability and catch potential type errors.
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.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| if (!tenantId) { | ||
| return res.status(400).json({ error: "tenant_id is required" }); | ||
| } | ||
|
|
Copilot
AI
Oct 23, 2025
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.
Missing input validation for required field 'next_plan_id'. The field should be validated before proceeding with the request body destructuring to ensure it exists and is a non-empty string.
| // Validate next_plan_id before destructuring | |
| if ( | |
| !req.body.next_plan_id || | |
| typeof req.body.next_plan_id !== "string" || | |
| req.body.next_plan_id.trim() === "" | |
| ) { | |
| return res.status(400).json({ error: "next_plan_id is required and must be a non-empty string" }); | |
| } |
|
|
||
| // テナントプランを更新 | ||
| const updateTenantPlanParam: UpdateTenantPlanParam = { | ||
| next_plan_id: next_plan_id, |
Copilot
AI
Oct 23, 2025
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.
[nitpick] Redundant property assignment. Use shorthand property notation 'next_plan_id' instead of 'next_plan_id: next_plan_id' for cleaner code.
| next_plan_id: next_plan_id, | |
| next_plan_id, |
| }; | ||
|
|
||
| // 税率IDが指定されている場合のみ設定 | ||
| if (tax_rate_id && tax_rate_id !== "") { |
Copilot
AI
Oct 23, 2025
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.
[nitpick] Inconsistent checking pattern. The condition 'tax_rate_id && tax_rate_id !== ""' can be simplified to just 'tax_rate_id' since the truthiness check already handles empty strings in JavaScript/TypeScript.
| if (tax_rate_id && tax_rate_id !== "") { | |
| if (tax_rate_id) { |
No description provided.