MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / Create

Method Create

app/controlplane/pkg/biz/project.go:207–234  ·  view source on GitHub ↗
(ctx context.Context, orgID, name string)

Source from the content-addressed store, hash-verified

205}
206
207func (uc *ProjectUseCase) Create(ctx context.Context, orgID, name string) (*Project, error) {
208 ctx, span := otelx.Start(ctx, projectTracer, "ProjectUseCase.Create")
209 defer span.End()
210
211 if name == "" || orgID == "" {
212 return nil, NewErrValidationStr("orgID or project name are empty")
213 }
214
215 orgUUID, err := uuid.Parse(orgID)
216 if err != nil {
217 return nil, NewErrInvalidUUID(err)
218 }
219
220 project, err := uc.projectsRepository.Create(ctx, orgUUID, name)
221 if err != nil {
222 return nil, err
223 }
224
225 // Dispatch audit event for project creation
226 uc.auditorUC.Dispatch(ctx, &events.ProjectCreated{
227 ProjectBase: &events.ProjectBase{
228 ProjectID: &project.ID,
229 ProjectName: project.Name,
230 },
231 }, &orgUUID)
232
233 return project, nil
234}
235
236// ListMembers lists the members of a project with pagination.
237func (uc *ProjectUseCase) ListMembers(ctx context.Context, orgID uuid.UUID, projectRef *IdentityReference, paginationOpts *pagination.OffsetPaginationOpts) ([]*ProjectMembership, int, error) {

Callers

nothing calls this directly

Calls 6

StartFunction · 0.92
NewErrValidationStrFunction · 0.85
NewErrInvalidUUIDFunction · 0.85
ParseMethod · 0.80
CreateMethod · 0.65
DispatchMethod · 0.45

Tested by

no test coverage detected