package referecnce import ( "api-service/internal/models" "database/sql" "encoding/json" ) // table ref_service_type table type RefServiceType struct { ID int64 `json:"id" db:"id"` Name sql.NullString `json:"name,omitempty" db:"name"` Active sql.NullBool `json:"active,omitempty" db:"active"` } // Custom JSON marshaling untuk RefServiceType agar NULL values tidak muncul di response func (r RefServiceType) MarshalJSON() ([]byte, error) { type Alias RefServiceType aux := &struct { *Alias Name *string `json:"name,omitempty"` Active *bool `json:"active,omitempty"` }{ Alias: (*Alias)(&r), } if r.Name.Valid { aux.Name = &r.Name.String } if r.Active.Valid { aux.Active = &r.Active.Bool } return json.Marshal(aux) } // Helper methods untuk mendapatkan nilai yang aman func (r *RefServiceType) GetName() string { if r.Name.Valid { return r.Name.String } return "" } func (r *RefServiceType) GetActive() bool { if r.Active.Valid { return r.Active.Bool } return false } // table ref_payment_type table type RefPaymentType struct { ID int64 `json:"id" db:"id"` Name sql.NullString `json:"name,omitempty" db:"name"` Active sql.NullBool `json:"active,omitempty" db:"active"` } // Custom JSON marshaling untuk RefPaymentType agar NULL values tidak muncul di response func (r RefPaymentType) MarshalJSON() ([]byte, error) { type Alias RefPaymentType aux := &struct { *Alias Name *string `json:"name,omitempty"` Active *bool `json:"active,omitempty"` }{ Alias: (*Alias)(&r), } if r.Name.Valid { aux.Name = &r.Name.String } if r.Active.Valid { aux.Active = &r.Active.Bool } return json.Marshal(aux) } // Helper methods untuk mendapatkan nilai yang aman func (r *RefPaymentType) GetName() string { if r.Name.Valid { return r.Name.String } return "" } func (r *RefPaymentType) GetActive() bool { if r.Active.Valid { return r.Active.Bool } return false } // table ref_visit_type table type RefVisitType struct { ID int64 `json:"id" db:"id"` Name sql.NullString `json:"name,omitempty" db:"name"` Active sql.NullBool `json:"active,omitempty" db:"active"` } // Custom JSON marshaling untuk RefVisitType agar NULL values tidak muncul di response func (r RefVisitType) MarshalJSON() ([]byte, error) { type Alias RefVisitType aux := &struct { *Alias Name *string `json:"name,omitempty"` Active *bool `json:"active,omitempty"` }{ Alias: (*Alias)(&r), } if r.Name.Valid { aux.Name = &r.Name.String } if r.Active.Valid { aux.Active = &r.Active.Bool } return json.Marshal(aux) } // Helper methods untuk mendapatkan nilai yang aman func (r *RefVisitType) GetName() string { if r.Name.Valid { return r.Name.String } return "" } func (r *RefVisitType) GetActive() bool { if r.Active.Valid { return r.Active.Bool } return false } // table ref_healthcare_type table type RefHealthcareType struct { ID int64 `json:"id" db:"id"` Name sql.NullString `json:"name,omitempty" db:"name"` Active sql.NullBool `json:"active,omitempty" db:"active"` } // Custom JSON marshaling untuk RefHealthcareType agar NULL values tidak muncul di response func (r RefHealthcareType) MarshalJSON() ([]byte, error) { type Alias RefHealthcareType aux := &struct { *Alias Name *string `json:"name,omitempty"` Active *bool `json:"active,omitempty"` }{ Alias: (*Alias)(&r), } if r.Name.Valid { aux.Name = &r.Name.String } if r.Active.Valid { aux.Active = &r.Active.Bool } return json.Marshal(aux) } // Helper methods untuk mendapatkan nilai yang aman func (r *RefHealthcareType) GetName() string { if r.Name.Valid { return r.Name.String } return "" } func (r *RefHealthcareType) GetActive() bool { if r.Active.Valid { return r.Active.Bool } return false } // Response structs for RefServiceType type RefServiceTypeGetByIDResponse struct { Message string `json:"message"` Data *RefServiceType `json:"data"` } type RefServiceTypeGetResponse struct { Message string `json:"message"` Data []RefServiceType `json:"data"` Meta models.MetaResponse `json:"meta"` Summary *models.AggregateData `json:"summary,omitempty"` } type RefServiceTypeCreateRequest struct { Name *string `json:"name" validate:"required,min=1,max=20"` Active *bool `json:"active"` } type RefServiceTypeCreateResponse struct { Message string `json:"message"` Data *RefServiceType `json:"data"` } type RefServiceTypeUpdateRequest struct { ID *int `json:"-" validate:"required,min=1"` Name *string `json:"name" validate:"required,min=1,max=20"` Active *bool `json:"active"` } type RefServiceTypeUpdateResponse struct { Message string `json:"message"` Data *RefServiceType `json:"data"` } type RefServiceTypeDeleteResponse struct { Message string `json:"message"` ID string `json:"id"` } type RefServiceTypeFilter struct { Status *string `json:"status,omitempty" form:"status"` Search *string `json:"search,omitempty" form:"search"` } // Response structs for RefPaymentType type RefPaymentTypeGetByIDResponse struct { Message string `json:"message"` Data *RefPaymentType `json:"data"` } type RefPaymentTypeGetResponse struct { Message string `json:"message"` Data []RefPaymentType `json:"data"` Meta models.MetaResponse `json:"meta"` Summary *models.AggregateData `json:"summary,omitempty"` } type RefPaymentTypeCreateRequest struct { Name *string `json:"name" validate:"required,min=1,max=20"` Active *bool `json:"active"` } type RefPaymentTypeCreateResponse struct { Message string `json:"message"` Data *RefPaymentType `json:"data"` } type RefPaymentTypeUpdateRequest struct { ID *int `json:"-" validate:"required,min=1"` Name *string `json:"name" validate:"required,min=1,max=20"` Active *bool `json:"active"` } type RefPaymentTypeUpdateResponse struct { Message string `json:"message"` Data *RefPaymentType `json:"data"` } type RefPaymentTypeDeleteResponse struct { Message string `json:"message"` ID string `json:"id"` } type RefPaymentTypeFilter struct { Status *string `json:"status,omitempty" form:"status"` Search *string `json:"search,omitempty" form:"search"` } // Response structs for RefVisitType type RefVisitTypeGetByIDResponse struct { Message string `json:"message"` Data *RefVisitType `json:"data"` } type RefVisitTypeGetResponse struct { Message string `json:"message"` Data []RefVisitType `json:"data"` Meta models.MetaResponse `json:"meta"` Summary *models.AggregateData `json:"summary,omitempty"` } type RefVisitTypeCreateRequest struct { Name *string `json:"name" validate:"required,min=1,max=20"` Active *bool `json:"active"` } type RefVisitTypeCreateResponse struct { Message string `json:"message"` Data *RefVisitType `json:"data"` } type RefVisitTypeUpdateRequest struct { ID *int `json:"-" validate:"required,min=1"` Name *string `json:"name" validate:"required,min=1,max=20"` Active *bool `json:"active"` } type RefVisitTypeUpdateResponse struct { Message string `json:"message"` Data *RefVisitType `json:"data"` } type RefVisitTypeDeleteResponse struct { Message string `json:"message"` ID string `json:"id"` } type RefVisitTypeFilter struct { Status *string `json:"status,omitempty" form:"status"` Search *string `json:"search,omitempty" form:"search"` } // Response structs for RefHealthcareType type RefHealthcareTypeGetByIDResponse struct { Message string `json:"message"` Data *RefHealthcareType `json:"data"` } type RefHealthcareTypeGetResponse struct { Message string `json:"message"` Data []RefHealthcareType `json:"data"` Meta models.MetaResponse `json:"meta"` Summary *models.AggregateData `json:"summary,omitempty"` } type RefHealthcareTypeCreateRequest struct { Name *string `json:"name" validate:"required,min=1,max=20"` Active *bool `json:"active"` } type RefHealthcareTypeCreateResponse struct { Message string `json:"message"` Data *RefHealthcareType `json:"data"` } type RefHealthcareTypeUpdateRequest struct { ID *int `json:"-" validate:"required,min=1"` Name *string `json:"name" validate:"required,min=1,max=20"` Active *bool `json:"active"` } type RefHealthcareTypeUpdateResponse struct { Message string `json:"message"` Data *RefHealthcareType `json:"data"` } type RefHealthcareTypeDeleteResponse struct { Message string `json:"message"` ID string `json:"id"` } type RefHealthcareTypeFilter struct { Status *string `json:"status,omitempty" form:"status"` Search *string `json:"search,omitempty" form:"search"` }