| 1 | package equipo |
| 2 | |
| 3 | import ( |
| 4 | "amadan.net/oficina/equipo/internal/equipo/kernel" |
| 5 | "amadan.net/oficina/equipo/internal/equipo/personapi" |
| 6 | "amadan.net/oficina/equipo/internal/equipo/setup" |
| 7 | "context" |
| 8 | "gorm.io/gorm" |
| 9 | ) |
| 10 | |
| 11 | type ProjectGroup = kernel.ProjectGroup |
| 12 | type ProjectDetail = kernel.ProjectDetail |
| 13 | |
| 14 | func (s *Store) projectsStore() *setup.ProjectsStore { |
| 15 | return &setup.ProjectsStore{Write: s.write, Read: s.invitationRead, Owner: requireOwner, Member: memberAt, Audit: appendAudit, Fence: s.fenceAuthority, Normalize: normalizeAddress, ValidAddress: validAddress, Error: storeError, Invalid: ErrInvalid, NotFound: ErrNotFound, Conflict: ErrConflict, Unavailable: ErrUnavailable, BindingInUse: ErrBindingInUse, AccountLabelExists: ErrAccountLabelExists, Replay: func(tx *gorm.DB, ctx context.Context, out any) (bool, error) { |
| 16 | return personapi.Replay(tx, ctx, out, ErrConflict) |
| 17 | }, SaveResult: func(tx *gorm.DB, ctx context.Context, out any) error { |
| 18 | return personapi.SaveResult(tx, ctx, out, ErrConflict) |
| 19 | }} |
| 20 | } |
| 21 | func (s *Store) SaveAccount(ctx context.Context, a Actor, in Account) (Account, error) { |
| 22 | return s.projectsStore().SaveAccount(ctx, a, in) |
| 23 | } |
| 24 | func (s *Store) SaveProject(ctx context.Context, a Actor, in Project, owners []DecisionOwner, request string) (Project, error) { |
| 25 | return s.projectsStore().SaveProject(ctx, a, in, owners, request) |
| 26 | } |
| 27 | func (s *Store) Projects(ctx context.Context) ([]ProjectGroup, error) { |
| 28 | return s.projectsStore().Projects(ctx) |
| 29 | } |
| 30 | func (s *Store) Project(ctx context.Context, id int64) (ProjectDetail, error) { |
| 31 | return s.projectsStore().Project(ctx, id) |
| 32 | } |
| 33 | func CanonicalBranch(value string) (string, error) { return setup.CanonicalBranch(value, ErrInvalid) } |
| 34 | func canonicalRepository(value string) (string, error) { |
| 35 | return setup.CanonicalRepository(value, ErrInvalid) |
| 36 | } |
| 37 | |