Skip to content

Conversation

@SasakiTakatsugu
Copy link
Contributor

No description provided.

Copy link

Copilot AI left a 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.


const userInfo = req.userInfo;
if (!userInfo) {
return res.status(401).json({ error: "Internal server error" });
Copy link

Copilot AI Oct 2, 2025

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'.

Suggested change
return res.status(401).json({ error: "Internal server error" });
return res.status(401).json({ error: "Unauthorized" });

Copilot uses AI. Check for mistakes.

const userInfo = req.userInfo;
if (!userInfo) {
return res.status(401).json({ error: "Internal server error" });
Copy link

Copilot AI Oct 2, 2025

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'.

Suggested change
return res.status(401).json({ error: "Internal server error" });
return res.status(401).json({ error: "Unauthorized" });

Copilot uses AI. Check for mistakes.
}

// レスポンスを構築
const response: any = {
Copy link

Copilot AI Oct 2, 2025

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.

Copilot uses AI. Check for mistakes.
const authCli = new AuthClient();

// テナントプランを更新
const updateTenantPlanParam: any = {
Copy link

Copilot AI Oct 2, 2025

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.

Copilot uses AI. Check for mistakes.
@SasakiTakatsugu
Copy link
Contributor Author

Copy link

Copilot AI left a 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" });
}

Copy link

Copilot AI Oct 23, 2025

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.

Suggested change
// 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" });
}

Copilot uses AI. Check for mistakes.

// テナントプランを更新
const updateTenantPlanParam: UpdateTenantPlanParam = {
next_plan_id: next_plan_id,
Copy link

Copilot AI Oct 23, 2025

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.

Suggested change
next_plan_id: next_plan_id,
next_plan_id,

Copilot uses AI. Check for mistakes.
};

// 税率IDが指定されている場合のみ設定
if (tax_rate_id && tax_rate_id !== "") {
Copy link

Copilot AI Oct 23, 2025

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.

Suggested change
if (tax_rate_id && tax_rate_id !== "") {
if (tax_rate_id) {

Copilot uses AI. Check for mistakes.
@KooriyamaHiroki KooriyamaHiroki merged commit d585d17 into main Oct 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants