feat: tenant-scoped routing and portal navigation

This commit is contained in:
2026-01-08 21:30:46 +08:00
parent f3aa92078a
commit 3e095c57f3
52 changed files with 1111 additions and 670 deletions

View File

@@ -39,6 +39,7 @@ func Test_Coupon(t *testing.T) {
func (s *CouponTestSuite) Test_CouponFlow() {
Convey("Coupon Flow", s.T(), func() {
ctx := s.T().Context()
tenantID := int64(1)
database.Truncate(
ctx,
s.DB,
@@ -83,9 +84,10 @@ func (s *CouponTestSuite) Test_CouponFlow() {
Convey("should apply in Order.Create", func() {
// Setup Content
c := &models.Content{UserID: 99, Title: "Test", Status: consts.ContentStatusPublished}
c := &models.Content{TenantID: tenantID, UserID: 99, Title: "Test", Status: consts.ContentStatusPublished}
models.ContentQuery.WithContext(ctx).Create(c)
models.ContentPriceQuery.WithContext(ctx).Create(&models.ContentPrice{
TenantID: tenantID,
ContentID: c.ID,
PriceAmount: 2000, // 20.00 CNY
Currency: "CNY",
@@ -96,7 +98,7 @@ func (s *CouponTestSuite) Test_CouponFlow() {
UserCouponID: uc.ID,
}
// Simulate Auth context for Order service
res, err := Order.Create(ctx, user.ID, form)
res, err := Order.Create(ctx, tenantID, user.ID, form)
So(err, ShouldBeNil)
// Verify Order