2018-05-14 16:26:38 +00:00
|
|
|
package platform
|
|
|
|
|
|
|
|
import "context"
|
|
|
|
|
2018-07-20 10:24:07 +00:00
|
|
|
// Organization is an organization. 🎉
|
2018-05-14 16:26:38 +00:00
|
|
|
type Organization struct {
|
2018-10-12 01:06:43 +00:00
|
|
|
ID ID `json:"id,omitempty"`
|
2018-05-14 16:26:38 +00:00
|
|
|
Name string `json:"name"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// OrganizationService represents a service for managing organization data.
|
|
|
|
type OrganizationService interface {
|
|
|
|
// Returns a single organization by ID.
|
|
|
|
FindOrganizationByID(ctx context.Context, id ID) (*Organization, error)
|
|
|
|
|
|
|
|
// Returns the first organization that matches filter.
|
|
|
|
FindOrganization(ctx context.Context, filter OrganizationFilter) (*Organization, error)
|
|
|
|
|
|
|
|
// Returns a list of organizations that match filter and the total count of matching organizations.
|
|
|
|
// Additional options provide pagination & sorting.
|
|
|
|
FindOrganizations(ctx context.Context, filter OrganizationFilter, opt ...FindOptions) ([]*Organization, int, error)
|
|
|
|
|
|
|
|
// Creates a new organization and sets b.ID with the new identifier.
|
|
|
|
CreateOrganization(ctx context.Context, b *Organization) error
|
|
|
|
|
|
|
|
// Updates a single organization with changeset.
|
|
|
|
// Returns the new organization state after update.
|
|
|
|
UpdateOrganization(ctx context.Context, id ID, upd OrganizationUpdate) (*Organization, error)
|
|
|
|
|
|
|
|
// Removes a organization by ID.
|
|
|
|
DeleteOrganization(ctx context.Context, id ID) error
|
|
|
|
}
|
|
|
|
|
|
|
|
// OrganizationUpdate represents updates to a organization.
|
|
|
|
// Only fields which are set are updated.
|
|
|
|
type OrganizationUpdate struct {
|
|
|
|
Name *string
|
|
|
|
}
|
|
|
|
|
|
|
|
// OrganizationFilter represents a set of filter that restrict the returned results.
|
|
|
|
type OrganizationFilter struct {
|
|
|
|
Name *string
|
|
|
|
ID *ID
|
|
|
|
}
|