Documentation ¶
Index ¶
- Variables
- type Controller
- type DeleteResponseDto
- type Entity
- type GetResponseDto
- type PatchRequestDto
- type PatchResponseDto
- type PostRequestDto
- type PostResponseDto
- type Query
- type QueryImpl
- type Repository
- type RepositoryImpl
- func (r *RepositoryImpl) Create(req *Entity) (*Entity, error)
- func (r *RepositoryImpl) DeleteById(id string) error
- func (r *RepositoryImpl) FindById(id string) (*Entity, error)
- func (r *RepositoryImpl) FindByNodeId(nodeId string) ([]Entity, error)
- func (r *RepositoryImpl) FindByNodeIdAndRoleId(nodeId string, roleId string) ([]Entity, error)
- func (r *RepositoryImpl) UpdateById(fields map[string]interface{}, id string) error
- type Service
- func (s *Service) Create(req PostRequestDto) (*Entity, error)
- func (s *Service) DeleteById(id string) error
- func (s *Service) RetrieveById(id string) (*Entity, error)
- func (s *Service) RetrieveByNodeId(nodeId string) ([]Entity, error)
- func (s *Service) RetrieveByNodeIdAndRoleId(nodeId string, roleId string) ([]Entity, error)
- func (s *Service) UpdateById(fields map[string]interface{}, id string) error
Constants ¶
This section is empty.
Variables ¶
var ( MaxCountUnlimited = -1 RankLowest = 2147483647 )
var ( FieldsAll = []string{ "id", "node_id", "role_id", "ehid", } FieldsAllExceptId = []string{ "node_id", "role_id", "ehid", } FieldsAllExceptNodeId = []string{ "id", "role_id", "ehid", } FieldsPatchable = []string{ "node_id", "role_id", "ehid", } )
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct { ConfigService *config.Service LocalErrorService *localerror.Service DesignationService *Service }
func NewController ¶
func NewController(cfg *config.Service, svc *Service) *Controller
func (*Controller) Delete ¶
func (c *Controller) Delete(w http.ResponseWriter, r *http.Request)
Delete Designations : HTTP endpoint to delete designations @Tags Designations @Description Delete a designation @Produce json @Param id path string true "Designation ID" @Success 200 {object} DeleteResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /designations/{id} [DELETE]
func (*Controller) Get ¶
func (c *Controller) Get(w http.ResponseWriter, r *http.Request)
Get Designations : HTTP endpoint to get designations @Tags Designations @Description Get a designation @Produce json @Param id path string true "Designation ID" @Success 200 {object} GetResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /designations/{id} [GET]
func (*Controller) Patch ¶
func (c *Controller) Patch(w http.ResponseWriter, r *http.Request)
Patch Designations : HTTP endpoint to patch a designation @Tags Designations @Description Patch a designation @Accept json @Produce json @Param id path string true "Designation ID" @Param data body PatchRequestDto true "Designation Patch Request" @Success 200 {object} PatchResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /designations/{id} [PATCH]
func (*Controller) Post ¶
func (c *Controller) Post(w http.ResponseWriter, r *http.Request)
Post Designations : HTTP endpoint to post new designations @Tags Designations @Description Post a new designations @Accept json @Produce json @Param data body PostRequestDto true "Designation Request" @Success 200 {object} PostResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /designations [POST]
type DeleteResponseDto ¶
type DeleteResponseDto = dtorespwithoutdata.Class
type GetResponseDto ¶
type GetResponseDto = dtorespwithdata.Class[Entity]
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[Entity]
type Query ¶
type QueryImpl ¶
func (*QueryImpl) SelectByNodeId ¶
type Repository ¶
type Repository interface { Create(req *Entity) (*Entity, error) FindById(id string) (*Entity, error) UpdateById(fields map[string]interface{}, ehid string) error DeleteById(id string) error FindByNodeId(nodeId string) ([]Entity, error) FindByNodeIdAndRoleId(nodeId string, roleId string) ([]Entity, error) }
func NewRepository ¶
func NewRepository(cfg *config.Service) Repository
type RepositoryImpl ¶
func (*RepositoryImpl) DeleteById ¶
func (r *RepositoryImpl) DeleteById(id string) error
func (*RepositoryImpl) FindByNodeId ¶
func (r *RepositoryImpl) FindByNodeId(nodeId string) ([]Entity, error)
func (*RepositoryImpl) FindByNodeIdAndRoleId ¶
func (r *RepositoryImpl) FindByNodeIdAndRoleId( nodeId string, roleId string, ) ([]Entity, error)
func (*RepositoryImpl) UpdateById ¶
func (r *RepositoryImpl) UpdateById(fields map[string]interface{}, id string) error
type Service ¶
type Service struct { ConfigService *config.Service DesignationRepository Repository RoleRepository role.Repository }
func NewService ¶
func NewService( cfg *config.Service, r Repository, rr role.Repository, ) *Service