Skip to content

プラン設定機能追加#10

Merged
KooriyamaHiroki merged 2 commits intomainfrom
feature/add-plan-setting-page
Oct 23, 2025
Merged

プラン設定機能追加#10
KooriyamaHiroki merged 2 commits intomainfrom
feature/add-plan-setting-page

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

Adds plan management functionality to enable users to view and update tenant pricing plans. The implementation includes API endpoints for retrieving pricing plans, tax rates, and managing tenant plan configurations.

  • Added REST endpoints for pricing plan and tax rate retrieval
  • Implemented tenant-specific plan information retrieval and updates
  • Added proper authorization checks using existing billing access controls

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
main.go Added four new route handlers for plan management endpoints
billing.go Implemented core plan management functions with proper error handling and authorization

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

billing.go Outdated
if plansResp.JSON200 == nil {
var msg pricingapi.Error
if err := json.Unmarshal(plansResp.Body, &msg); err != nil {
c.Logger().Error("failed to get pricing plans: %v", err)
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.

Missing format verb: should use Errorf instead of Error when including the error variable.

Suggested change
c.Logger().Error("failed to get pricing plans: %v", err)
c.Logger().Errorf("failed to get pricing plans: %v", err)

Copilot uses AI. Check for mistakes.
billing.go Outdated
if taxRatesResp.JSON200 == nil {
var msg pricingapi.Error
if err := json.Unmarshal(taxRatesResp.Body, &msg); err != nil {
c.Logger().Error("failed to get tax rates: %v", err)
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.

Missing format verb: should use Errorf instead of Error when including the error variable.

Suggested change
c.Logger().Error("failed to get tax rates: %v", err)
c.Logger().Errorf("failed to get tax rates: %v", err)

Copilot uses AI. Check for mistakes.
billing.go Outdated
c.Logger().Error("failed to get pricing plans: %v", err)
return c.String(http.StatusInternalServerError, "internal server error")
}
c.Logger().Error("failed to get pricing plans: %v", msg)
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.

Missing format verb: should use Errorf instead of Error when including the msg variable.

Suggested change
c.Logger().Error("failed to get pricing plans: %v", msg)
c.Logger().Errorf("failed to get pricing plans: %v", msg)

Copilot uses AI. Check for mistakes.
billing.go Outdated
c.Logger().Error("failed to get tax rates: %v", err)
return c.String(http.StatusInternalServerError, "internal server error")
}
c.Logger().Error("failed to get tax rates: %v", msg)
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.

Missing format verb: should use Errorf instead of Error when including the msg variable.

Suggested change
c.Logger().Error("failed to get tax rates: %v", msg)
c.Logger().Errorf("failed to get tax rates: %v", msg)

Copilot uses AI. Check for mistakes.
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 2 out of 2 changed files in this pull request and generated 7 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +712 to +713
usingNextPlanFromInt := int(*usingNextPlanFrom)
updateTenantPlanParam.UsingNextPlanFrom = &usingNextPlanFromInt
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.

Potential integer overflow when converting int64 to int. On 32-bit systems, this conversion could lose data if the value exceeds the int range. Consider adding validation or using int64 consistently throughout the API.

Suggested change
usingNextPlanFromInt := int(*usingNextPlanFrom)
updateTenantPlanParam.UsingNextPlanFrom = &usingNextPlanFromInt
// Avoid unsafe conversion: assign int64 pointer directly
updateTenantPlanParam.UsingNextPlanFrom = usingNextPlanFrom

Copilot uses AI. Check for mistakes.
Comment on lines +606 to +611
c.Logger().Error("failed to get user info")
return c.String(http.StatusInternalServerError, "internal server error")
}

if len(userInfo.Tenants) == 0 {
c.Logger().Error("user does not belong to any tenant")
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 logging practices: these Error() calls don't follow the Errorf() pattern used elsewhere in the same file (lines 618, 625, 628, etc.). For consistency with the rest of the codebase and proper structured logging, these should also use Errorf() even without format arguments.

Suggested change
c.Logger().Error("failed to get user info")
return c.String(http.StatusInternalServerError, "internal server error")
}
if len(userInfo.Tenants) == 0 {
c.Logger().Error("user does not belong to any tenant")
c.Logger().Errorf("failed to get user info")
return c.String(http.StatusInternalServerError, "internal server error")
}
if len(userInfo.Tenants) == 0 {
c.Logger().Errorf("user does not belong to any tenant")

Copilot uses AI. Check for mistakes.
}

if len(userInfo.Tenants) == 0 {
c.Logger().Error("user does not belong to any tenant")
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 logging practices: these Error() calls don't follow the Errorf() pattern used elsewhere in the same file (lines 618, 625, 628, etc.). For consistency with the rest of the codebase and proper structured logging, these should also use Errorf() even without format arguments.

Suggested change
c.Logger().Error("user does not belong to any tenant")
c.Logger().Errorf("user does not belong to any tenant")

Copilot uses AI. Check for mistakes.
func getTaxRates(c echo.Context) error {
userInfo, ok := c.Get(string(ctxlib.UserInfoKey)).(*authapi.UserInfo)
if !ok {
c.Logger().Error("failed to get user info")
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 logging practices: these Error() calls don't follow the Errorf() pattern used elsewhere in the same file (lines 618, 625, 628, etc.). For consistency with the rest of the codebase and proper structured logging, these should also use Errorf() even without format arguments.

Suggested change
c.Logger().Error("failed to get user info")
c.Logger().Errorf("failed to get user info")

Copilot uses AI. Check for mistakes.
}

if len(userInfo.Tenants) == 0 {
c.Logger().Error("user does not belong to any tenant")
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 logging practices: these Error() calls don't follow the Errorf() pattern used elsewhere in the same file (lines 618, 625, 628, etc.). For consistency with the rest of the codebase and proper structured logging, these should also use Errorf() even without format arguments.

Suggested change
c.Logger().Error("user does not belong to any tenant")
c.Logger().Errorf("user does not belong to any tenant")

Copilot uses AI. Check for mistakes.

userInfo, ok := c.Get(string(ctxlib.UserInfoKey)).(*authapi.UserInfo)
if !ok {
c.Logger().Error("failed to get user info")
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 logging practices: these Error() calls don't follow the Errorf() pattern used elsewhere in the same file (lines 618, 625, 628, etc.). For consistency with the rest of the codebase and proper structured logging, these should also use Errorf() even without format arguments.

Suggested change
c.Logger().Error("failed to get user info")
c.Logger().Errorf("failed to get user info")

Copilot uses AI. Check for mistakes.

userInfo, ok := c.Get(string(ctxlib.UserInfoKey)).(*authapi.UserInfo)
if !ok {
c.Logger().Error("failed to get user info")
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 logging practices: these Error() calls don't follow the Errorf() pattern used elsewhere in the same file (lines 618, 625, 628, etc.). For consistency with the rest of the codebase and proper structured logging, these should also use Errorf() even without format arguments.

Suggested change
c.Logger().Error("failed to get user info")
c.Logger().Errorf("failed to get user info")

Copilot uses AI. Check for mistakes.
@KooriyamaHiroki KooriyamaHiroki merged commit c34d241 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.

2 participants

Comments