service backend
This commit is contained in:
44
api/pkg/model/organization.go
Normal file
44
api/pkg/model/organization.go
Normal file
@@ -0,0 +1,44 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/tech/sendico/pkg/mservice"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
||||
type OrganizationBase struct {
|
||||
PermissionBound `bson:",inline" json:",inline"`
|
||||
Describable `bson:",inline" json:",inline"`
|
||||
TenantRef primitive.ObjectID `bson:"tenantRef" json:"tenantRef"`
|
||||
TimeZone string `bson:"timeZone" json:"timeZone"`
|
||||
LogoURL *string `bson:"logoUrl,omitempty" json:"logoUrl,omitempty"`
|
||||
}
|
||||
|
||||
func (*OrganizationBase) Collection() string {
|
||||
return mservice.Organizations
|
||||
}
|
||||
|
||||
type Organization struct {
|
||||
OrganizationBase `bson:",inline" json:",inline"`
|
||||
Members []primitive.ObjectID `bson:"members" json:"members"`
|
||||
}
|
||||
|
||||
type OrganizationBound interface {
|
||||
GetOrganizationRef() primitive.ObjectID
|
||||
SetOrganizationRef(organizationRef primitive.ObjectID)
|
||||
}
|
||||
|
||||
const (
|
||||
OrganizationRefField = "organizationRef"
|
||||
)
|
||||
|
||||
type OrganizationBoundBase struct {
|
||||
OrganizationRef primitive.ObjectID `bson:"organizationRef" json:"organizationRef"`
|
||||
}
|
||||
|
||||
func (a *OrganizationBoundBase) GetOrganizationRef() primitive.ObjectID {
|
||||
return a.OrganizationRef
|
||||
}
|
||||
|
||||
func (a *OrganizationBoundBase) SetOrganizationRef(organizationRef primitive.ObjectID) {
|
||||
a.OrganizationRef = organizationRef
|
||||
}
|
||||
Reference in New Issue
Block a user