Ejemplo n.º 1
0
func (m *ProjectManager) Create(raw *project.Project) (*project.Project, error) {
	// TODO (m0sth8): add validation
	raw.Id = bson.NewObjectId()
	raw.Created = time.Now().UTC()
	raw.Updated = raw.Created
	if raw.Members == nil {
		raw.Members = []*project.Member{}
	}
	if err := m.col.Insert(raw); err != nil {
		return nil, err
	}
	return raw, nil
}
Ejemplo n.º 2
0
func (m *ProjectManager) Update(obj *project.Project) error {
	obj.Updated = time.Now().UTC()
	return m.col.UpdateId(obj.Id, obj)
}