MSP-623 add domain structs
This commit is contained in:
1 parent
bbfb435c46
commit
228b04e01d
10 files changed
+169
-68
No files matched your search
@@ -0,0 +1,22 @@
|
||||
package domain
|
||||
|
||||
type AccessListSetOneRequest struct {
|
||||
AppId int `valid:"required~Required"`
|
||||
Method string `valid:"required~Required"`
|
||||
Value bool
|
||||
}
|
||||
|
||||
type AccessListSetOneResponse struct {
|
||||
Count int
|
||||
}
|
||||
|
||||
type AccessListSetListRequest struct {
|
||||
AppId int `valid:"required~Required"`
|
||||
RemoveOld bool
|
||||
Methods []MethodInfo
|
||||
}
|
||||
|
||||
type MethodInfo struct {
|
||||
Method string
|
||||
Value bool
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Application struct {
|
||||
Id int
|
||||
Name string
|
||||
Description string
|
||||
ServiceId int
|
||||
Type string
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
type ApplicationCreateUpdateRequest struct {
|
||||
Id int
|
||||
Name string `valid:"required~Required"`
|
||||
Description string
|
||||
ServiceId int `valid:"required~Required"`
|
||||
Type string `valid:"required~Required,in(SYSTEM|MOBILE)"`
|
||||
}
|
||||
|
||||
type ApplicationWithTokens struct {
|
||||
App Application
|
||||
Tokens []Token
|
||||
}
|
||||
|
||||
type ApplicationSimple struct {
|
||||
Id int
|
||||
Name string
|
||||
Description string
|
||||
Type string
|
||||
Tokens []Token
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package domain
|
||||
|
||||
type (
|
||||
Identity struct {
|
||||
Id int `valid:"required~Required"`
|
||||
}
|
||||
|
||||
DeleteResponse struct {
|
||||
Deleted int
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,27 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type DomainCreateUpdateRequest struct {
|
||||
Id int
|
||||
Name string `valid:"required~Required"`
|
||||
Description string
|
||||
}
|
||||
|
||||
type Domain struct {
|
||||
Id int
|
||||
Name string
|
||||
Description string
|
||||
SystemId int
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
type DomainWithService struct {
|
||||
Id int
|
||||
Name string
|
||||
Description string
|
||||
Services []*ServiceWithApps
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrDomainNotFound = errors.New("domain not found")
|
||||
ErrDomainDuplicateName = errors.New("domain name already exist")
|
||||
|
||||
ErrServiceNotFound = errors.New("service not found")
|
||||
ErrServiceDuplicateName = errors.New("service name already exist")
|
||||
|
||||
ErrSystemNotFound = errors.New("system not found")
|
||||
|
||||
ErrApplicationNotFound = errors.New("application not found")
|
||||
ErrApplicationDuplicateName = errors.New("application name already exist")
|
||||
)
|
||||
@@ -1,17 +0,0 @@
|
||||
package domain
|
||||
|
||||
type (
|
||||
Identity struct {
|
||||
Id int32 `json:"id" valid:"required~Required"`
|
||||
}
|
||||
|
||||
RevokeTokensRequest struct {
|
||||
AppId int32 `valid:"required~Required"`
|
||||
Tokens []string
|
||||
}
|
||||
|
||||
CreateTokenRequest struct {
|
||||
AppId int32 `valid:"required~Required"`
|
||||
ExpireTimeMs int64
|
||||
}
|
||||
)
|
||||
@@ -1,51 +0,0 @@
|
||||
package domain
|
||||
|
||||
import "isp-system-service/entity"
|
||||
|
||||
type (
|
||||
DeleteResponse struct {
|
||||
Deleted int
|
||||
}
|
||||
|
||||
CountResponse struct {
|
||||
Count int
|
||||
}
|
||||
|
||||
AppWithToken struct {
|
||||
App entity.Application
|
||||
Tokens []entity.Token
|
||||
}
|
||||
|
||||
DomainWithServices struct {
|
||||
Id int32
|
||||
Name string
|
||||
Description string
|
||||
Services []*ServiceWithApps
|
||||
}
|
||||
|
||||
ServiceWithApps struct {
|
||||
Id int32
|
||||
Name string
|
||||
Description string
|
||||
Apps []*SimpleApp
|
||||
}
|
||||
|
||||
SimpleApp struct {
|
||||
Id int32
|
||||
Name string
|
||||
Description string
|
||||
Type string
|
||||
Tokens []entity.Token
|
||||
}
|
||||
|
||||
MethodInfo struct {
|
||||
Method string
|
||||
Value bool
|
||||
}
|
||||
|
||||
SetListRequest struct {
|
||||
AppId int32
|
||||
RemoveOld bool
|
||||
Methods []MethodInfo
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,28 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Service struct {
|
||||
Id int
|
||||
Name string
|
||||
Description string
|
||||
DomainId int
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
type ServiceCreateUpdateRequest struct {
|
||||
Id int
|
||||
Name string `valid:"required~Required"`
|
||||
Description string
|
||||
DomainId int `valid:"required~Required"`
|
||||
}
|
||||
|
||||
type ServiceWithApps struct {
|
||||
Id int
|
||||
Name string
|
||||
Description string
|
||||
Apps []*ApplicationSimple
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package domain
|
||||
|
||||
const (
|
||||
DefaultSystemId = 1
|
||||
)
|
||||
@@ -0,0 +1,22 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Token struct {
|
||||
Token string
|
||||
AppId int
|
||||
ExpireTime int
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
type TokenRevokeRequest struct {
|
||||
AppId int `valid:"required~Required"`
|
||||
Tokens []string
|
||||
}
|
||||
|
||||
type TokenCreateRequest struct {
|
||||
AppId int `valid:"required~Required"`
|
||||
ExpireTimeMs int
|
||||
}
|
||||
Reference in new issue
Block a user