ports
go
import "github.com/prescriptoo/prescriptoo-api/services/organization/internal/ports"Package ports defines repository interfaces for the organization service.
Index
- type DoctorOrganizationRepository
- type ListActiveOrganizationsQuery
- type MemberRepository
- type MutationRepositories
- type MutationRunner
- type OrganizationRepository
- type TeamRepository
type DoctorOrganizationRepository
DoctorOrganizationRepository reads only the active organization discovery projection.
go
type DoctorOrganizationRepository interface {
ListActive(context.Context, ListActiveOrganizationsQuery) ([]types.DoctorOrganization, error)
// ListAssigned returns active affiliations to active organizations for one doctor.
ListAssigned(context.Context, string) ([]types.DoctorOrganizationAssignment, error)
}type ListActiveOrganizationsQuery
ListActiveOrganizationsQuery selects a bounded keyset page from persistence.
go
type ListActiveOrganizationsQuery struct {
AfterID string
Limit int
}type MemberRepository
MemberRepository defines the driven repository port for members.
go
type MemberRepository interface {
Create(ctx context.Context, member *domain.Member) error
GetByID(ctx context.Context, id string) (*domain.Member, error)
GetByUserAndOrg(ctx context.Context, userID, orgID string) (*domain.Member, error)
ListByOrganizationID(ctx context.Context, orgID string) ([]*domain.Member, error)
ListByUserID(ctx context.Context, userID string) ([]*domain.Member, error)
GetActiveContext(ctx context.Context, userID string) (*domain.Member, error)
Update(ctx context.Context, member *domain.Member) error
UpdateRole(ctx context.Context, id string, role domain.MemberRole) error
SetActiveContext(ctx context.Context, userID, orgID string) error
Delete(ctx context.Context, id string) error
}type MutationRepositories
MutationRepositories contains repositories bound to one organization transaction.
go
type MutationRepositories struct {
CheckMutation func(context.Context, string, int, int, bool) error
Organizations OrganizationRepository
Members MemberRepository
Teams TeamRepository
}type MutationRunner
MutationRunner commits owner-managed business writes and their audit records together.
go
type MutationRunner interface {
Run(context.Context, audit.OperationContext, func(MutationRepositories) error) error
}type OrganizationRepository
OrganizationRepository defines the driven repository port for organizations.
go
type OrganizationRepository interface {
Create(ctx context.Context, org *domain.Organization) error
GetByID(ctx context.Context, id string) (*domain.Organization, error)
GetBySlug(ctx context.Context, slug string) (*domain.Organization, error)
List(ctx context.Context) ([]*domain.Organization, error)
ListByUserID(ctx context.Context, userID string) ([]*domain.Organization, error)
Update(ctx context.Context, org *domain.Organization) error
UpdateStatus(ctx context.Context, id string, status domain.OrganizationStatus) error
Delete(ctx context.Context, id string) error
}type TeamRepository
TeamRepository defines the driven repository port for teams.
go
type TeamRepository interface {
Create(ctx context.Context, team *domain.Team) error
GetByID(ctx context.Context, id string) (*domain.Team, error)
ListByOrganizationID(ctx context.Context, orgID string) ([]*domain.Team, error)
Update(ctx context.Context, team *domain.Team) error
Delete(ctx context.Context, id string) error
}Generated by gomarkdoc