Documentation ¶
Index ¶
- Variables
- type Controller
- type DeleteResponseDto
- type Entity
- type GetResponseDto
- type PatchRequestDto
- type PatchResponseDto
- type PostRequestDto
- type PostResponseDto
- type Query
- type QueryImpl
- func (q *QueryImpl) SelectActiveByEhid(fields []string, ehid string) *gorm.DB
- func (q *QueryImpl) SelectActiveByNodeId(fields []string, nodeId string) *gorm.DB
- func (q *QueryImpl) SelectByEhid(fields []string, ehid string) *gorm.DB
- func (q *QueryImpl) SelectByEhidOrderByStartDate(fields []string, ehid string, orderDir string) *gorm.DB
- func (q *QueryImpl) SelectById(fields []string, id int) *gorm.DB
- type Repository
- type RepositoryImpl
- func (r *RepositoryImpl) Create(req *Entity) (*Entity, error)
- func (r *RepositoryImpl) DeleteById(id int) error
- func (r *RepositoryImpl) FindByEhidOrderByStartDate(ehid string, orderDir string) ([]Entity, error)
- func (r *RepositoryImpl) FindById(id int) (*Entity, error)
- func (r *RepositoryImpl) FindCurrentByEhid(ehid string) ([]Entity, error)
- func (r *RepositoryImpl) FindCurrentByNodeId(nodeId string) ([]Entity, error)
- func (r *RepositoryImpl) UpdateById(fields map[string]interface{}, id int) error
- type Service
- func (s *Service) Create(req PostRequestDto) (*ViewEntity, error)
- func (s *Service) DeleteById(id int) error
- func (s *Service) RetrieveByEhidOrderByStartDate(ehid string, orderDir string) ([]ViewEntity, error)
- func (s *Service) RetrieveById(id int) (*ViewEntity, error)
- func (s *Service) RetrieveCurrentByEhid(ehid string) ([]ViewEntity, error)
- func (s *Service) RetrieveCurrentByNodeId(nodeId string) ([]ViewEntity, error)
- func (s *Service) UpdateById(fields map[string]interface{}, id int) error
- type ViewEntity
Constants ¶
This section is empty.
Variables ¶
var ( FieldsAll = []string{ "id", "ehid", "start_date", "end_date", "node_id", } FieldsAllExceptId = []string{ "ehid", "start_date", "end_date", "node_id", } FieldsAllExceptIdAndEndDate = []string{ "ehid", "start_date", "node_id", } FieldsPatchable = []string{ "end_date", } OrderAsc = "ASC" OrderDesc = "DESC" OrderNone = "" )
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct { ConfigService *config.Service LocalErrorService *localerror.Service MembershipService *Service }
func NewController ¶
func NewController(cfg *config.Service, les *localerror.Service, svc *Service) *Controller
func (*Controller) Delete ¶
func (c *Controller) Delete(w http.ResponseWriter, r *http.Request)
Delete Memberships : HTTP endpoint to delete memberships @Tags Memberships @Description Delete a membership @Produce json @Param id path string true "Membership ID" @Success 200 {object} DeleteResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /memberships/{id} [DELETE]
func (*Controller) Get ¶
func (c *Controller) Get(w http.ResponseWriter, r *http.Request)
Get Memberships : HTTP endpoint to get memberships @Tags Memberships @Description Get a memberhsip @Produce json @Param id path string true "Membership ID" @Success 200 {object} GetResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /memberships/{id} [GET]
func (*Controller) Patch ¶
func (c *Controller) Patch(w http.ResponseWriter, r *http.Request)
Patch Memberships : HTTP endpoint to patch a membership @Tags Memberships @Description Patch a membership @Accept json @Produce json @Param id path string true "Membership ID" @Param data body PatchRequestDto true "Membership Patch Request" @Success 200 {object} PatchResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /memberships/{id} [PATCH]
func (*Controller) Post ¶
func (c *Controller) Post(w http.ResponseWriter, r *http.Request)
Post Memberships : HTTP endpoint to post new memberships @Tags Memberships @Description Post a new memberships @Accept json @Produce json @Param data body PostRequestDto true "Membership Request" @Success 200 {object} PostResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /memberships [POST]
type DeleteResponseDto ¶
type DeleteResponseDto = dtorespwithoutdata.Class
type GetResponseDto ¶
type GetResponseDto = dtorespwithdata.Class[ViewEntity]
type PatchRequestDto ¶
type PatchRequestDto struct {
Fields map[string]interface{} `json:"fields"`
}
type PatchResponseDto ¶
type PatchResponseDto = dtorespwithoutdata.Class
type PostRequestDto ¶
type PostResponseDto ¶
type PostResponseDto = dtorespwithdata.Class[ViewEntity]
type Query ¶
type Query interface { SelectById(fields []string, id int) *gorm.DB SelectByEhid(fields []string, ehid string) *gorm.DB SelectByEhidOrderByStartDate(fields []string, ehid string, orderDir string) *gorm.DB SelectActiveByNodeId(fields []string, nodeId string) *gorm.DB SelectActiveByEhid(fields []string, ehid string) *gorm.DB }
type QueryImpl ¶
func (*QueryImpl) SelectActiveByEhid ¶
func (*QueryImpl) SelectActiveByNodeId ¶
func (*QueryImpl) SelectByEhid ¶
func (*QueryImpl) SelectByEhidOrderByStartDate ¶
type Repository ¶
type Repository interface { Create(req *Entity) (*Entity, error) FindById(id int) (*Entity, error) UpdateById(fields map[string]interface{}, id int) error DeleteById(id int) error FindByEhidOrderByStartDate(ehid string, orderDir string) ([]Entity, error) FindCurrentByNodeId(nodeId string) ([]Entity, error) FindCurrentByEhid(ehid string) ([]Entity, error) }
func NewRepository ¶
func NewRepository(cfg *config.Service) Repository
type RepositoryImpl ¶
func (*RepositoryImpl) DeleteById ¶
func (r *RepositoryImpl) DeleteById(id int) error
func (*RepositoryImpl) FindByEhidOrderByStartDate ¶
func (r *RepositoryImpl) FindByEhidOrderByStartDate(ehid string, orderDir string) ([]Entity, error)
func (*RepositoryImpl) FindCurrentByEhid ¶
func (r *RepositoryImpl) FindCurrentByEhid(ehid string) ([]Entity, error)
func (*RepositoryImpl) FindCurrentByNodeId ¶
func (r *RepositoryImpl) FindCurrentByNodeId(nodeId string) ([]Entity, error)
func (*RepositoryImpl) UpdateById ¶
func (r *RepositoryImpl) UpdateById(fields map[string]interface{}, id int) error
type Service ¶
type Service struct { ConfigService *config.Service MembershipRepository Repository }
func NewService ¶
func NewService( cfg *config.Service, r Repository, ) *Service
func (*Service) Create ¶
func (s *Service) Create(req PostRequestDto) (*ViewEntity, error)
func (*Service) DeleteById ¶
func (*Service) RetrieveByEhidOrderByStartDate ¶
func (s *Service) RetrieveByEhidOrderByStartDate(ehid string, orderDir string) ([]ViewEntity, error)
func (*Service) RetrieveById ¶
func (s *Service) RetrieveById(id int) (*ViewEntity, error)
func (*Service) RetrieveCurrentByEhid ¶
func (s *Service) RetrieveCurrentByEhid(ehid string) ([]ViewEntity, error)
func (*Service) RetrieveCurrentByNodeId ¶
func (s *Service) RetrieveCurrentByNodeId(nodeId string) ([]ViewEntity, error)