Handle default datasource management

This commit is contained in:
Torkel Ödegaard
2015-01-09 16:36:23 +01:00
parent d562dcd90c
commit 68cc3f86dd
11 changed files with 120 additions and 43 deletions
+11 -17
View File
@@ -12,18 +12,17 @@ var (
)
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
Salt string `xorm:"VARCHAR(10)"`
Company string
NextDashboardId int
UsingAccountId int64
DefaultDataSourceId 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
Created time.Time
Updated time.Time
@@ -48,11 +47,6 @@ type SetUsingAccountCommand struct {
UsingAccountId int64
}
type SetDefaultDataSourceCommand struct {
AccountId int64
DataSourceId int64
}
// ----------------------
// QUERIES
+6 -1
View File
@@ -33,6 +33,7 @@ type DataSource struct {
User string
Database string
BasicAuth bool
IsDefault bool
Created time.Time
Updated time.Time
@@ -41,8 +42,9 @@ type DataSource struct {
// ----------------------
// COMMANDS
// Also acts as api DTO
type AddDataSourceCommand struct {
AccountId int64
AccountId int64 `json:"-"`
Name string
Type DsType
Access DsAccess
@@ -50,10 +52,12 @@ type AddDataSourceCommand struct {
Password string
Database string
User string
IsDefault bool
Result *DataSource
}
// Also acts as api DTO
type UpdateDataSourceCommand struct {
Id int64
AccountId int64
@@ -64,6 +68,7 @@ type UpdateDataSourceCommand struct {
Password string
User string
Database string
IsDefault bool
}
type DeleteDataSourceCommand struct {