feat(shop-role): 实现店铺角色继承功能和权限检查优化
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m39s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m39s
- 新增店铺角色管理 API 和数据模型 - 实现角色继承和权限检查逻辑 - 添加流程测试框架和集成测试 - 更新权限服务和账号管理逻辑 - 添加数据库迁移脚本 - 归档 OpenSpec 变更文档 Ultraworked with Sisyphus
This commit is contained in:
@@ -24,7 +24,9 @@ func TestShopService_Create(t *testing.T) {
|
||||
|
||||
shopStore := postgres.NewShopStore(tx, rdb)
|
||||
accountStore := postgres.NewAccountStore(tx, rdb)
|
||||
service := shop.New(shopStore, accountStore)
|
||||
shopRoleStore := postgres.NewShopRoleStore(tx, rdb)
|
||||
roleStore := postgres.NewRoleStore(tx)
|
||||
service := shop.New(shopStore, accountStore, shopRoleStore, roleStore)
|
||||
|
||||
t.Run("创建一级店铺成功", func(t *testing.T) {
|
||||
ctx := createContextWithUserID(1)
|
||||
@@ -243,7 +245,9 @@ func TestShopService_Update(t *testing.T) {
|
||||
|
||||
shopStore := postgres.NewShopStore(tx, rdb)
|
||||
accountStore := postgres.NewAccountStore(tx, rdb)
|
||||
service := shop.New(shopStore, accountStore)
|
||||
shopRoleStore := postgres.NewShopRoleStore(tx, rdb)
|
||||
roleStore := postgres.NewRoleStore(tx)
|
||||
service := shop.New(shopStore, accountStore, shopRoleStore, roleStore)
|
||||
|
||||
t.Run("更新店铺信息成功", func(t *testing.T) {
|
||||
ctx := createContextWithUserID(1)
|
||||
@@ -373,7 +377,9 @@ func TestShopService_Disable(t *testing.T) {
|
||||
|
||||
shopStore := postgres.NewShopStore(tx, rdb)
|
||||
accountStore := postgres.NewAccountStore(tx, rdb)
|
||||
service := shop.New(shopStore, accountStore)
|
||||
shopRoleStore := postgres.NewShopRoleStore(tx, rdb)
|
||||
roleStore := postgres.NewRoleStore(tx)
|
||||
service := shop.New(shopStore, accountStore, shopRoleStore, roleStore)
|
||||
|
||||
t.Run("禁用店铺成功", func(t *testing.T) {
|
||||
ctx := createContextWithUserID(1)
|
||||
@@ -437,7 +443,9 @@ func TestShopService_Enable(t *testing.T) {
|
||||
|
||||
shopStore := postgres.NewShopStore(tx, rdb)
|
||||
accountStore := postgres.NewAccountStore(tx, rdb)
|
||||
service := shop.New(shopStore, accountStore)
|
||||
shopRoleStore := postgres.NewShopRoleStore(tx, rdb)
|
||||
roleStore := postgres.NewRoleStore(tx)
|
||||
service := shop.New(shopStore, accountStore, shopRoleStore, roleStore)
|
||||
|
||||
t.Run("启用店铺成功", func(t *testing.T) {
|
||||
ctx := createContextWithUserID(1)
|
||||
@@ -510,7 +518,9 @@ func TestShopService_GetByID(t *testing.T) {
|
||||
|
||||
shopStore := postgres.NewShopStore(tx, rdb)
|
||||
accountStore := postgres.NewAccountStore(tx, rdb)
|
||||
service := shop.New(shopStore, accountStore)
|
||||
shopRoleStore := postgres.NewShopRoleStore(tx, rdb)
|
||||
roleStore := postgres.NewRoleStore(tx)
|
||||
service := shop.New(shopStore, accountStore, shopRoleStore, roleStore)
|
||||
|
||||
t.Run("获取存在的店铺", func(t *testing.T) {
|
||||
ctx := createContextWithUserID(1)
|
||||
@@ -559,7 +569,9 @@ func TestShopService_List(t *testing.T) {
|
||||
|
||||
shopStore := postgres.NewShopStore(tx, rdb)
|
||||
accountStore := postgres.NewAccountStore(tx, rdb)
|
||||
service := shop.New(shopStore, accountStore)
|
||||
shopRoleStore := postgres.NewShopRoleStore(tx, rdb)
|
||||
roleStore := postgres.NewRoleStore(tx)
|
||||
service := shop.New(shopStore, accountStore, shopRoleStore, roleStore)
|
||||
|
||||
t.Run("查询店铺列表", func(t *testing.T) {
|
||||
ctx := createContextWithUserID(1)
|
||||
@@ -596,7 +608,9 @@ func TestShopService_GetSubordinateShopIDs(t *testing.T) {
|
||||
|
||||
shopStore := postgres.NewShopStore(tx, rdb)
|
||||
accountStore := postgres.NewAccountStore(tx, rdb)
|
||||
service := shop.New(shopStore, accountStore)
|
||||
shopRoleStore := postgres.NewShopRoleStore(tx, rdb)
|
||||
roleStore := postgres.NewRoleStore(tx)
|
||||
service := shop.New(shopStore, accountStore, shopRoleStore, roleStore)
|
||||
|
||||
t.Run("获取下级店铺 ID 列表", func(t *testing.T) {
|
||||
ctx := createContextWithUserID(1)
|
||||
@@ -661,7 +675,9 @@ func TestShopService_Delete(t *testing.T) {
|
||||
|
||||
shopStore := postgres.NewShopStore(tx, rdb)
|
||||
accountStore := postgres.NewAccountStore(tx, rdb)
|
||||
service := shop.New(shopStore, accountStore)
|
||||
shopRoleStore := postgres.NewShopRoleStore(tx, rdb)
|
||||
roleStore := postgres.NewRoleStore(tx)
|
||||
service := shop.New(shopStore, accountStore, shopRoleStore, roleStore)
|
||||
|
||||
t.Run("删除店铺成功", func(t *testing.T) {
|
||||
ctx := createContextWithUserID(1)
|
||||
|
||||
Reference in New Issue
Block a user