mirror of
https://github.com/APIParkLab/APIPark.git
synced 2026-06-12 18:11:34 +08:00
Improve deployment logic
This commit is contained in:
@@ -20,12 +20,18 @@ var (
|
||||
|
||||
type imlServiceService struct {
|
||||
store service.IServiceStore `autowired:""`
|
||||
|
||||
universally.IServiceGet[Service]
|
||||
universally.IServiceDelete
|
||||
universally.IServiceCreate[Create]
|
||||
universally.IServiceEdit[Edit]
|
||||
}
|
||||
|
||||
func (i *imlServiceService) ForceDelete(ctx context.Context, id string) error {
|
||||
_, err := i.store.DeleteWhere(ctx, map[string]interface{}{"uuid": id})
|
||||
return err
|
||||
}
|
||||
|
||||
func (i *imlServiceService) ServiceList(ctx context.Context, serviceIds ...string) ([]*Service, error) {
|
||||
w := make(map[string]interface{})
|
||||
if len(serviceIds) > 0 {
|
||||
@@ -168,6 +174,7 @@ func createEntityHandler(i *Create) *service.Service {
|
||||
ApprovalType: i.ApprovalType.Int(),
|
||||
Kind: i.Kind.Int(),
|
||||
AdditionalConfig: string(cfg),
|
||||
State: i.State,
|
||||
Catalogue: i.Catalogue,
|
||||
AsServer: i.AsServer,
|
||||
AsApp: i.AsApp,
|
||||
@@ -199,4 +206,8 @@ func updateHandler(e *service.Service, i *Edit) {
|
||||
if i.ApprovalType != nil {
|
||||
e.ApprovalType = (*i.ApprovalType).Int()
|
||||
}
|
||||
if i.State != nil {
|
||||
e.State = *i.State
|
||||
}
|
||||
e.UpdateAt = time.Now()
|
||||
}
|
||||
|
||||
@@ -119,6 +119,7 @@ type Service struct {
|
||||
Kind Kind
|
||||
Catalogue string
|
||||
AdditionalConfig map[string]string
|
||||
State int
|
||||
AsServer bool
|
||||
AsApp bool
|
||||
ApprovalType ApprovalType
|
||||
@@ -144,6 +145,7 @@ func FromEntity(e *service.Service) *Service {
|
||||
ApprovalType: ToApprovalType(e.ApprovalType),
|
||||
AsServer: e.AsServer,
|
||||
AsApp: e.AsApp,
|
||||
State: e.State,
|
||||
CreateTime: e.CreateAt,
|
||||
UpdateTime: e.UpdateAt,
|
||||
AdditionalConfig: additionalConfig,
|
||||
@@ -162,6 +164,7 @@ type Create struct {
|
||||
Catalogue string
|
||||
AdditionalConfig map[string]string
|
||||
ApprovalType ApprovalType
|
||||
State int
|
||||
AsServer bool
|
||||
AsApp bool
|
||||
}
|
||||
@@ -174,6 +177,7 @@ type Edit struct {
|
||||
Catalogue *string
|
||||
Logo *string
|
||||
AdditionalConfig *map[string]string
|
||||
State *int
|
||||
ApprovalType *ApprovalType
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ type IServiceService interface {
|
||||
ServiceList(ctx context.Context, serviceIds ...string) ([]*Service, error)
|
||||
ServiceListByKind(ctx context.Context, kind Kind, serviceIds ...string) ([]*Service, error)
|
||||
AppList(ctx context.Context, appIds ...string) ([]*Service, error)
|
||||
ForceDelete(ctx context.Context, id string) error
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/eolinker/go-common/utils"
|
||||
|
||||
"github.com/eolinker/go-common/auto"
|
||||
|
||||
Reference in New Issue
Block a user