Documentation ¶
Index ¶
- Variables
- type Controller
- type DeleteResponseDto
- type Entity
- type GetEhidResponseDto
- type GetResponseDto
- type PatchRequestDto
- type PatchResponseDto
- type Repository
- type RepositoryImpl
- func (r *RepositoryImpl) CreateWithDb(db *gorm.DB, employeeId string, ehid string) error
- func (r *RepositoryImpl) DeleteByEhid(ehid string) error
- func (r *RepositoryImpl) FindByEhid(ehid string) (*Entity, error)
- func (r *RepositoryImpl) FindEmployeeIdByEhid(ehid string) (string, error)
- func (r *RepositoryImpl) UpdateByEhid(fields map[string]string, ehid string) error
- type Service
Constants ¶
This section is empty.
Variables ¶
var (
FieldsPatchable = []string{
"name",
"email_address",
"dob",
}
)
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct { ConfigService *config.Service LocalErrorService *localerror.Service ProfileService *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 Profiles : HTTP endpoint to delete a profile @Tags Profiles @Description Delete a profile @Produce json @Param ehid path string true "Employee Hash ID" @Success 200 {object} DeleteResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /profiles/{ehid} [DELETE]
func (*Controller) Get ¶
func (c *Controller) Get(w http.ResponseWriter, r *http.Request)
Get Profiles : HTTP endpoint to get a profile @Tags Profiles @Description Get a profile @Produce json @Param ehid path string true "Employee Hash ID" @Success 200 {object} GetResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /profiles/{ehid} [GET]
func (*Controller) GetMyEhid ¶
func (c *Controller) GetMyEhid(w http.ResponseWriter, r *http.Request)
Get My EHID : HTTP endpoint to get current user's EHID @Tags Profiles @Description Get current user's EHID @Produce json @Param Authorization header string true "Bearer Token" @Success 200 {object} GetEhidResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /profiles/me/ehid [GET]
func (*Controller) Patch ¶
func (c *Controller) Patch(w http.ResponseWriter, r *http.Request)
Patch Profiles : HTTP endpoint to patch a profile @Tags Profiles @Description Patch a profile @Accept json @Produce json @Param ehid path string true "Employee Hash ID" @Param data body PatchRequestDto true "Profile Patch Request" @Success 200 {object} PatchResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /profiles/{ehid} [PATCH]
type DeleteResponseDto ¶
type DeleteResponseDto = dtorespwithoutdata.Class
type GetEhidResponseDto ¶
type GetEhidResponseDto = dtorespwithdata.Class[string]
type GetResponseDto ¶
type GetResponseDto = dtorespwithdata.Class[Entity]
type PatchRequestDto ¶
type PatchResponseDto ¶
type PatchResponseDto = dtorespwithoutdata.Class
type Repository ¶
type Repository interface { CreateWithDb(db *gorm.DB, employeeId string, ehid string) error UpdateByEhid(fields map[string]string, ehid string) error FindByEhid(ehid string) (*Entity, error) FindEmployeeIdByEhid(ehid string) (string, error) DeleteByEhid(ehid string) error }
func NewRepository ¶
func NewRepository(cfg *config.Service) Repository
type RepositoryImpl ¶
func (*RepositoryImpl) CreateWithDb ¶
func (*RepositoryImpl) DeleteByEhid ¶
func (r *RepositoryImpl) DeleteByEhid(ehid string) error
func (*RepositoryImpl) FindByEhid ¶
func (r *RepositoryImpl) FindByEhid(ehid string) (*Entity, error)
func (*RepositoryImpl) FindEmployeeIdByEhid ¶
func (r *RepositoryImpl) FindEmployeeIdByEhid(ehid string) (string, error)
func (*RepositoryImpl) UpdateByEhid ¶
func (r *RepositoryImpl) UpdateByEhid( fields map[string]string, ehid string, ) error
type Service ¶
type Service struct { ConfigService *config.Service ProfileRepository Repository }
func NewService ¶
func NewService(cfg *config.Service, r Repository) *Service