|
@@ -6,49 +6,31 @@ import (
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
// Typed errors
|
|
// Typed errors
|
|
|
|
|
+
|
|
|
var (
|
|
var (
|
|
|
ErrAccountNotFound = errors.New("Account not found")
|
|
ErrAccountNotFound = errors.New("Account not found")
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
type Account struct {
|
|
type Account struct {
|
|
|
- Id int64
|
|
|
|
|
- Login string `xorm:"UNIQUE NOT NULL"`
|
|
|
|
|
- Email string `xorm:"UNIQUE NOT NULL"`
|
|
|
|
|
- Name string
|
|
|
|
|
- FullName string
|
|
|
|
|
- Password string
|
|
|
|
|
- IsAdmin bool
|
|
|
|
|
- Rands string `xorm:"VARCHAR(10)"`
|
|
|
|
|
- Salt string `xorm:"VARCHAR(10)"`
|
|
|
|
|
- Company string
|
|
|
|
|
- NextDashboardId int
|
|
|
|
|
- UsingAccountId int64
|
|
|
|
|
|
|
+ Id int64
|
|
|
|
|
+ Login string `xorm:"UNIQUE NOT NULL"`
|
|
|
|
|
+ Email string `xorm:"UNIQUE NOT NULL"`
|
|
|
|
|
+ Name string
|
|
|
|
|
+ FullName string
|
|
|
|
|
+ Password string
|
|
|
|
|
+ IsAdmin bool
|
|
|
|
|
+ Salt string `xorm:"VARCHAR(10)"`
|
|
|
|
|
+ Company string
|
|
|
|
|
+ NextDashboardId int
|
|
|
|
|
+ UsingAccountId int64
|
|
|
|
|
+ DefaultDataSourceId int64
|
|
|
|
|
|
|
|
Created time.Time
|
|
Created time.Time
|
|
|
Updated time.Time
|
|
Updated time.Time
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// api projection
|
|
|
|
|
-type OtherAccountDTO struct {
|
|
|
|
|
- Id int64 `json:"id"`
|
|
|
|
|
- Email string `json:"email"`
|
|
|
|
|
- Role string `json:"role"`
|
|
|
|
|
- IsUsing bool `json:"isUsing"`
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-// api projection model
|
|
|
|
|
-type CollaboratorDTO struct {
|
|
|
|
|
- AccountId int64 `json:"accountId"`
|
|
|
|
|
- Email string `json:"email"`
|
|
|
|
|
- Role string `json:"role"`
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-// api view projection
|
|
|
|
|
-type AccountDTO struct {
|
|
|
|
|
- Email string `json:"email"`
|
|
|
|
|
- Name string `json:"name"`
|
|
|
|
|
- Collaborators []*CollaboratorDTO `json:"collaborators"`
|
|
|
|
|
-}
|
|
|
|
|
|
|
+// ---------------------
|
|
|
|
|
+// COMMANDS
|
|
|
|
|
|
|
|
type CreateAccountCommand struct {
|
|
type CreateAccountCommand struct {
|
|
|
Email string `json:"email" binding:"required"`
|
|
Email string `json:"email" binding:"required"`
|
|
@@ -66,13 +48,19 @@ type SetUsingAccountCommand struct {
|
|
|
UsingAccountId int64
|
|
UsingAccountId int64
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// returns a view projection
|
|
|
|
|
|
|
+type SetDefaultDataSourceCommand struct {
|
|
|
|
|
+ AccountId int64
|
|
|
|
|
+ DataSourceId int64
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// ----------------------
|
|
|
|
|
+// QUERIES
|
|
|
|
|
+
|
|
|
type GetAccountInfoQuery struct {
|
|
type GetAccountInfoQuery struct {
|
|
|
Id int64
|
|
Id int64
|
|
|
Result AccountDTO
|
|
Result AccountDTO
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// returns a view projection
|
|
|
|
|
type GetOtherAccountsQuery struct {
|
|
type GetOtherAccountsQuery struct {
|
|
|
AccountId int64
|
|
AccountId int64
|
|
|
Result []*OtherAccountDTO
|
|
Result []*OtherAccountDTO
|
|
@@ -87,3 +75,25 @@ type GetAccountByLoginQuery struct {
|
|
|
Login string
|
|
Login string
|
|
|
Result *Account
|
|
Result *Account
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+// ------------------------
|
|
|
|
|
+// DTO & Projections
|
|
|
|
|
+
|
|
|
|
|
+type OtherAccountDTO struct {
|
|
|
|
|
+ Id int64 `json:"id"`
|
|
|
|
|
+ Email string `json:"email"`
|
|
|
|
|
+ Role string `json:"role"`
|
|
|
|
|
+ IsUsing bool `json:"isUsing"`
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+type CollaboratorDTO struct {
|
|
|
|
|
+ AccountId int64 `json:"accountId"`
|
|
|
|
|
+ Email string `json:"email"`
|
|
|
|
|
+ Role string `json:"role"`
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+type AccountDTO struct {
|
|
|
|
|
+ Email string `json:"email"`
|
|
|
|
|
+ Name string `json:"name"`
|
|
|
|
|
+ Collaborators []*CollaboratorDTO `json:"collaborators"`
|
|
|
|
|
+}
|