get other accounts works
This commit is contained in:
@@ -32,6 +32,7 @@ func Init() {
|
||||
models.CreateAccount = CreateAccount
|
||||
models.GetAccount = GetAccount
|
||||
models.GetAccountByLogin = GetAccountByLogin
|
||||
models.GetOtherAccountsFor = GetOtherAccountsFor
|
||||
models.GetDashboard = GetDashboard
|
||||
models.SaveDashboard = SaveDashboard
|
||||
models.SearchQuery = SearchQuery
|
||||
|
||||
@@ -60,9 +60,12 @@ func GetAccountByLogin(emailOrLogin string) (*models.Account, error) {
|
||||
|
||||
func GetCollaboratorsForAccount(accountId int64) ([]*models.CollaboratorInfo, error) {
|
||||
collaborators := make([]*models.CollaboratorInfo, 0)
|
||||
|
||||
sess := x.Table("Collaborator")
|
||||
sess.Join("INNER", "Account", "Account.id=Collaborator.account_Id")
|
||||
sess.Where("Collaborator.for_account_id=?", accountId)
|
||||
err := sess.Find(&collaborators)
|
||||
|
||||
return collaborators, err
|
||||
}
|
||||
|
||||
@@ -85,3 +88,12 @@ func AddCollaborator(collaborator *models.Collaborator) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetOtherAccountsFor(accountId int64) ([]*models.OtherAccount, error) {
|
||||
collaborators := make([]*models.OtherAccount, 0)
|
||||
sess := x.Table("Collaborator")
|
||||
sess.Join("INNER", "Account", "Account.id=Collaborator.account_Id")
|
||||
sess.Where("Collaborator.account_id=?", accountId)
|
||||
err := sess.Find(&collaborators)
|
||||
return collaborators, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user