Worked on account update, moved collaborats to its own api url and files

This commit is contained in:
Torkel Ödegaard
2015-01-15 19:14:47 +01:00
parent 804bff55ec
commit 04bbdbad12
8 changed files with 182 additions and 86 deletions
+11 -9
View File
@@ -42,6 +42,14 @@ type CreateAccountCommand struct {
Result Account `json:"-"`
}
type UpdateAccountCommand struct {
Email string `json:"email" binding:"required"`
Login string `json:"login"`
Name string `json:"name"`
AccountId int64 `json:"-"`
}
type SetUsingAccountCommand struct {
AccountId int64
UsingAccountId int64
@@ -88,12 +96,6 @@ type OtherAccountDTO struct {
IsUsing bool `json:"isUsing"`
}
type CollaboratorDTO struct {
CollaboratorId int64 `json:"id"`
Email string `json:"email"`
Role string `json:"role"`
}
type AccountSearchHitDTO struct {
Id int64 `json:"id"`
Name string `json:"name"`
@@ -103,7 +105,7 @@ type AccountSearchHitDTO struct {
}
type AccountDTO struct {
Email string `json:"email"`
Name string `json:"name"`
Collaborators []*CollaboratorDTO `json:"collaborators"`
Email string `json:"email"`
Name string `json:"name"`
Login string `json:"login"`
}
+29 -8
View File
@@ -21,6 +21,19 @@ type Collaborator struct {
Updated time.Time
}
func NewCollaborator(accountId int64, collaboratorId int64, role RoleType) *Collaborator {
return &Collaborator{
AccountId: accountId,
CollaboratorId: collaboratorId,
Role: role,
Created: time.Now(),
Updated: time.Now(),
}
}
// ---------------------
// COMMANDS
type RemoveCollaboratorCommand struct {
CollaboratorId int64
AccountId int64
@@ -33,12 +46,20 @@ type AddCollaboratorCommand struct {
Role RoleType `json:"-"`
}
func NewCollaborator(accountId int64, collaboratorId int64, role RoleType) *Collaborator {
return &Collaborator{
AccountId: accountId,
CollaboratorId: collaboratorId,
Role: role,
Created: time.Now(),
Updated: time.Now(),
}
// ----------------------
// QUERIES
type GetCollaboratorsQuery struct {
AccountId int64
Result []*CollaboratorDTO
}
// ----------------------
// Projections and DTOs
type CollaboratorDTO struct {
CollaboratorId int64 `json:"id"`
Email string `json:"email"`
Login string `json:"login"`
Role string `json:"role"`
}