Small progress on adding collaborator

This commit is contained in:
Torkel Ödegaard
2014-09-18 12:03:46 +02:00
parent 4dfe8b6f69
commit 158b708eac
8 changed files with 77 additions and 21 deletions
+13 -4
View File
@@ -21,22 +21,22 @@ type Dashboard struct {
Data map[string]interface{}
}
type UserAccountLink struct {
UserId int
type CollaboratorLink struct {
AccountId int
Role string
ModifiedOn time.Time
CreatedOn time.Time
}
type UserAccount struct {
DatabaseId int `gorethink:"id"`
Id int `gorethink:"id"`
UserName string
Login string
Email string
Password string
NextDashboardId int
UsingAccountId int
GrantedAccess []UserAccountLink
Collaborators []CollaboratorLink
CreatedOn time.Time
ModifiedOn time.Time
}
@@ -87,3 +87,12 @@ func (dash *Dashboard) UpdateSlug() {
re2 := regexp.MustCompile("\\s")
dash.Slug = re2.ReplaceAllString(re.ReplaceAllString(title, ""), "-")
}
func (account *UserAccount) AddCollaborator(accountId int) {
account.Collaborators = append(account.Collaborators, CollaboratorLink{
AccountId: accountId,
Role: "admin",
CreatedOn: time.Now(),
ModifiedOn: time.Now(),
})
}