fix: project by id loads project from view and from eventstore (#315)

This commit is contained in:
Silvan
2020-06-30 07:54:39 +02:00
committed by GitHub
parent 3937e76947
commit 3c56fe6a0f
2 changed files with 25 additions and 1 deletions

View File

@@ -71,6 +71,14 @@ func (es *ProjectEventstore) ProjectByID(ctx context.Context, id string) (*proj_
return model.ProjectToModel(project), nil
}
func (es *ProjectEventstore) ProjectEventsByID(ctx context.Context, id string, sequence uint64) ([]*es_models.Event, error) {
query, err := ProjectByIDQuery(id, sequence)
if err != nil {
return nil, err
}
return es.FilterEvents(ctx, query)
}
func (es *ProjectEventstore) CreateProject(ctx context.Context, project *proj_model.Project) (*proj_model.Project, error) {
if !project.IsValid() {
return nil, caos_errs.ThrowPreconditionFailed(nil, "EVENT-9dk45", "Errors.Project.Invalid")