49 lines
862 B
Go
49 lines
862 B
Go
package projects
|
|
|
|
type ProjectMember struct {
|
|
MemberId int
|
|
Role string
|
|
}
|
|
|
|
type Project struct {
|
|
Id int
|
|
Name string
|
|
Members []ProjectMember
|
|
}
|
|
|
|
func NewProject(id int, name string, member *ProjectMember) *Project {
|
|
members := make([]ProjectMember, 0)
|
|
members = append(members, *member)
|
|
|
|
return &Project{
|
|
Id: id,
|
|
Name: name,
|
|
Members: members,
|
|
}
|
|
}
|
|
|
|
func NewProjectMember(memberId int, role string) *ProjectMember {
|
|
return &ProjectMember{
|
|
MemberId: memberId,
|
|
Role: role,
|
|
}
|
|
}
|
|
|
|
func (p Project) AddMember(member *ProjectMember) {
|
|
p.Members = append(p.Members, *member)
|
|
}
|
|
|
|
type CreateProject struct {
|
|
Name string
|
|
MemberIds []int
|
|
AdminIds []int
|
|
}
|
|
|
|
func NewCreateProject(name string, userId int) *CreateProject {
|
|
return &CreateProject{
|
|
Name: name,
|
|
MemberIds: []int{userId},
|
|
AdminIds: []int{userId},
|
|
}
|
|
}
|