Spaces:
Configuration error
Configuration error
Commit ·
f3f5b2d
1
Parent(s): 1cea019
Deploy files from GitHub repository
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- main.go-6
- models/database_orm_model.go+8-6
- models/request_model.go+8-6
- router/router.go-1
- router/server.go-4
- services/partner_criteria_service.go+4-2
- space/pkg/validation/validation.go+16-155
- space/response/validation.go+19-2
- space/services/marriage_readiness_profile_service.go+4-3
- space/services/partner_criteria_service.go+4-3
- space/space/controller/partner_criteria/partner_criteria_controller.goAdded+66
- space/space/main.go+9-3
- space/space/models/database_orm_model.go+54-20
- space/space/models/request_model.go+112-77
- space/space/pkg/validation/custom_rules.go+236-116
- space/space/repositories/partner_criteria_repository.goAdded+38
- space/space/router/partner_criteria_route.goAdded+11
- space/space/router/router.go+1
- space/space/router/server.go+4
- space/space/services/cv_service.go+16-13
- space/space/services/partner_criteria_service.goAdded+77
- space/space/space/config/database_connection_config.go+13-2
- space/space/space/models/sequence.goAdded+25
- space/space/space/repositories/account_repository.go+18
- space/space/space/repositories/cv_repository.go+162-146
- space/space/space/services/cv_service.go+33-7
- space/space/space/services/user_profile_service.go+36-8
- space/space/space/space/models/database_orm_model.go+50-50
- space/space/space/space/models/field_counter.go+4-19
- space/space/space/space/space/config/database_connection_config.go+1
- space/space/space/space/space/controller/marriage_readiness_profile/marriage_readiness_profile_controller.goAdded+66
- space/space/space/space/space/main.go+12-5
- space/space/space/space/space/repositories/marriage_readiness_profile_repository.goAdded+38
- space/space/space/space/space/router/marriage_readiness_profile_route.goAdded+11
- space/space/space/space/space/services/marriage_readiness_profile_service.goAdded+90
- space/space/space/space/space/space/controller/cv/cv_controller.go+171-47
- space/space/space/space/space/space/models/database_orm_model.go+95-43
- space/space/space/space/space/space/models/request_model.go+199-45
- space/space/space/space/space/space/pkg/validation/validation.go+10-1
- space/space/space/space/space/space/pkg/worker/task_send_forgot_password_email.go+8-6
- space/space/space/space/space/space/pkg/worker/task_send_verify_email.go+8-5
- space/space/space/space/space/space/router/cv_route.go+1-1
- space/space/space/space/space/space/router/router.go+1
- space/space/space/space/space/space/router/server.go+11-7
- space/space/space/space/space/space/services/cv_service.go+188-181
- space/space/space/space/space/space/space/services/academy_quiz_answer_service.go+3
- space/space/space/space/space/space/space/services/academy_quiz_question_service.go+6
- space/space/space/space/space/space/space/space/controller/quiz/result_quiz_controller.goAdded+24
- space/space/space/space/space/space/space/space/controller/quiz/submit_quiz_controller.go+4-3
- space/space/space/space/space/space/space/space/models/database_orm_model.go+4-3
6 unmodified lines7891010111241 unmodified lines5455565859606157585913 unmodified lines737475817677786 unmodified lines
"api.qobiltu.id/config" cv_controller "api.qobiltu.id/controller/cv" health_check_controller "api.qobiltu.id/controller/health_check" marriage_readiness_profile_controller "api.qobiltu.id/controller/marriage_readiness_profile" partner_criteria_controller "api.qobiltu.id/controller/partner_criteria" "api.qobiltu.id/mail"41 unmodified lines worker.AsyncTaskDistributor = taskDistributor
// setup repo, service, and controller healthCheckRepository := repositories.NewHealthCheckRepository(config.DB) healthCheckService := services.NewHealthCheckService(healthCheckRepository) healthCheckController := health_check_controller.NewHealthCheckController(healthCheckService)
cvRepository := repositories.NewCVRepository(config.DB) cvService := services.NewCVService(cvRepository, localStorage, validator) cvController := cv_controller.NewCVController(cvService)13 unmodified lines
// create server s, err := router.NewServer( healthCheckController, cvController, marriageReadinessProfileController, partnerCriteriaController,395 unmodified lines3963973983993994004014024032 unmodified lines406407408408409410411412409410411412413414415416417395 unmodified lines Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty"`
// Kriteria Umum ExpectedAgeLimit *int `gorm:"column:expected_age_limit" json:"expected_age_limit"` // batas usia pasangan yang diharapkan ExpecteMinAgeLimit *int `gorm:"column:expected_min_age_limit" json:"expected_min_age_limit"` // batas usia pasangan yang diharapkan ExpecteMaxAgeLimit *int `gorm:"column:expected_max_age_limit" json:"expected_max_age_limit"` // batas usia pasangan yang diharapkan ExpectedDomicile *string `gorm:"column:expected_domicile" json:"expected_domicile"` // domisili pasangan yang diharapkan AcceptedMaritalStatus *pq.StringArray `gorm:"column:accepted_marital_status;type:varchar(255)[]" json:"accepted_marital_status"` // status pernikahan yang diterima PartnerFamilyReligion *string `gorm:"column:partner_family_religion" json:"partner_family_religion"` // agama yang dianut keluarga pasangan2 unmodified lines PartnerCanCook *string `gorm:"column:partner_can_cook" json:"partner_can_cook"` // apakah pasangan diharapkan bisa memasak
// Kriteria Fisik ExpectedBodyShapes *pq.StringArray `gorm:"column:expected_body_shapes;type:varchar(255)[]" json:"expected_body_shapes"` // bentuk tubuh yang diharapkan ExpectedSkinColors *pq.StringArray `gorm:"column:expected_skin_colors;type:varchar(255)[]" json:"expected_skin_colors"` // warna kulit yang diharapkan ExpectedHairTypes *pq.StringArray `gorm:"column:expected_hair_types;type:varchar(255)[]" json:"expected_hair_types"` // tipe rambut yang diharapkan ExpectedHairThickness *pq.StringArray `gorm:"column:expected_hair_thickness;type:varchar(255)[]" json:"expected_hair_thickness"` // jenis rambut yang diharapkan ExpectedHeight *int `gorm:"column:expected_height" json:"expected_height"` // tinggi badan yang diharapkan ExpectedBodyShapes *pq.StringArray `gorm:"column:expected_body_shapes;type:varchar(255)[]" json:"expected_body_shapes"` // bentuk tubuh yang diharapkan ExpectedSkinColors *pq.StringArray `gorm:"column:expected_skin_colors;type:varchar(255)[]" json:"expected_skin_colors"` // warna kulit yang diharapkan ExpectedHairTypes *pq.StringArray `gorm:"column:expected_hair_types;type:varchar(255)[]" json:"expected_hair_types"` // tipe rambut yang diharapkan ExpectedHairThickness *pq.StringArray `gorm:"column:expected_hair_thickness;type:varchar(255)[]" json:"expected_hair_thickness"` // jenis rambut yang diharapkan ExpectedMinHeightLimit *int `gorm:"column:expected_min_height_limit" json:"expected_min_height_limit"` // tinggi badan yang diharapkan ExpectedMaxHeightLimit *int `gorm:"column:expected_max_height_limit" json:"expected_max_height_limit"` // tinggi badan yang diharapkan
// Pendidikan & Pekerjaan ExpectedPartnerIncome *string `gorm:"column:expected_partner_income" json:"expected_partner_income"` // penghasilan pasangan per bulan yang diharapkan335 unmodified lines3363373383393393403413423432 unmodified lines346347348348349350351352349350351352353354355356357335 unmodified lines SavePartnerCriteriaRequest struct { AccountID int64 `json:"account_id"`
ExpectedAgeLimit *int `gorm:"column:expected_age_limit" json:"expected_age_limit"` // batas usia pasangan yang diharapkan ExpecteMinAgeLimit *int `gorm:"column:expected_min_age_limit" json:"expected_min_age_limit"` // batas usia pasangan yang diharapkan ExpecteMaxAgeLimit *int `gorm:"column:expected_max_age_limit" json:"expected_max_age_limit"` // batas usia pasangan yang diharapkan ExpectedDomicile *string `gorm:"column:expected_domicile" json:"expected_domicile"` // domisili pasangan yang diharapkan AcceptedMaritalStatus *pq.StringArray `gorm:"column:accepted_marital_status;type:varchar(255)[]" json:"accepted_marital_status"` // status pernikahan yang diterima PartnerFamilyReligion *string `gorm:"column:partner_family_religion" json:"partner_family_religion"` // agama yang dianut keluarga pasangan2 unmodified lines PartnerCanCook *string `gorm:"column:partner_can_cook" json:"partner_can_cook"` // apakah pasangan diharapkan bisa memasak
// Kriteria Fisik ExpectedBodyShapes *pq.StringArray `gorm:"column:expected_body_shapes;type:varchar(255)[]" json:"expected_body_shapes"` // bentuk tubuh yang diharapkan ExpectedSkinColors *pq.StringArray `gorm:"column:expected_skin_colors;type:varchar(255)[]" json:"expected_skin_colors"` // warna kulit yang diharapkan ExpectedHairTypes *pq.StringArray `gorm:"column:expected_hair_types;type:varchar(255)[]" json:"expected_hair_types"` // tipe rambut yang diharapkan ExpectedHairThickness *pq.StringArray `gorm:"column:expected_hair_thickness;type:varchar(255)[]" json:"expected_hair_thickness"` // jenis rambut yang diharapkan ExpectedHeight *int `gorm:"column:expected_height" json:"expected_height"` // tinggi badan yang diharapkan ExpectedBodyShapes *pq.StringArray `gorm:"column:expected_body_shapes;type:varchar(255)[]" json:"expected_body_shapes"` // bentuk tubuh yang diharapkan ExpectedSkinColors *pq.StringArray `gorm:"column:expected_skin_colors;type:varchar(255)[]" json:"expected_skin_colors"` // warna kulit yang diharapkan ExpectedHairTypes *pq.StringArray `gorm:"column:expected_hair_types;type:varchar(255)[]" json:"expected_hair_types"` // tipe rambut yang diharapkan ExpectedHairThickness *pq.StringArray `gorm:"column:expected_hair_thickness;type:varchar(255)[]" json:"expected_hair_thickness"` // jenis rambut yang diharapkan ExpectedMinHeightLimit *int `gorm:"column:expected_min_height_limit" json:"expected_min_height_limit"` // tinggi badan yang diharapkan ExpectedMaxHeightLimit *int `gorm:"column:expected_max_height_limit" json:"expected_max_height_limit"` // tinggi badan yang diharapkan
// Pendidikan & Pekerjaan ExpectedPartnerIncome *string `gorm:"column:expected_partner_income" json:"expected_partner_income"` // penghasilan pasangan per bulan yang diharapkan15 unmodified lines1617181919202115 unmodified lines QuizRoute(s.router)
// another way to register routes s.HealthCheckRoute() s.CVRoute() s.MarriageReadinessProfileRoute() s.PartnerCriteriaRoute()1 unmodified line23455671 unmodified line9101113121314151617201819203 unmodified lines242526302728291 unmodified line
import ( cv_controller "api.qobiltu.id/controller/cv" health_check_controller "api.qobiltu.id/controller/health_check" marriage_readiness_profile_controller "api.qobiltu.id/controller/marriage_readiness_profile" partner_criteria_controller "api.qobiltu.id/controller/partner_criteria" "github.com/gin-gonic/gin"1 unmodified line
type Server struct { router *gin.Engine healthCheckController health_check_controller.HealthCheckController cvController cv_controller.CVController marriageReadinessProfileController marriage_readiness_profile_controller.MarriageReadinessProfileController partnerCriteriaController partner_criteria_controller.PartnerCriteriaController}
func NewServer( healthCheckController health_check_controller.HealthCheckController, cvController cv_controller.CVController, marriageReadinessProfileController marriage_readiness_profile_controller.MarriageReadinessProfileController, partnerCriteriaController partner_criteria_controller.PartnerCriteriaController,3 unmodified lines router.Use(gin.Recovery())
server := &Server{ healthCheckController: healthCheckController, cvController: cvController, marriageReadinessProfileController: marriageReadinessProfileController, partnerCriteriaController: partnerCriteriaController,41 unmodified lines4243444545464748495 unmodified lines55565757585960616241 unmodified lines
partnerCriteria.AccountID = req.AccountID
utils.AssignIfNotNil(&partnerCriteria.ExpectedAgeLimit, req.ExpectedAgeLimit) utils.AssignIfNotNil(&partnerCriteria.ExpecteMinAgeLimit, req.ExpecteMinAgeLimit) utils.AssignIfNotNil(&partnerCriteria.ExpecteMaxAgeLimit, req.ExpecteMaxAgeLimit) utils.AssignIfNotNil(&partnerCriteria.ExpectedDomicile, req.ExpectedDomicile) utils.AssignIfNotNil(&partnerCriteria.AcceptedMaritalStatus, req.AcceptedMaritalStatus) utils.AssignIfNotNil(&partnerCriteria.PartnerFamilyReligion, req.PartnerFamilyReligion)5 unmodified lines utils.AssignIfNotNil(&partnerCriteria.ExpectedSkinColors, req.ExpectedSkinColors) utils.AssignIfNotNil(&partnerCriteria.ExpectedHairTypes, req.ExpectedHairTypes) utils.AssignIfNotNil(&partnerCriteria.ExpectedHairThickness, req.ExpectedHairThickness) utils.AssignIfNotNil(&partnerCriteria.ExpectedHeight, req.ExpectedHeight) utils.AssignIfNotNil(&partnerCriteria.ExpectedMinHeightLimit, req.ExpectedMinHeightLimit) utils.AssignIfNotNil(&partnerCriteria.ExpectedMaxHeightLimit, req.ExpectedMaxHeightLimit)
utils.AssignIfNotNil(&partnerCriteria.ExpectedPartnerIncome, req.ExpectedPartnerIncome) utils.AssignIfNotNil(&partnerCriteria.ExpectedIncomeSources, req.ExpectedIncomeSources)12345674569101112131478917181920212223101112131429303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848515168788899091929394959697989910010110210310410510617181920108109110111211121131141151161171181191201211221232212512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916023162163164165242526271671681691702829303132331733435package validation
import ( "errors" "fmt" "reflect" "strings" "context" "time"
"github.com/go-playground/locales/en" "github.com/go-playground/locales/id" ut "github.com/go-playground/universal-translator" v10 "github.com/go-playground/validator/v10" entranslations "github.com/go-playground/validator/v10/translations/en" idtranslations "github.com/go-playground/validator/v10/translations/id" "gorm.io/gorm")
// Constants for supported localesconst ( LocaleID = "id" LocaleEN = "en")
// ErrorMessage represents a validation error messagetype ErrorMessage struct { Field string `json:"field"` Message string `json:"-"`}
type validator struct { validate *v10.Validate translator ut.Translator}
// validatorInstance adalah instance global dari validator.var validatorInstance *validator
// New creates a new validation instance with the specified locale// dan menginisialisasi instance global validatorInstance.func New(locale string) error { v := &validator{} parsedLocale := parseLocale(locale)
uni := ut.New(en.New(), id.New(), en.New()) translator, found := uni.GetTranslator(parsedLocale) if !found { return fmt.Errorf("translator not found for locale: %s", parsedLocale) }
validate := v10.New()
if err := setupValidations(validate); err != nil { return fmt.Errorf("failed to setup validations: %w", err) }
if err := setupTranslations(validate, translator, parsedLocale); err != nil { return fmt.Errorf("failed to setup translations for locale %s: %w", parsedLocale, err) }
v.validate = validate v.translator = translator
validatorInstance = v // Inisialisasi instance global return nil}
func parseLocale(locale string) string { switch strings.ToLower(locale) { case "id": return LocaleID case "en": return LocaleEN default: return LocaleID // Default to Indonesian }}
// setupValidations configures custom validation rules.func setupValidations(validate *v10.Validate) error { rules := NewValidatorRules(&InMemoryOptionSource{}) if err := rules.RegisterAllCustomRules(validate); err != nil { return err }
return nil}func New(db *gorm.DB) (*Validator, error) {
// setupTranslations configures translations for validation messages.func setupTranslations(validate *v10.Validate, translator ut.Translator, locale string) error { // Register default translations based on locale if err := registerDefaultTranslations(validate, translator, locale); err != nil { return fmt.Errorf("failed to register default translations for locale %s: %w", locale, err) }
// Register custom password validation translation err := validate.RegisterTranslation("password", translator, func(ut ut.Translator) error { return ut.Add("password", "harus mengandung minimal 8 karakter, huruf besar, huruf kecil, dan angka.", true) }, func(ut ut.Translator, fe v10.FieldError) string { translated, err := ut.T(fe.Tag(), fe.Field()) if err != nil { return fe.Field() + " is invalid" } return translated }, ) // Create source with 5 minute cache expiry expiry := 5 * time.Minute dbSource, err := NewDBOptionSource(db, expiry) if err != nil { return fmt.Errorf("failed to register password translation: %w", err) }
return nil return nil, err}
// registerDefaultTranslations sets up default translations for the specified locale.func registerDefaultTranslations(validate *v10.Validate, translator ut.Translator, locale string) error { switch locale { case LocaleID: return idtranslations.RegisterDefaultTranslations(validate, translator) case LocaleEN: return entranslations.RegisterDefaultTranslations(validate, translator) default: // Fallback to English if the locale is not supported return entranslations.RegisterDefaultTranslations(validate, translator) }}
// Validate validates a struct using the global validator instance// and returns a slice of ErrorMessage.func Validate(s any) []ErrorMessage { if validatorInstance == nil { return []ErrorMessage{{Field: "", Message: "Validator belum diinisialisasi. Panggil validation.New() terlebih dahulu."}} }
err := validatorInstance.validate.Struct(s) if err != nil { return TranslateError(err) }
return nil}
// TranslateError takes a validation error and translates it using the global translator.func TranslateError(err error) []ErrorMessage { if validatorInstance == nil { return nil }
var validationErrors v10.ValidationErrors if !errors.As(err, &validationErrors) { return nil }
var errorMessages []ErrorMessage
for _, e := range validationErrors { fieldLabel := e.Field()
if e.Kind() == reflect.Ptr { continue }
msg, err := validatorInstance.translator.T(e.Tag(), fieldLabel) if err != nil { msg = fieldLabel + " is Invalid" } // Start background refresh every 10 minutes ctx := context.Background() dbSource.StartAutoRefresh(ctx, 10*time.Minute)
errorMessages = append(errorMessages, ErrorMessage{ Field: e.Tag(), Message: msg, }) // create validator validator := NewValidator(dbSource) if err := validator.RegisterAllCustomRules(); err != nil { return nil, err }
return errorMessages return validator, nil}2 unmodified lines3456788910111213141516171819202122232425262728122930312 unmodified linesimport ( "api.qobiltu.id/models" "api.qobiltu.id/pkg/validation" "github.com/go-playground/validator/v10")
func HandleValidationError(validationErrors []validation.ErrorMessage) error {func HandleValidationError(err error) error { validationErrors, ok := err.(validator.ValidationErrors) if !ok { return models.Exception{ ValidationError: true, Message: "Validation failed", } }
validationErrorMessages := make([]validation.ErrorMessage, len(validationErrors)) for i, err := range validationErrors { validationErrorMessages[i] = validation.ErrorMessage{ Field: err.Field(), Message: err.Error(), } }
return models.Exception{ ValidationError: true, Message: "Validation failed", ValidationErrorFields: validationErrors, ValidationErrorFields: validationErrorMessages, }}18 unmodified lines19202122232424252526272829293031323318 unmodified lines
type marriageReadinessProfileService struct { marriageReadinessProfileRepository repositories.MarriageReadinessProfileRepository validator *validation.Validator}
func NewMarriageReadinessProfileService(marriageReadinessProfileRepository repositories.MarriageReadinessProfileRepository) MarriageReadinessProfileService { return &marriageReadinessProfileService{marriageReadinessProfileRepository: marriageReadinessProfileRepository}func NewMarriageReadinessProfileService(marriageReadinessProfileRepository repositories.MarriageReadinessProfileRepository, validator *validation.Validator) MarriageReadinessProfileService { return &marriageReadinessProfileService{marriageReadinessProfileRepository: marriageReadinessProfileRepository, validator: validator}}
func (s *marriageReadinessProfileService) SaveMarriageReadinessProfile(ctx context.Context, req *models.SaveMarriageReadinessProfileRequest) (*models.MarriageReadinessProfile, error) { if err := validation.Validate(req); err != nil { if err := s.validator.Validate(req); err != nil { return nil, response.HandleValidationError(err) }
18 unmodified lines19202122232424252526272829293031323318 unmodified lines
type partnerCriteriaService struct { partnerCriteriaRepository repositories.PartnerCriteriaRepository validator *validation.Validator}
func NewPartnerCriteriaService(partnerCriteriaRepository repositories.PartnerCriteriaRepository) PartnerCriteriaService { return &partnerCriteriaService{partnerCriteriaRepository: partnerCriteriaRepository}func NewPartnerCriteriaService(partnerCriteriaRepository repositories.PartnerCriteriaRepository, validator *validation.Validator) PartnerCriteriaService { return &partnerCriteriaService{partnerCriteriaRepository: partnerCriteriaRepository, validator: validator}}
func (s *partnerCriteriaService) SavePartnerCriteria(ctx context.Context, req *models.SavePartnerCriteriaRequest) (*models.PartnerCriteria, error) { if err := validation.Validate(req); err != nil { if err := s.validator.Validate(req); err != nil { return nil, response.HandleValidationError(err) }
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566package partner_criteria_controller
import ( "net/http"
"api.qobiltu.id/middleware" "api.qobiltu.id/models" "api.qobiltu.id/response" "api.qobiltu.id/services" "github.com/gin-gonic/gin")
type PartnerCriteriaController interface { SavePartnerCriteria(ctx *gin.Context) GetPartnerCriteria(ctx *gin.Context)}
type partnerCriteriaController struct { partnerCriteriaService services.PartnerCriteriaService}
func NewPartnerCriteriaController(partnerCriteriaService services.PartnerCriteriaService) PartnerCriteriaController { return &partnerCriteriaController{ partnerCriteriaService: partnerCriteriaService, }}
func (c *partnerCriteriaController) SavePartnerCriteria(ctx *gin.Context) { var req models.SavePartnerCriteriaRequest if err := ctx.ShouldBindJSON(&req); err != nil { response.HandleError(ctx, models.Exception{ Message: "Invalid body request", BadRequest: true, Err: err, }) return }
accountData := middleware.GetAccountData(ctx) req.AccountID = int64(accountData.UserID)
res, err := c.partnerCriteriaService.SavePartnerCriteria(ctx, &req) if err != nil { response.HandleError(ctx, err) return }
response.HandleSuccess(ctx, http.StatusOK, "Partner criteria saved", res, nil)}
func (c *partnerCriteriaController) GetPartnerCriteria(ctx *gin.Context) { accountData := middleware.GetAccountData(ctx) accountID := int64(accountData.UserID)
req := models.GetPartnerCriteriaRequest{ AccountID: accountID, }
res, err := c.partnerCriteriaService.GetPartnerCriteria(ctx, &req) if err != nil { response.HandleError(ctx, err) return }
response.HandleSuccess(ctx, http.StatusOK, "Get partner criteria success", res, nil)}8 unmodified lines91011121314158 unmodified lines242526262728293029 unmodified lines606162626364656666676869707172737475764 unmodified lines818283848586878 unmodified lines cv_controller "api.qobiltu.id/controller/cv" health_check_controller "api.qobiltu.id/controller/health_check" marriage_readiness_profile_controller "api.qobiltu.id/controller/marriage_readiness_profile" partner_criteria_controller "api.qobiltu.id/controller/partner_criteria" "api.qobiltu.id/mail" "api.qobiltu.id/pkg/storage" "api.qobiltu.id/pkg/validation"8 unmodified linesfunc main() {
// setup validation err := validation.New(validation.LocaleID) validator, err := validation.New(config.DB) utils.FatalIfErr("failed to setup validator", err)
// setup storage29 unmodified lines healthCheckController := health_check_controller.NewHealthCheckController(healthCheckService)
cvRepository := repositories.NewCVRepository(config.DB) cvService := services.NewCVService(cvRepository, localStorage) cvService := services.NewCVService(cvRepository, localStorage, validator) cvController := cv_controller.NewCVController(cvService)
marriageReadinessProfileRepository := repositories.NewMarriageReadinessProfileRepository(config.DB) marriageReadinessProfileService := services.NewMarriageReadinessProfileService(marriageReadinessProfileRepository) marriageReadinessProfileService := services.NewMarriageReadinessProfileService(marriageReadinessProfileRepository, validator) marriageReadinessProfileController := marriage_readiness_profile_controller.NewMarriageReadinessProfileController(marriageReadinessProfileService)
partnerCriteriaRepository := repositories.NewPartnerCriteriaRepository(config.DB) partnerCriteriaService := services.NewPartnerCriteriaService(partnerCriteriaRepository, validator) partnerCriteriaController := partner_criteria_controller.NewPartnerCriteriaController(partnerCriteriaService)
// start task processor err = taskProcessor.Start() utils.FatalIfErr("failed to start task processor", err)4 unmodified lines healthCheckController, cvController, marriageReadinessProfileController, partnerCriteriaController, ) utils.FatalIfErr("failed to create server", err)
247 unmodified lines248249250251252253254255256257258259260261262263264265266267268269270251252253254255256257258259260261262263264265266267268269270271272273274114 unmodified lines389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427247 unmodified lines }
WorshipAndReligiousUnderstandingCV struct { ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id" counter:"skip"` AccountID int64 `gorm:"column:account_id;not null;unique" json:"account_id" counter:"skip"` Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty" counter:"skip"` ObligatoryPrayer *string `gorm:"column:obligatory_prayer" json:"obligatory_prayer"` // sholat_wajib_5_waktu CongregationalPrayer *string `gorm:"column:congregational_prayer" json:"congregational_prayer"` // sholat_berjamaah_di_masjid TahajjudPrayer *string `gorm:"column:tahajjud_prayer" json:"tahajjud_prayer"` // sholat_tahajud DhuhaPrayer *string `gorm:"column:dhuha_prayer" json:"dhuha_prayer"` // sholat_dhuha QuranMemorization *string `gorm:"column:quran_memorization" json:"quran_memorization"` // hafalan_alquran QuranReadingAbility *string `gorm:"column:quran_reading_ability" json:"quran_reading_ability"` // kemampuan_baca_alquran DaudFasting *string `gorm:"column:daud_fasting" json:"daud_fasting"` // puasa_daud AyyamulBidhFasting *string `gorm:"column:ayyamul_bidh_fasting" json:"ayyamul_bidh_fasting"` // puasa_ayyamul_bidh HajjOrUmrah *pq.StringArray `gorm:"column:hajj_or_umrah;type:varchar(255)[]" json:"hajj_or_umrah"` // ibadah_haji_umroh ListeningToMusic *string `gorm:"column:listening_to_music" json:"listening_to_music"` // mendengarkan_musik OpinionOnIkhtilat *string `gorm:"column:opinion_on_ikhtilat" json:"opinion_on_ikhtilat"` // pendapat_ikhtilat OpinionOnTouchingNonMahram *string `gorm:"column:opinion_on_touching_non_mahram" json:"opinion_on_touching_non_mahram"` // pendapat_menyentuh_non_mahram OpinionOnVeil *string `gorm:"column:opinion_on_veil" json:"opinion_on_veil"` // pendapat_tentang_cadar WeeklyReligiousStudies *string `gorm:"column:weekly_religious_studies" json:"weekly_religious_studies"` // kajian_yang_diikuti_dalam_sepekan FollowedUstadz *string `gorm:"column:followed_ustadz" json:"followed_ustadz"` // ustadz_yang_diikuti CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at" counter:"skip"` UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at" counter:"skip"` ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id" counter:"skip"` AccountID int64 `gorm:"column:account_id;not null;unique" json:"account_id" counter:"skip"` Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty" counter:"skip"` ObligatoryPrayer *string `gorm:"column:obligatory_prayer" json:"obligatory_prayer"` // sholat_wajib_5_waktu CongregationalPrayer *string `gorm:"column:congregational_prayer" json:"congregational_prayer"` // sholat_berjamaah_di_masjid TahajjudPrayer *string `gorm:"column:tahajjud_prayer" json:"tahajjud_prayer"` // sholat_tahajud DhuhaPrayer *string `gorm:"column:dhuha_prayer" json:"dhuha_prayer"` // sholat_dhuha QuranMemorization *string `gorm:"column:quran_memorization" json:"quran_memorization"` // hafalan_alquran QuranReadingAbility *string `gorm:"column:quran_reading_ability" json:"quran_reading_ability"` // kemampuan_baca_alquran WeeklyReligiousStudyFrequency *string `gorm:"column:weekly_religious_study_frequency" json:"weekly_religious_study_frequency"` // kajian_yang_diikuti_dalam_sepekan DaudFasting *string `gorm:"column:daud_fasting" json:"daud_fasting"` // puasa_daud AyyamulBidhFasting *string `gorm:"column:ayyamul_bidh_fasting" json:"ayyamul_bidh_fasting"` // puasa_ayyamul_bidh HajjOrUmrah *pq.StringArray `gorm:"column:hajj_or_umrah;type:varchar(255)[]" json:"hajj_or_umrah"` // ibadah_haji_umroh ListeningToMusic *string `gorm:"column:listening_to_music" json:"listening_to_music"` // mendengarkan_musik OpinionOnIkhtilat *string `gorm:"column:opinion_on_ikhtilat" json:"opinion_on_ikhtilat"` // pendapat_ikhtilat OpinionOnTouchingNonMahram *string `gorm:"column:opinion_on_touching_non_mahram" json:"opinion_on_touching_non_mahram"` // pendapat_menyentuh_non_mahram OpinionOnVeil *string `gorm:"column:opinion_on_veil" json:"opinion_on_veil"` // pendapat_tentang_cadar WeeklyReligiousStudies *string `gorm:"column:weekly_religious_studies" json:"weekly_religious_studies"` // kajian_yang_diikuti_dalam_sepekan FollowedUstadz *string `gorm:"column:followed_ustadz" json:"followed_ustadz"` // ustadz_yang_diikuti CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at" counter:"skip"` UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at" counter:"skip"` FieldCounter }
114 unmodified lines })
type ( PartnerCriteria struct { ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"` AccountID int64 `gorm:"column:account_id;not null;unique" json:"account_id"` Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty"`
// Kriteria Umum ExpectedAgeLimit *int `gorm:"column:expected_age_limit" json:"expected_age_limit"` // batas usia pasangan yang diharapkan ExpectedDomicile *string `gorm:"column:expected_domicile" json:"expected_domicile"` // domisili pasangan yang diharapkan AcceptedMaritalStatus *pq.StringArray `gorm:"column:accepted_marital_status;type:varchar(255)[]" json:"accepted_marital_status"` // status pernikahan yang diterima PartnerFamilyReligion *string `gorm:"column:partner_family_religion" json:"partner_family_religion"` // agama yang dianut keluarga pasangan PartnerWeeklyReligiousStudyFrequency *string `gorm:"column:partner_weekly_religious_study_frequency" json:"partner_weekly_religious_study_frequency"` // rata-rata jumlah kajian yang diikuti pasangan per pekan PartnerMonthlySpendingEstimate *string `gorm:"column:partner_monthly_spending_estimate" json:"partner_monthly_spending_estimate"` // estimasi pengeluaran pasangan per bulan PartnerCanCook *string `gorm:"column:partner_can_cook" json:"partner_can_cook"` // apakah pasangan diharapkan bisa memasak
// Kriteria Fisik ExpectedBodyShapes *pq.StringArray `gorm:"column:expected_body_shapes;type:varchar(255)[]" json:"expected_body_shapes"` // bentuk tubuh yang diharapkan ExpectedSkinColors *pq.StringArray `gorm:"column:expected_skin_colors;type:varchar(255)[]" json:"expected_skin_colors"` // warna kulit yang diharapkan ExpectedHairTypes *pq.StringArray `gorm:"column:expected_hair_types;type:varchar(255)[]" json:"expected_hair_types"` // tipe rambut yang diharapkan ExpectedHairThickness *pq.StringArray `gorm:"column:expected_hair_thickness;type:varchar(255)[]" json:"expected_hair_thickness"` // jenis rambut yang diharapkan ExpectedHeight *int `gorm:"column:expected_height" json:"expected_height"` // tinggi badan yang diharapkan
// Pendidikan & Pekerjaan ExpectedPartnerIncome *string `gorm:"column:expected_partner_income" json:"expected_partner_income"` // penghasilan pasangan per bulan yang diharapkan ExpectedIncomeSources *pq.StringArray `gorm:"column:expected_income_sources;type:varchar(255)[]" json:"expected_income_sources"` // sumber penghasilan pasangan ExpectedLastEducation *pq.StringArray `gorm:"column:expected_last_education;type:varchar(255)[]" json:"expected_last_education"` // pendidikan terakhir yang diharapkan ExpectedJobType *string `gorm:"column:expected_job_type" json:"expected_job_type"` // jenis pekerjaan pasangan yang diharapkan
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"` UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at"` })
// Gorm table name settingsfunc (Account) TableName() string { return "account" }func (AccountDetails) TableName() string { return "account_details" }73 unmodified lines74757677777879803 unmodified lines84858687888788899091919293941 unmodified line969798991009910010110210310310410510613 unmodified lines12012112212312412512312412512612712810 unmodified lines1391401411421431421431441451451461471481 unmodified line1501511521531541551561571581591601611621631641651661671681531541551561571581591601611621631641651661671681691701711722 unmodified lines1751761771771781791801813 unmodified lines18518618718718818919019117 unmodified lines2092102112112122132142153 unmodified lines21922022122122222322422558 unmodified lines28428528628628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832932832933033033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436573 unmodified lines FavoriteFoodAndDrinks *string `json:"favorite_food_and_drinks"` // makanan dan minuman favorit CanCook *bool `json:"can_cook"` // bisa memasak TypesOfDishesCooked *string `json:"types_of_dishes_cooked"` // jenis masakan yang bisa dimasak MonthlyExpenses *string `json:"monthly_expenses" validate:"monthly_expenses"` // pengeluaran per bulan MonthlyExpenses *string `json:"monthly_expenses" validate:"monthly-expenses"` // pengeluaran per bulan }
GetPersonalityAndPreferenceRequest struct {3 unmodified lines CreateFamilyMemberRequest struct { AccountID int64 `json:"-"`
Role *string `json:"role" validate:"family_role"` // Peran dalam keluarga Status *string `json:"status" validate:"life_status"` // Status (Hidup, Wafat) Role *string `json:"role" validate:"family-role"` // Peran dalam keluarga Status *string `json:"status" validate:"life-status"` // Status (Hidup, Wafat) Religion *string `json:"religion" validate:"religion"` // Agama Job *string `json:"job"` // Pekerjaan LastEducation *string `json:"last_education" validate:"last_education"` // Pendidikan terakhir LastEducation *string `json:"last_education" validate:"last-education"` // Pendidikan terakhir Age *int `json:"age"` // Usia }
1 unmodified line ID int64 `json:"-"` AccountID int64 `json:"-"`
Role *string `json:"role" validate:"family_role"` // Peran dalam keluarga Status *string `json:"status" validate:"life_status"` // Status (Hidup, Wafat) Role *string `json:"role" validate:"family-role"` // Peran dalam keluarga Status *string `json:"status" validate:"life-status"` // Status (Hidup, Wafat) Religion *string `json:"religion" validate:"religion"` // Agama Job *string `json:"job"` // Pekerjaan LastEducation *string `json:"last_education" validate:"last_education"` // Pendidikan terakhir LastEducation *string `json:"last_education" validate:"last-education"` // Pendidikan terakhir Age *int `json:"age"` // Usia }
13 unmodified lines AccountID int64 `json:"-"` HeightInCm *int `json:"height_cm"` // Tinggi badan dalam satuan sentimeter WeightInKg *int `json:"weight_kg"` // Berat badan dalam satuan kilogram BodyShape *string `json:"body_shape" validate:"body_shape"` // Bentuk tubuh SkinColor *string `json:"skin_color" validate:"skin_color"` // Warna kulit HairType *string `json:"hair_type" validate:"hair_type"` // Tipe rambut BodyShape *string `json:"body_shape" validate:"body-shape"` // Bentuk tubuh SkinColor *string `json:"skin_color" validate:"skin-color"` // Warna kulit HairType *string `json:"hair_type" validate:"hair-type"` // Tipe rambut MedicalHistory *pq.StringArray `json:"medical_history"` // Riwayat penyakit PhysicalDisorder *string `json:"physical_disorder"` // Cacat fisik PhysicalTraits *string `json:"physical_traits"` // Ciri khas fisik10 unmodified lines DateOfBirth *time.Time `json:"date_of_birth"` PlaceOfBirth *string `json:"place_of_birth"` Domicile *string `json:"domicile"` MaritalStatus *string `json:"marital_status" validate:"marital_status"` LastEducation *string `json:"last_education" validate:"last_education"` MaritalStatus *string `json:"marital_status" validate:"marital-status"` LastEducation *string `json:"last_education" validate:"last-education"` LastJob *string `json:"last_job"` PhoneNumber *string `json:"phone_number" validate:"phone_number"` PhoneNumber *string `json:"phone_number" validate:"phone-number"` }
GetAccountDetailsRequest struct {1 unmodified line }
SaveWorshipAndReligiousUnderstandingRequest struct { AccountID int64 `json:"-"` ObligatoryPrayer *string `json:"obligatory_prayer"` // sholat_wajib_5_waktu CongregationalPrayer *string `json:"congregational_prayer"` // sholat_berjamaah_di_masjid TahajjudPrayer *string `json:"tahajjud_prayer"` // sholat_tahajud DhuhaPrayer *string `json:"dhuha_prayer"` // sholat_dhuha QuranMemorization *string `json:"quran_memorization"` // hafalan_alquran QuranReadingAbility *string `json:"quran_reading_ability" validate:"quran_reading_ability"` // kemampuan_baca_alquran DaudFasting *string `json:"daud_fasting"` // puasa_daud AyyamulBidhFasting *string `json:"ayyamul_bidh_fasting"` // puasa_ayyamul_bidh HajjOrUmrah *pq.StringArray `json:"hajj_or_umrah"` // ibadah_haji_umroh ListeningToMusic *string `json:"listening_to_music"` // mendengarkan_musik OpinionOnIkhtilat *string `json:"opinion_on_ikhtilat"` // pendapat_ikhtilat OpinionOnTouchingNonMahram *string `json:"opinion_on_touching_non_mahram"` // pendapat_menyentuh_non_mahram OpinionOnVeil *string `json:"opinion_on_veil"` // pendapat_tentang_cadar WeeklyReligiousStudies *string `json:"weekly_religious_studies"` // kajian_yang_diikuti_dalam_sepekan FollowedUstadz *string `json:"followed_ustadz"` // ustadz_yang_diikuti AccountID int64 `json:"-"` ObligatoryPrayer *string `json:"obligatory_prayer"` // sholat_wajib_5_waktu CongregationalPrayer *string `json:"congregational_prayer"` // sholat_berjamaah_di_masjid TahajjudPrayer *string `json:"tahajjud_prayer"` // sholat_tahajud DhuhaPrayer *string `json:"dhuha_prayer"` // sholat_dhuha QuranMemorization *string `json:"quran_memorization"` // hafalan_alquran QuranReadingAbility *string `json:"quran_reading_ability" validate:"quran-reading-ability"` // kemampuan_baca_alquran WeeklyReligiousStudyFrequency *string `json:"weekly_religious_study_frequency" validate:"weekly-religious-study-frequency"` // kajian_yang_diikuti_dalam_sepekan DaudFasting *string `json:"daud_fasting"` // puasa_daud AyyamulBidhFasting *string `json:"ayyamul_bidh_fasting"` // puasa_ayyamul_bidh HajjOrUmrah *pq.StringArray `json:"hajj_or_umrah"` // ibadah_haji_umroh ListeningToMusic *string `json:"listening_to_music"` // mendengarkan_musik OpinionOnIkhtilat *string `json:"opinion_on_ikhtilat"` // pendapat_ikhtilat OpinionOnTouchingNonMahram *string `json:"opinion_on_touching_non_mahram"` // pendapat_menyentuh_non_mahram OpinionOnVeil *string `json:"opinion_on_veil"` // pendapat_tentang_cadar WeeklyReligiousStudies *string `json:"weekly_religious_studies"` // kajian_yang_diikuti_dalam_sepekan FollowedUstadz *string `json:"followed_ustadz"` // ustadz_yang_diikuti }
GetWorshipAndReligiousUnderstandingRequest struct {2 unmodified lines
CreateEducationRequest struct { AccountID int64 `json:"-"` LastEducation *string `json:"last_education" validate:"last_education"` // pendidikan terakhir LastEducation *string `json:"last_education" validate:"last-education"` // pendidikan terakhir EducationInstitute *string `json:"education_institute"` // institusi pendidikan EducationMajor *string `json:"education_major"` // jurusan pendidikan YearStart *int `json:"year_start"` // tahun masuk3 unmodified lines UpdateEducationRequest struct { ID int64 `json:"-"` AccountID int64 `json:"-"` LastEducation *string `json:"last_education" validate:"last_education"` // pendidikan terakhir LastEducation *string `json:"last_education" validate:"last-education"` // pendidikan terakhir EducationInstitute *string `json:"education_institute"` // institusi pendidikan EducationMajor *string `json:"education_major"` // jurusan pendidikan YearStart *int `json:"year_start"` // tahun masuk17 unmodified lines InstitutionName *string `json:"institution_name"` // nama instansi CurrentJob *string `json:"current_job"` // pekerjaan saat ini YearStartedWorking *int `json:"year_started_working"` // tahun mulai bekerja MonthlyIncome *string `json:"monthly_income" validate:"monthly_income"` // penghasilan per bulan MonthlyIncome *string `json:"monthly_income" validate:"monthly-income"` // penghasilan per bulan IncomeSources *pq.StringArray `json:"income_sources"` // sumber penghasilan }
3 unmodified lines InstitutionName *string `json:"institution_name"` // nama instansi CurrentJob *string `json:"current_job"` // pekerjaan saat ini YearStartedWorking *int `json:"year_started_working"` // tahun mulai bekerja MonthlyIncome *string `json:"monthly_income" validate:"monthly_income"` // penghasilan per bulan MonthlyIncome *string `json:"monthly_income" validate:"monthly-income"` // penghasilan per bulan IncomeSources *pq.StringArray `json:"income_sources"` // sumber penghasilan }
58 unmodified lines })
type SaveMarriageReadinessProfileRequest struct { AccountID int64 `json:"account_id"`
// Visi Misi Rumah Tangga MarriageVision *string `gorm:"column:marriage_vision" json:"marriage_vision"` // Apa visi dan tujuan utama kamu dalam membangun rumah tangga? LivingPlan *string `gorm:"column:living_plan" json:"living_plan"` // Setelah menikah, kamu berencana tinggal di mana? SpouseRoles *string `gorm:"column:spouse_roles" json:"spouse_roles"` // Menurutmu, apa peran utama suami dan istri dalam rumah tangga? SpouseRights *string `gorm:"column:spouse_rights" json:"spouse_rights"` // Apa saja hak suami dan istri menurutmu? ConflictResolution *string `gorm:"column:conflict_resolution" json:"conflict_resolution"` // Jika terjadi konflik, bagaimana kamu menyikapinya? ParentingStyle *string `gorm:"column:parenting_style" json:"parenting_style"` // Setelah punya anak, pola pengasuhan seperti apa yang kamu inginkan?
// Konsep Acara Pernikahan ReadyToMarryDuration *string `gorm:"column:ready_to_marry_duration" json:"ready_to_marry_duration"` // Setelah taaruf dimulai, berapa lama kamu butuh untuk siap menikah? WeddingConcept *string `gorm:"column:wedding_concept" json:"wedding_concept"` // Seperti apa konsep pernikahan yang kamu harapkan? WeddingFunding *string `gorm:"column:wedding_funding" json:"wedding_funding"` // Apakah kamu sudah mempersiapkan dana pernikahan? Dari mana sumbernya?
// Karir Kedepannya CareerAfterMarriage *string `gorm:"column:career_after_marriage" json:"career_after_marriage"` // Apakah kamu ingin tetap bekerja setelah menikah? TimeManagement *string `gorm:"column:time_management" json:"time_management"` // Bagaimana kamu membagi waktu antara keluarga, ibadah, dan pekerjaan? CareerGoals *string `gorm:"column:career_goals" json:"career_goals"` // Apa impian karier atau cita-cita kamu dalam 5 sampai 10 tahun ke depan? SelfDevelopment *string `gorm:"column:self_development" json:"self_development"` // Apa usaha kamu untuk terus mengembangkan diri dan skill?
// Pendidikan Keluarga DelayChildren *string `gorm:"column:delay_children" json:"delay_children"` // Apakah kamu berencana menunda memiliki anak? ChildEducationPlan *string `gorm:"column:child_education_plan" json:"child_education_plan"` // Apakah kamu sudah punya rencana pendidikan anak? ReligiousEmotionalBond *string `gorm:"column:religious_emotional_bond" json:"religious_emotional_bond"` // Bagaimana cara menjaga nilai agama & kedekatan emosional dengan anak? ParentingChallenges *string `gorm:"column:parenting_challenges" json:"parenting_challenges"` // Saat menghadapi tantangan pengasuhan, bagaimana kamu menyikapinya?
// Finansial Keluarga MonthlyFinance *string `gorm:"column:monthly_finance" json:"monthly_finance"` // Bagaimana kamu mengelola keuangan bulanan? FamilyResponsibility *string `gorm:"column:family_responsibility" json:"family_responsibility"` // Apakah kamu masih punya tanggungan keluarga setelah menikah? DebtStatus *string `gorm:"column:debt_status" json:"debt_status"` // Apakah kamu punya cicilan/utang setelah menikah? FinanceSharing *string `gorm:"column:finance_sharing" json:"finance_sharing"` // Setelah menikah, bagaimana pembagian tanggung jawab keuangan? IncomeGapView *string `gorm:"column:income_gap_view" json:"income_gap_view"` // Pandangan kamu jika istri berpenghasilan lebih besar dari suami?
// Keputusan dan Komunikasi DecisionMaking *string `gorm:"column:decision_making" json:"decision_making"` // Dalam mengambil keputusan, kamu lebih mempertimbangkan pasangan atau sendiri? GrowthTogether *string `gorm:"column:growth_together" json:"growth_together"` // Apakah kamu siap berjuang bersama pasangan? Apa saja yang ingin diperjuangkan? ParentIntervention *string `gorm:"column:parent_intervention" json:"parent_intervention"` // Sejauh mana orang tua/mertua boleh ikut campur dalam rumah tangga? HabitResponse *string `gorm:"column:habit_response" json:"habit_response"` // Bagaimana kamu menyikapi kebiasaan pasangan yang kurang kamu sukai?}type ( SaveMarriageReadinessProfileRequest struct { AccountID int64 `json:"account_id"`
// Visi Misi Rumah Tangga MarriageVision *string `gorm:"column:marriage_vision" json:"marriage_vision"` // Apa visi dan tujuan utama kamu dalam membangun rumah tangga? LivingPlan *string `gorm:"column:living_plan" json:"living_plan"` // Setelah menikah, kamu berencana tinggal di mana? SpouseRoles *string `gorm:"column:spouse_roles" json:"spouse_roles"` // Menurutmu, apa peran utama suami dan istri dalam rumah tangga? SpouseRights *string `gorm:"column:spouse_rights" json:"spouse_rights"` // Apa saja hak suami dan istri menurutmu? ConflictResolution *string `gorm:"column:conflict_resolution" json:"conflict_resolution"` // Jika terjadi konflik, bagaimana kamu menyikapinya? ParentingStyle *string `gorm:"column:parenting_style" json:"parenting_style"` // Setelah punya anak, pola pengasuhan seperti apa yang kamu inginkan?
// Konsep Acara Pernikahan ReadyToMarryDuration *string `gorm:"column:ready_to_marry_duration" json:"ready_to_marry_duration"` // Setelah taaruf dimulai, berapa lama kamu butuh untuk siap menikah? WeddingConcept *string `gorm:"column:wedding_concept" json:"wedding_concept"` // Seperti apa konsep pernikahan yang kamu harapkan? WeddingFunding *string `gorm:"column:wedding_funding" json:"wedding_funding"` // Apakah kamu sudah mempersiapkan dana pernikahan? Dari mana sumbernya?
// Karir Kedepannya CareerAfterMarriage *string `gorm:"column:career_after_marriage" json:"career_after_marriage"` // Apakah kamu ingin tetap bekerja setelah menikah? TimeManagement *string `gorm:"column:time_management" json:"time_management"` // Bagaimana kamu membagi waktu antara keluarga, ibadah, dan pekerjaan? CareerGoals *string `gorm:"column:career_goals" json:"career_goals"` // Apa impian karier atau cita-cita kamu dalam 5 sampai 10 tahun ke depan? SelfDevelopment *string `gorm:"column:self_development" json:"self_development"` // Apa usaha kamu untuk terus mengembangkan diri dan skill?
// Pendidikan Keluarga DelayChildren *string `gorm:"column:delay_children" json:"delay_children"` // Apakah kamu berencana menunda memiliki anak? ChildEducationPlan *string `gorm:"column:child_education_plan" json:"child_education_plan"` // Apakah kamu sudah punya rencana pendidikan anak? ReligiousEmotionalBond *string `gorm:"column:religious_emotional_bond" json:"religious_emotional_bond"` // Bagaimana cara menjaga nilai agama & kedekatan emosional dengan anak? ParentingChallenges *string `gorm:"column:parenting_challenges" json:"parenting_challenges"` // Saat menghadapi tantangan pengasuhan, bagaimana kamu menyikapinya?
// Finansial Keluarga MonthlyFinance *string `gorm:"column:monthly_finance" json:"monthly_finance"` // Bagaimana kamu mengelola keuangan bulanan? FamilyResponsibility *string `gorm:"column:family_responsibility" json:"family_responsibility"` // Apakah kamu masih punya tanggungan keluarga setelah menikah? DebtStatus *string `gorm:"column:debt_status" json:"debt_status"` // Apakah kamu punya cicilan/utang setelah menikah? FinanceSharing *string `gorm:"column:finance_sharing" json:"finance_sharing"` // Setelah menikah, bagaimana pembagian tanggung jawab keuangan? IncomeGapView *string `gorm:"column:income_gap_view" json:"income_gap_view"` // Pandangan kamu jika istri berpenghasilan lebih besar dari suami?
// Keputusan dan Komunikasi DecisionMaking *string `gorm:"column:decision_making" json:"decision_making"` // Dalam mengambil keputusan, kamu lebih mempertimbangkan pasangan atau sendiri? GrowthTogether *string `gorm:"column:growth_together" json:"growth_together"` // Apakah kamu siap berjuang bersama pasangan? Apa saja yang ingin diperjuangkan? ParentIntervention *string `gorm:"column:parent_intervention" json:"parent_intervention"` // Sejauh mana orang tua/mertua boleh ikut campur dalam rumah tangga? HabitResponse *string `gorm:"column:habit_response" json:"habit_response"` // Bagaimana kamu menyikapi kebiasaan pasangan yang kurang kamu sukai? }
type GetMarriageReadinessProfileRequest struct { AccountID int64 `json:"-"`} GetMarriageReadinessProfileRequest struct { AccountID int64 `json:"-"` })
type ( SavePartnerCriteriaRequest struct { AccountID int64 `json:"account_id"`
ExpectedAgeLimit *int `gorm:"column:expected_age_limit" json:"expected_age_limit"` // batas usia pasangan yang diharapkan ExpectedDomicile *string `gorm:"column:expected_domicile" json:"expected_domicile"` // domisili pasangan yang diharapkan AcceptedMaritalStatus *pq.StringArray `gorm:"column:accepted_marital_status;type:varchar(255)[]" json:"accepted_marital_status"` // status pernikahan yang diterima PartnerFamilyReligion *string `gorm:"column:partner_family_religion" json:"partner_family_religion"` // agama yang dianut keluarga pasangan PartnerWeeklyReligiousStudyFrequency *string `gorm:"column:partner_weekly_religious_study_frequency" json:"partner_weekly_religious_study_frequency"` // rata-rata jumlah kajian yang diikuti pasangan per pekan PartnerMonthlySpendingEstimate *string `gorm:"column:partner_monthly_spending_estimate" json:"partner_monthly_spending_estimate"` // estimasi pengeluaran pasangan per bulan PartnerCanCook *string `gorm:"column:partner_can_cook" json:"partner_can_cook"` // apakah pasangan diharapkan bisa memasak
// Kriteria Fisik ExpectedBodyShapes *pq.StringArray `gorm:"column:expected_body_shapes;type:varchar(255)[]" json:"expected_body_shapes"` // bentuk tubuh yang diharapkan ExpectedSkinColors *pq.StringArray `gorm:"column:expected_skin_colors;type:varchar(255)[]" json:"expected_skin_colors"` // warna kulit yang diharapkan ExpectedHairTypes *pq.StringArray `gorm:"column:expected_hair_types;type:varchar(255)[]" json:"expected_hair_types"` // tipe rambut yang diharapkan ExpectedHairThickness *pq.StringArray `gorm:"column:expected_hair_thickness;type:varchar(255)[]" json:"expected_hair_thickness"` // jenis rambut yang diharapkan ExpectedHeight *int `gorm:"column:expected_height" json:"expected_height"` // tinggi badan yang diharapkan
// Pendidikan & Pekerjaan ExpectedPartnerIncome *string `gorm:"column:expected_partner_income" json:"expected_partner_income"` // penghasilan pasangan per bulan yang diharapkan ExpectedIncomeSources *pq.StringArray `gorm:"column:expected_income_sources;type:varchar(255)[]" json:"expected_income_sources"` // sumber penghasilan pasangan ExpectedLastEducation *pq.StringArray `gorm:"column:expected_last_education;type:varchar(255)[]" json:"expected_last_education"` // pendidikan terakhir yang diharapkan ExpectedJobType *string `gorm:"column:expected_job_type" json:"expected_job_type"` // jenis pekerjaan pasangan yang diharapkan
}
GetPartnerCriteriaRequest struct { AccountID int64 `json:"-"` })12345678910111213141512161718192021222324182526272122232425262728293031323334353637383940282930313233343536434445463738394041424843444546474851525349505152555657585354556061626364565758596067686970616263646566676869707172727374757677747576777880818283848586877980818283848586878889909192939495969798991001011021031041051061071081091108911111211311411511691117118119120121122123124125126127128129130131132133134135136971371381391401411421431441451461471481491501511521531542 unmodified lines1571581591111601611621631151641651661671181191681691701711721731741751221231241251261761771781791801811821831841851861281291301871881891901911921931321331341351941951961971371981992002012022032042052061411421431441452072082092102112122132141491501512152162172182191541551562202212222232242252262272282292302312322332342352362372382392402411592422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952961622972982993001 unmodified line302303304170171305306307308309175176177178179180181182310311312313186187188314315316317318319320321322323190191192193194195196197198199200201202203324package validation
import ( "context" "fmt" "reflect" "regexp" "strings" "sync" "time"
v10 "github.com/go-playground/validator/v10" "gorm.io/gorm")
type ValidOptionSource interface {type ValidatorOptionSource interface { GetValidOptions(key string) ([]string, error) GetValidKeys() []string Refresh() error StartAutoRefresh(ctx context.Context, interval time.Duration) HasKey(key string) bool}
// --------------------// InMemoryOptionSource// DBOptionSource with Safe Handling// --------------------
type InMemoryOptionSource struct{}
var inMemoryOptions = map[string][]string{ "last_education": {"SD", "SMP", "SMA", "D1", "D2", "D3", "D4", "D5", "S1", "S2", "S3"}, "marital_status": {"Belum Menikah", "Duda", "Janda"}, "gender": {"Laki-laki", "Perempuan"}, "monthly_expenses": {"< 2 Juta", "2-5 Juta", "5-20 Juta", "> 10 Juta"}, "monthly_income": {"< 3 Juta", "3-5 Juta", "5-10 Juta", "> 10 Juta"}, "religion": {"Islam", "Non-Islam"}, "family_role": {"Ayah", "Ibu", "Kakak", "Adik", "Anak"}, "life_status": {"Hidup", "Wafat"}, "body_shape": {"Ideal", "Kurus", "Berisi", "Gemuk"}, "skin_color": {"Putih", "Kuning Langsat", "Sawo Matang"}, "hair_type": {"Lurus", "Bergelombang", "Keriting"}, "frequently": {"Selalu", "Sering", "Kadang", "Jarang", "Tidak Pernah"}, "quran_reading_ability": {"Lancar", "Menengah", "Perlu Bimbingan"},}
func (s *InMemoryOptionSource) GetValidOptions(key string) ([]string, error) { return inMemoryOptions[key], niltype DBOptionSource struct { db *gorm.DB options map[string][]string mu sync.RWMutex lastUpdate time.Time expiry time.Duration stopChan chan struct{}}
func (s *InMemoryOptionSource) GetValidKeys() []string { keys := make([]string, 0, len(inMemoryOptions)) for k := range inMemoryOptions { keys = append(keys, k)func NewDBOptionSource(db *gorm.DB, expiry time.Duration) (*DBOptionSource, error) { source := &DBOptionSource{ db: db, expiry: expiry, stopChan: make(chan struct{}), } return keys if err := source.Refresh(); err != nil { return nil, fmt.Errorf("failed to initialize DB option source: %w", err) } return source, nil}
// --------------------// DBOptionSource// --------------------func (s *DBOptionSource) Refresh() error { s.mu.Lock() defer s.mu.Unlock()
type DBOptionSource struct { options map[string][]string mu sync.RWMutex} // Buat session baru tanpa transaction tx := s.db.Session(&gorm.Session{SkipDefaultTransaction: true})
type ( OptionCategory struct { ID int64 `gorm:"primaryKey" json:"id"` OptionName string `json:"option_name"` OptionSlug string `json:"option_slug" gorm:"uniqueIndex"` var results []struct { Slug string `gorm:"column:slug"` Value string `gorm:"column:value"` }
OptionValues struct { ID int64 `gorm:"primaryKey" json:"id"` OptionCategoryID int64 `json:"option_category_id"` OptionValue string `json:"option_value"` err := tx.Raw(` SELECT c.option_slug AS slug, v.option_value AS value FROM option_categories c JOIN option_values v ON c.id = v.option_category_id ORDER BY c.id, v.id `).Scan(&results).Error
if err != nil { return fmt.Errorf("failed to refresh options: %w", err) })
func NewDBOptionSource(db *gorm.DB) (*DBOptionSource, error) { var categories []OptionCategory if err := db.Find(&categories).Error; err != nil { return nil, err newOptions := make(map[string][]string) for _, r := range results { newOptions[r.Slug] = append(newOptions[r.Slug], r.Value) }
options := make(map[string][]string) for _, cat := range categories { var values []OptionValues if err := db.Where("option_category_id = ?", cat.ID).Find(&values).Error; err != nil { return nil, err } for _, val := range values { options[cat.OptionSlug] = append(options[cat.OptionSlug], val.OptionValue) s.options = newOptions s.lastUpdate = time.Now()
fmt.Println("options refreshed")
return nil}
func (s *DBOptionSource) StartAutoRefresh(ctx context.Context, interval time.Duration) { ticker := time.NewTicker(interval) go func() { for { select { case <-ticker.C: s.mu.Lock() needsRefresh := time.Since(s.lastUpdate) > s.expiry s.mu.Unlock()
if needsRefresh { if err := s.Refresh(); err != nil { fmt.Printf("failed to auto-refresh options: %v\n", err) } } case <-ctx.Done(): ticker.Stop() return case <-s.stopChan: ticker.Stop() return } } }() }}
func (s *DBOptionSource) StopAutoRefresh() { close(s.stopChan)}
return &DBOptionSource{options: options}, nilfunc (s *DBOptionSource) HasKey(key string) bool { s.mu.RLock() defer s.mu.RUnlock() _, exists := s.options[key] return exists}
func (s *DBOptionSource) GetValidOptions(key string) ([]string, error) { s.mu.RLock() needsRefresh := time.Since(s.lastUpdate) > s.expiry s.mu.RUnlock()
if needsRefresh { if err := s.Refresh(); err != nil { return nil, fmt.Errorf("failed to refresh options: %w", err) } }
s.mu.RLock() defer s.mu.RUnlock() return s.options[key], nil
options, exists := s.options[key] if !exists { return nil, nil // Return nil instead of error for missing keys }
copied := make([]string, len(options)) copy(copied, options) return copied, nil}
func (s *DBOptionSource) GetValidKeys() []string { s.mu.RLock() defer s.mu.RUnlock()
keys := make([]string, 0, len(s.options)) for k := range s.options { keys = append(keys, k)2 unmodified lines}
// --------------------// Validator// Validator with Safe Rule Handling// --------------------
type Validator struct { source ValidOptionSource source ValidatorOptionSource validate *v10.Validate}
func NewValidatorRules(source ValidOptionSource) *Validator { return &Validator{source: source}func NewValidator(source ValidatorOptionSource) *Validator { validate := v10.New() return &Validator{ source: source, validate: validate, }}
func (v *Validator) GenericOptionRule(key string) func(fl v10.FieldLevel) bool { return func(fl v10.FieldLevel) bool { value := fl.Field().String() if value == "" { return truefunc (v *Validator) RegisterAllCustomRules() error { // First register static validation rules staticRules := map[string]func(v10.FieldLevel) bool{ "password": v.validatePassword, "phone-number": v.validatePhoneNumber, }
for name, fn := range staticRules { if err := v.validate.RegisterValidation(name, fn); err != nil { return fmt.Errorf("failed to register %s validation: %w", name, err) } validOptions, err := v.source.GetValidOptions(key) if err != nil { return false }
// Then register dynamic option rules for _, key := range v.source.GetValidKeys() { if !v.source.HasKey(key) { continue // Skip if key doesn't exist } for _, opt := range validOptions { if opt == value { return true }
if err := v.validate.RegisterValidation(key, v.createOptionRule(key)); err != nil { return fmt.Errorf("failed to register validation for %s: %w", key, err) } return false }
return nil}func (v *Validator) Validate(input interface{}) error { if input == nil { return nil }
func (v *Validator) RegisterAllCustomRules(validate *v10.Validate) error { for _, key := range v.source.GetValidKeys() { err := validate.RegisterValidation(key, v.GenericOptionRule(key)) if err != nil { return err val := reflect.ValueOf(input) if val.Kind() == reflect.Ptr { if val.IsNil() { return nil } val = val.Elem() // Dereference the pointer }
err := validate.RegisterValidation("password", v.PasswordRule) if err != nil { return err err := v.validate.Struct(input) if err == nil { return nil }
err = validate.RegisterValidation("phone_number", v.PhoneNumberRule) if err != nil { return err // Filter out errors for nil/empty fields if ve, ok := err.(v10.ValidationErrors); ok { var filteredErrors v10.ValidationErrors for _, fe := range ve { fieldValue := val.FieldByName(fe.StructField()) if !fieldValue.IsValid() { continue }
if !isEmpty(fieldValue) { filteredErrors = append(filteredErrors, fe) } else { fmt.Printf("Ignoring validation error for empty field: %s\n", fe.Field()) } }
if len(filteredErrors) > 0 { return filteredErrors } return nil }
return nil return err}
// isEmpty checks if a value is nil or emptyfunc isEmpty(v reflect.Value) bool { switch v.Kind() { case reflect.String: return v.Len() == 0 case reflect.Ptr, reflect.Interface: return v.IsNil() case reflect.Slice, reflect.Map, reflect.Array: return v.Len() == 0 case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: return v.Int() == 0 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: return v.Uint() == 0 case reflect.Float32, reflect.Float64: return v.Float() == 0 case reflect.Bool: return !v.Bool() case reflect.Struct: if t, ok := v.Interface().(time.Time); ok { return t.IsZero() } // Consider non-time structs as non-empty return false default: return false }}
// createOptionRule remains the same as previous versionfunc (v *Validator) createOptionRule(key string) func(v10.FieldLevel) bool { return func(fl v10.FieldLevel) bool { field := fl.Field() if isEmpty(field) { return true }
value := field.String() validOptions, err := v.source.GetValidOptions(key) if err != nil || validOptions == nil { return true }
for _, opt := range validOptions { if opt == value { return true } }
return false }}
func (v *Validator) PasswordRule(fl v10.FieldLevel) bool {func (v *Validator) validatePassword(fl v10.FieldLevel) bool { password := fl.Field().String() return len(password) >= 8 && strings.ContainsAny(password, "abcdefghijklmnopqrstuvwxyz") &&1 unmodified line strings.ContainsAny(password, "0123456789")}
func (v *Validator) PhoneNumberRule(fl v10.FieldLevel) bool { phone := SanitizePhoneNumber(fl.Field().String())func (v *Validator) validatePhoneNumber(fl v10.FieldLevel) bool { phone := NormalizePhoneNumber(fl.Field().String()) return strings.HasPrefix(phone, "+62")}
func SanitizePhoneNumber(input string) string { // Hilangkan semua spasi dan strip input = strings.ReplaceAll(input, " ", "") input = strings.ReplaceAll(input, "-", "") input = strings.ReplaceAll(input, "(", "") input = strings.ReplaceAll(input, ")", "")
// Hilangkan semua karakter non-digit kecuali +func NormalizePhoneNumber(input string) string { re := regexp.MustCompile(`[^0-9\+]`) input = re.ReplaceAllString(input, "")
// Handle nomor diawali 0 (contoh: 0812...) menjadi +62812... if strings.HasPrefix(input, "0") { input = "+62" + input[1:] switch { case strings.HasPrefix(input, "0"): return "+62" + input[1:] case strings.HasPrefix(input, "62") && !strings.HasPrefix(input, "+62"): return "+" + input case strings.HasPrefix(input, "8"): return "+62" + input default: return input }
// Handle jika diawali dengan 62 tanpa + (contoh: 62812...) if strings.HasPrefix(input, "62") && !strings.HasPrefix(input, "+62") { input = "+" + input }
// Handle jika tidak ada awalan +62 sama sekali (contoh: 8123456789) if !strings.HasPrefix(input, "+62") { if strings.HasPrefix(input, "8") { input = "+62" + input } }
return input}1234567891011121314151617181920212223242526272829303132333435363738package repositories
import ( "context"
"api.qobiltu.id/models" "gorm.io/gorm")
type PartnerCriteriaRepository interface { SavePartnerCriteria(ctx context.Context, req *models.PartnerCriteria) (*models.PartnerCriteria, error) GetPartnerCriteria(ctx context.Context, accountID int64) (*models.PartnerCriteria, error)}
type partnerCriteriaRepository struct { db *gorm.DB}
func NewPartnerCriteriaRepository(db *gorm.DB) PartnerCriteriaRepository { return &partnerCriteriaRepository{ db: db, }}
func (r *partnerCriteriaRepository) SavePartnerCriteria(ctx context.Context, req *models.PartnerCriteria) (*models.PartnerCriteria, error) { if err := r.db.WithContext(ctx).Save(req).Error; err != nil { return req, err } return req, nil}
func (r *partnerCriteriaRepository) GetPartnerCriteria(ctx context.Context, accountID int64) (*models.PartnerCriteria, error) { var partnerCriteria models.PartnerCriteria if err := r.db.WithContext(ctx).Where("account_id = ?", accountID).First(&partnerCriteria).Error; err != nil { return nil, err } return &partnerCriteria, nil}1234567891011package router
import "api.qobiltu.id/middleware"
func (s *Server) PartnerCriteriaRoute() { routerGroup := s.router.Group("/api/v1/partner-criteria").Use(middleware.AuthUser) { routerGroup.POST("", s.partnerCriteriaController.SavePartnerCriteria) routerGroup.GET("", s.partnerCriteriaController.GetPartnerCriteria) }}18 unmodified lines19202122232418 unmodified lines s.HealthCheckRoute() s.CVRoute() s.MarriageReadinessProfileRoute() s.PartnerCriteriaRoute() s.StorageRoute()}3 unmodified lines456789102 unmodified lines13141516171819202122232425263 unmodified lines303132333435363 unmodified lines cv_controller "api.qobiltu.id/controller/cv" health_check_controller "api.qobiltu.id/controller/health_check" marriage_readiness_profile_controller "api.qobiltu.id/controller/marriage_readiness_profile" partner_criteria_controller "api.qobiltu.id/controller/partner_criteria" "github.com/gin-gonic/gin")
2 unmodified lines healthCheckController health_check_controller.HealthCheckController cvController cv_controller.CVController marriageReadinessProfileController marriage_readiness_profile_controller.MarriageReadinessProfileController partnerCriteriaController partner_criteria_controller.PartnerCriteriaController}
func NewServer( healthCheckController health_check_controller.HealthCheckController, cvController cv_controller.CVController, marriageReadinessProfileController marriage_readiness_profile_controller.MarriageReadinessProfileController, partnerCriteriaController partner_criteria_controller.PartnerCriteriaController,) (*Server, error) {
router := gin.Default()3 unmodified lines healthCheckController: healthCheckController, cvController: cvController, marriageReadinessProfileController: marriageReadinessProfileController, partnerCriteriaController: partnerCriteriaController, router: router, }
59 unmodified lines60616263646565666768697071727374737576777847 unmodified lines12612712812712812913013113213314 unmodified lines14814915014915115215315443 unmodified lines19819920019920120220320442 unmodified lines24724824924825025125225318 unmodified lines27227327427327527627727838 unmodified lines31731831931832032132232317 unmodified lines34134234334434534634722 unmodified lines37037137237037337437537615 unmodified lines39239339439239539639739832 unmodified lines43143243343143443543643713 unmodified lines45145245345145445545645759 unmodified linestype cvService struct { cvRepository repositories.CVRepository storage storage.Storage validator *validation.Validator}
func NewCVService(cvRepository repositories.CVRepository, storage storage.Storage) CVService {func NewCVService(cvRepository repositories.CVRepository, storage storage.Storage, validator *validation.Validator) CVService { return &cvService{ cvRepository: cvRepository, storage: storage, validator: validator, }}
func (s *cvService) SaveAccountDetails(ctx context.Context, req *models.SaveAccountDetailsRequest) (*models.AccountDetails, error) { if err := validation.Validate(req); err != nil { if err := s.validator.Validate(req); err != nil { return nil, response.HandleValidationError(err) }
47 unmodified lines utils.AssignIfNotNil(&accountDetails.LastJob, req.LastJob)
if req.PhoneNumber != nil { sanitizedPhone := validation.SanitizePhoneNumber(*req.PhoneNumber) accountDetails.PhoneNumber = &sanitizedPhone normalizedPhoneNumber := validation.NormalizePhoneNumber(*req.PhoneNumber) accountDetails.PhoneNumber = &normalizedPhoneNumber }
// Simpan ke database14 unmodified lines}
func (s *cvService) SavePersonalityAndPreference(ctx context.Context, req *models.SavePersonalityAndPreferenceRequest) (*models.PersonalityAndPreferenceCV, error) { if err := validation.Validate(req); err != nil { if err := s.validator.Validate(req); err != nil { return nil, response.HandleValidationError(err) }
43 unmodified lines}
func (s *cvService) CreateFamilyMember(ctx context.Context, req *models.CreateFamilyMemberRequest) (*models.FamilyMemberCV, error) { if err := validation.Validate(req); err != nil { if err := s.validator.Validate(req); err != nil { return nil, response.HandleValidationError(err) }
42 unmodified lines}
func (s *cvService) UpdateFamilyMember(ctx context.Context, req *models.UpdateFamilyMemberRequest) (*models.FamilyMemberCV, error) { if err := validation.Validate(req); err != nil { if err := s.validator.Validate(req); err != nil { return nil, response.HandleValidationError(err) }
18 unmodified lines}
func (s *cvService) SavePhysicalAndHealth(ctx context.Context, req *models.SavePhysicalAndHealthRequest) (*models.PhysicalAndHealthCV, error) { if err := validation.Validate(req); err != nil { if err := s.validator.Validate(req); err != nil { return nil, response.HandleValidationError(err) }
38 unmodified lines}
func (s *cvService) SaveWorshipAndReligiousUnderstanding(ctx context.Context, req *models.SaveWorshipAndReligiousUnderstandingRequest) (*models.WorshipAndReligiousUnderstandingCV, error) { if err := validation.Validate(req); err != nil { if err := s.validator.Validate(req); err != nil { return nil, response.HandleValidationError(err) }
17 unmodified lines utils.AssignIfNotNil(&worshipAndReligiousUnderstanding.DhuhaPrayer, req.DhuhaPrayer) utils.AssignIfNotNil(&worshipAndReligiousUnderstanding.QuranMemorization, req.QuranMemorization) utils.AssignIfNotNil(&worshipAndReligiousUnderstanding.QuranReadingAbility, req.QuranReadingAbility) utils.AssignIfNotNil(&worshipAndReligiousUnderstanding.WeeklyReligiousStudyFrequency, req.WeeklyReligiousStudyFrequency) utils.AssignIfNotNil(&worshipAndReligiousUnderstanding.DaudFasting, req.DaudFasting) utils.AssignIfNotNil(&worshipAndReligiousUnderstanding.AyyamulBidhFasting, req.AyyamulBidhFasting) utils.AssignIfNotNil(&worshipAndReligiousUnderstanding.HajjOrUmrah, req.HajjOrUmrah)22 unmodified lines}
func (s *cvService) CreateEducation(ctx context.Context, req *models.CreateEducationRequest) (*models.EducationCV, error) { if err := validation.Validate(req); err != nil { if err := s.validator.Validate(req); err != nil { return nil, response.HandleValidationError(err) }
15 unmodified lines}
func (s *cvService) UpdateEducation(ctx context.Context, req *models.UpdateEducationRequest) (*models.EducationCV, error) { if err := validation.Validate(req); err != nil { if err := s.validator.Validate(req); err != nil { return nil, response.HandleValidationError(err) }
32 unmodified lines}
func (s *cvService) CreateJob(ctx context.Context, req *models.CreateJobRequest) (*models.JobCV, error) { if err := validation.Validate(req); err != nil { if err := s.validator.Validate(req); err != nil { return nil, response.HandleValidationError(err) }
13 unmodified lines}
func (s *cvService) UpdateJob(ctx context.Context, req *models.UpdateJobRequest) (*models.JobCV, error) { if err := validation.Validate(req); err != nil { if err := s.validator.Validate(req); err != nil { return nil, response.HandleValidationError(err) }
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677package services
import ( "context" "errors"
"api.qobiltu.id/models" "api.qobiltu.id/pkg/validation" "api.qobiltu.id/repositories" "api.qobiltu.id/response" "api.qobiltu.id/utils" "gorm.io/gorm")
type PartnerCriteriaService interface { SavePartnerCriteria(ctx context.Context, req *models.SavePartnerCriteriaRequest) (*models.PartnerCriteria, error) GetPartnerCriteria(ctx context.Context, req *models.GetPartnerCriteriaRequest) (*models.PartnerCriteria, error)}
type partnerCriteriaService struct { partnerCriteriaRepository repositories.PartnerCriteriaRepository}
func NewPartnerCriteriaService(partnerCriteriaRepository repositories.PartnerCriteriaRepository) PartnerCriteriaService { return &partnerCriteriaService{partnerCriteriaRepository: partnerCriteriaRepository}}
func (s *partnerCriteriaService) SavePartnerCriteria(ctx context.Context, req *models.SavePartnerCriteriaRequest) (*models.PartnerCriteria, error) { if err := validation.Validate(req); err != nil { return nil, response.HandleValidationError(err) }
partnerCriteria, err := s.partnerCriteriaRepository.GetPartnerCriteria(ctx, req.AccountID) if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { return nil, response.HandleGormError(err, "Internal Server Error") }
if partnerCriteria == nil { partnerCriteria = &models.PartnerCriteria{} }
partnerCriteria.AccountID = req.AccountID
utils.AssignIfNotNil(&partnerCriteria.ExpectedAgeLimit, req.ExpectedAgeLimit) utils.AssignIfNotNil(&partnerCriteria.ExpectedDomicile, req.ExpectedDomicile) utils.AssignIfNotNil(&partnerCriteria.AcceptedMaritalStatus, req.AcceptedMaritalStatus) utils.AssignIfNotNil(&partnerCriteria.PartnerFamilyReligion, req.PartnerFamilyReligion) utils.AssignIfNotNil(&partnerCriteria.PartnerWeeklyReligiousStudyFrequency, req.PartnerWeeklyReligiousStudyFrequency) utils.AssignIfNotNil(&partnerCriteria.PartnerMonthlySpendingEstimate, req.PartnerMonthlySpendingEstimate) utils.AssignIfNotNil(&partnerCriteria.PartnerCanCook, req.PartnerCanCook)
utils.AssignIfNotNil(&partnerCriteria.ExpectedBodyShapes, req.ExpectedBodyShapes) utils.AssignIfNotNil(&partnerCriteria.ExpectedSkinColors, req.ExpectedSkinColors) utils.AssignIfNotNil(&partnerCriteria.ExpectedHairTypes, req.ExpectedHairTypes) utils.AssignIfNotNil(&partnerCriteria.ExpectedHairThickness, req.ExpectedHairThickness) utils.AssignIfNotNil(&partnerCriteria.ExpectedHeight, req.ExpectedHeight)
utils.AssignIfNotNil(&partnerCriteria.ExpectedPartnerIncome, req.ExpectedPartnerIncome) utils.AssignIfNotNil(&partnerCriteria.ExpectedIncomeSources, req.ExpectedIncomeSources) utils.AssignIfNotNil(&partnerCriteria.ExpectedLastEducation, req.ExpectedLastEducation) utils.AssignIfNotNil(&partnerCriteria.ExpectedJobType, req.ExpectedJobType)
res, err := s.partnerCriteriaRepository.SavePartnerCriteria(ctx, partnerCriteria) if err != nil { return nil, response.HandleGormError(err, "Internal Server Error") }
return res, nil}
func (s *partnerCriteriaService) GetPartnerCriteria(ctx context.Context, req *models.GetPartnerCriteriaRequest) (*models.PartnerCriteria, error) { res, err := s.partnerCriteriaRepository.GetPartnerCriteria(ctx, req.AccountID) if err != nil { return nil, response.HandleGormError(err, "Internal Server Error") } return res, nil}2 unmodified lines345667868 unmodified lines7778798081828384858687878889909192939495969798992 unmodified linesimport ( "fmt" "log" "log/slog" "os"
"gorm.io/driver/postgres"68 unmodified lines &models.JobCV{}, &models.AchievementCV{}, &models.MarriageReadinessProfile{}, &models.PartnerCriteria{}, )
if err != nil { log.Fatal(err) }
slog.Info("Auto-migration completed successfully") sequences := []string{ `CREATE SEQUENCE IF NOT EXISTS seq_ikh_counter START 1 INCREMENT 1 MINVALUE 1;`, `CREATE SEQUENCE IF NOT EXISTS seq_akh_counter START 1 INCREMENT 1 MINVALUE 1;`, }
for _, seq := range sequences { if err := db.Exec(seq).Error; err != nil { fmt.Printf("Gagal membuat sequence: %v", err) } }
fmt.Println("Auto-migration sequence check completed successfully")}12345678910111213141516171819202122232425package models
import ( "fmt" "strings")
const ( SeqIkhCounter = "seq_ikh_counter" SeqAkhCounter = "seq_akh_counter")
func GetSequenceName(gender string) string { if strings.ToLower(gender) == "laki-laki" { return SeqIkhCounter } return SeqAkhCounter}
func BuildInitialName(gender string, number int64) string { if strings.ToLower(gender) == "laki-laki" { return fmt.Sprintf("IKH_%d", number) } return fmt.Sprintf("AKH_%d", number)}84 unmodified lines85868788899091929394959697989910010110210310410584 unmodified lines repo.Result = accountDetails return *repo}
func GetNextInitialNameNumber(gender string) Repository[string, int] { repo := Construct[string, int](gender) sequenceName := models.GetSequenceName(gender) repo.Transaction.Raw("SELECT nextval('" + sequenceName + "')").Scan(&repo.Result) return *repo}
func GetAccountDetailsByAccountID(accountID uint) Repository[models.AccountDetails, models.AccountDetails] { repo := Construct[models.AccountDetails, models.AccountDetails]( models.AccountDetails{AccountID: accountID}, ) repo.Transactions( WhereGivenConstructor[models.AccountDetails, models.AccountDetails], Find[models.AccountDetails, models.AccountDetails], ) return *repo}123456456789101112101112131415161718192021222324252627282930313233343536373839401314151617181920212223242526272829303132333435363738394041424344454644474849504849505152535455565455565757585960616263616263646564656667686970717273747576777879808182838469707172858687888990917677787980929394959697989984858687100101102103104105106919293949510710810911011111211311499100101102115116117118119120121106107108109110122123124125126127128129114115116117130131132133134135136121122123124125137138139140141142143144129130131132145146147148149150151136137138139140152153154155156157158159160145146147148161162163164165166167168153154155156157169170171172173174175176177162163164165166178179180181182183184185186171172173174187188189190191192193194179180181182195196197198199200201202187188189190191203204205206207208209210211196197198199200212213214215216217218219220205206207208221222223224225226227228213214215216229230231232233234235236221222223224225237238239240241242243244245230231232233234246247248249250251252253254239240241242255256257258259package repositories
import ( "api.qobiltu.id/models" "context" "gorm.io/gorm" "context" "fmt"
"api.qobiltu.id/models" "gorm.io/gorm")
type CVRepository interface { SaveAccountDetails(ctx context.Context, req *models.AccountDetails) (*models.AccountDetails, error) SaveAccountDetails(ctx context.Context, req *models.AccountDetails) (*models.AccountDetails, error) GetAccountDetailsByAccountID(ctx context.Context, accountID int64) (*models.AccountDetails, error)
SavePersonalityAndPreference(ctx context.Context, req *models.PersonalityAndPreferenceCV) (*models.PersonalityAndPreferenceCV, error) GetPersonalityAndPreferenceByAccountID(ctx context.Context, accountID int64) (*models.PersonalityAndPreferenceCV, error)
SaveFamilyMember(ctx context.Context, req *models.FamilyMemberCV) (*models.FamilyMemberCV, error) ListFamilyMember(ctx context.Context, accountID int64) ([]models.FamilyMemberCV, error) GetFamilyMember(ctx context.Context, id int64) (*models.FamilyMemberCV, error) DeleteFamilyMember(ctx context.Context, id int64) error
SavePhysicalAndHealth(ctx context.Context, req *models.PhysicalAndHealthCV) (*models.PhysicalAndHealthCV, error) GetPhysicalAndHealthByAccountID(ctx context.Context, accountID int64) (*models.PhysicalAndHealthCV, error)
SaveWorshipAndReligiousUnderstanding(ctx context.Context, req *models.WorshipAndReligiousUnderstandingCV) (*models.WorshipAndReligiousUnderstandingCV, error) GetWorshipAndReligiousUnderstandingByAccountID(ctx context.Context, accountID int64) (*models.WorshipAndReligiousUnderstandingCV, error)
SaveEducation(ctx context.Context, req *models.EducationCV) (*models.EducationCV, error) ListEducation(ctx context.Context, accountID int64) ([]models.EducationCV, error) GetEducation(ctx context.Context, id int64) (*models.EducationCV, error) DeleteEducation(ctx context.Context, id int64) error
SaveJob(ctx context.Context, req *models.JobCV) (*models.JobCV, error) ListJob(ctx context.Context, accountID int64) ([]models.JobCV, error) GetJob(ctx context.Context, id int64) (*models.JobCV, error) DeleteJob(ctx context.Context, id int64) error
SaveAchievement(ctx context.Context, req *models.AchievementCV) (*models.AchievementCV, error) ListAchievement(ctx context.Context, accountID int64) ([]models.AchievementCV, error) GetAchievement(ctx context.Context, id int64) (*models.AchievementCV, error) DeleteAchievement(ctx context.Context, id int64) error GetAccountDetailsByAccountID(ctx context.Context, accountID int64) (*models.AccountDetails, error) GetNextInitialNameNumber(ctx context.Context, gender string) (int64, error)
SavePersonalityAndPreference(ctx context.Context, req *models.PersonalityAndPreferenceCV) (*models.PersonalityAndPreferenceCV, error) GetPersonalityAndPreferenceByAccountID(ctx context.Context, accountID int64) (*models.PersonalityAndPreferenceCV, error)
SaveFamilyMember(ctx context.Context, req *models.FamilyMemberCV) (*models.FamilyMemberCV, error) ListFamilyMember(ctx context.Context, accountID int64) ([]models.FamilyMemberCV, error) GetFamilyMember(ctx context.Context, id int64) (*models.FamilyMemberCV, error) DeleteFamilyMember(ctx context.Context, id int64) error
SavePhysicalAndHealth(ctx context.Context, req *models.PhysicalAndHealthCV) (*models.PhysicalAndHealthCV, error) GetPhysicalAndHealthByAccountID(ctx context.Context, accountID int64) (*models.PhysicalAndHealthCV, error)
SaveWorshipAndReligiousUnderstanding(ctx context.Context, req *models.WorshipAndReligiousUnderstandingCV) (*models.WorshipAndReligiousUnderstandingCV, error) GetWorshipAndReligiousUnderstandingByAccountID(ctx context.Context, accountID int64) (*models.WorshipAndReligiousUnderstandingCV, error)
SaveEducation(ctx context.Context, req *models.EducationCV) (*models.EducationCV, error) ListEducation(ctx context.Context, accountID int64) ([]models.EducationCV, error) GetEducation(ctx context.Context, id int64) (*models.EducationCV, error) DeleteEducation(ctx context.Context, id int64) error
SaveJob(ctx context.Context, req *models.JobCV) (*models.JobCV, error) ListJob(ctx context.Context, accountID int64) ([]models.JobCV, error) GetJob(ctx context.Context, id int64) (*models.JobCV, error) DeleteJob(ctx context.Context, id int64) error
SaveAchievement(ctx context.Context, req *models.AchievementCV) (*models.AchievementCV, error) ListAchievement(ctx context.Context, accountID int64) ([]models.AchievementCV, error) GetAchievement(ctx context.Context, id int64) (*models.AchievementCV, error) DeleteAchievement(ctx context.Context, id int64) error}
type cvRepository struct { db *gorm.DB db *gorm.DB}
func NewCVRepository(db *gorm.DB) CVRepository { return &cvRepository{ db: db, } return &cvRepository{ db: db, }}
func (r *cvRepository) SaveAccountDetails(ctx context.Context, req *models.AccountDetails) (*models.AccountDetails, error) { if err := r.db.WithContext(ctx).Save(req).Error; err != nil { return req, err } return req, nil if err := r.db.WithContext(ctx).Save(req).Error; err != nil { return req, err } return req, nil}
func (r *cvRepository) GetAccountDetailsByAccountID(ctx context.Context, accountID int64) (*models.AccountDetails, error) { var accountDetails models.AccountDetails if err := r.db.WithContext(ctx).Where("account_id = ?", accountID).First(&accountDetails).Error; err != nil { return nil, err } return &accountDetails, nil var accountDetails models.AccountDetails if err := r.db.WithContext(ctx).Where("account_id = ?", accountID).First(&accountDetails).Error; err != nil { return nil, err } return &accountDetails, nil}
func (r *cvRepository) GetNextInitialNameNumber(ctx context.Context, gender string) (int64, error) { sequenceName := models.GetSequenceName(gender)
var number int64 query := fmt.Sprintf("SELECT nextval('%s')", sequenceName) err := r.db.WithContext(ctx).Raw(query).Scan(&number).Error if err != nil { return 0, err }
return number, nil}
func (r *cvRepository) SavePersonalityAndPreference(ctx context.Context, req *models.PersonalityAndPreferenceCV) (*models.PersonalityAndPreferenceCV, error) { if err := r.db.WithContext(ctx).Save(req).Error; err != nil { return req, err } return req, nil if err := r.db.WithContext(ctx).Save(req).Error; err != nil { return req, err } return req, nil}
func (r *cvRepository) GetPersonalityAndPreferenceByAccountID(ctx context.Context, accountID int64) (*models.PersonalityAndPreferenceCV, error) { var personalityAndPreference models.PersonalityAndPreferenceCV if err := r.db.WithContext(ctx).Where("account_id = ?", accountID).First(&personalityAndPreference).Error; err != nil { return nil, err } return &personalityAndPreference, nil var personalityAndPreference models.PersonalityAndPreferenceCV if err := r.db.WithContext(ctx).Where("account_id = ?", accountID).First(&personalityAndPreference).Error; err != nil { return nil, err } return &personalityAndPreference, nil}
func (r *cvRepository) SaveFamilyMember(ctx context.Context, req *models.FamilyMemberCV) (*models.FamilyMemberCV, error) { if err := r.db.WithContext(ctx).Save(req).Error; err != nil { return req, err } return req, nil if err := r.db.WithContext(ctx).Save(req).Error; err != nil { return req, err } return req, nil}
func (r *cvRepository) GetFamilyMember(ctx context.Context, id int64) (*models.FamilyMemberCV, error) { var familyMember models.FamilyMemberCV if err := r.db.WithContext(ctx).Where("id = ?", id).First(&familyMember).Error; err != nil { return nil, err } return &familyMember, nil var familyMember models.FamilyMemberCV if err := r.db.WithContext(ctx).Where("id = ?", id).First(&familyMember).Error; err != nil { return nil, err } return &familyMember, nil}
func (r *cvRepository) DeleteFamilyMember(ctx context.Context, id int64) error { if err := r.db.WithContext(ctx).Where("id = ?", id).Delete(&models.FamilyMemberCV{}).Error; err != nil { return err } return nil if err := r.db.WithContext(ctx).Where("id = ?", id).Delete(&models.FamilyMemberCV{}).Error; err != nil { return err } return nil}
func (r *cvRepository) ListFamilyMember(ctx context.Context, accountID int64) ([]models.FamilyMemberCV, error) { familyMembers := make([]models.FamilyMemberCV, 0) if err := r.db.WithContext(ctx).Where("account_id = ?", accountID).Find(&familyMembers).Error; err != nil { return nil, err } return familyMembers, nil familyMembers := make([]models.FamilyMemberCV, 0) if err := r.db.WithContext(ctx).Where("account_id = ?", accountID).Find(&familyMembers).Error; err != nil { return nil, err } return familyMembers, nil}
func (r *cvRepository) SavePhysicalAndHealth(ctx context.Context, req *models.PhysicalAndHealthCV) (*models.PhysicalAndHealthCV, error) { if err := r.db.WithContext(ctx).Save(req).Error; err != nil { return req, err } return req, nil if err := r.db.WithContext(ctx).Save(req).Error; err != nil { return req, err } return req, nil}
func (r *cvRepository) GetPhysicalAndHealthByAccountID(ctx context.Context, accountID int64) (*models.PhysicalAndHealthCV, error) { var physicalAndHealth models.PhysicalAndHealthCV if err := r.db.WithContext(ctx).Where("account_id = ?", accountID).First(&physicalAndHealth).Error; err != nil { return nil, err } return &physicalAndHealth, nil var physicalAndHealth models.PhysicalAndHealthCV if err := r.db.WithContext(ctx).Where("account_id = ?", accountID).First(&physicalAndHealth).Error; err != nil { return nil, err } return &physicalAndHealth, nil}
func (r *cvRepository) SaveWorshipAndReligiousUnderstanding(ctx context.Context, req *models.WorshipAndReligiousUnderstandingCV) (*models.WorshipAndReligiousUnderstandingCV, error) { if err := r.db.WithContext(ctx).Save(req).Error; err != nil { return req, err } return req, nil if err := r.db.WithContext(ctx).Save(req).Error; err != nil { return req, err } return req, nil}
func (r *cvRepository) GetWorshipAndReligiousUnderstandingByAccountID(ctx context.Context, accountID int64) (*models.WorshipAndReligiousUnderstandingCV, error) { var worshipAndReligiousUnderstanding models.WorshipAndReligiousUnderstandingCV if err := r.db.WithContext(ctx).Where("account_id = ?", accountID).First(&worshipAndReligiousUnderstanding).Error; err != nil { return nil, err } return &worshipAndReligiousUnderstanding, nil var worshipAndReligiousUnderstanding models.WorshipAndReligiousUnderstandingCV if err := r.db.WithContext(ctx).Where("account_id = ?", accountID).First(&worshipAndReligiousUnderstanding).Error; err != nil { return nil, err } return &worshipAndReligiousUnderstanding, nil}
// SaveEducation menyimpan atau memperbarui data pendidikan ke databasefunc (r *cvRepository) SaveEducation(ctx context.Context, req *models.EducationCV) (*models.EducationCV, error) { if err := r.db.WithContext(ctx).Save(req).Error; err != nil { return req, err } return req, nil if err := r.db.WithContext(ctx).Save(req).Error; err != nil { return req, err } return req, nil}
// ListEducation mengambil daftar data pendidikan berdasarkan account_idfunc (r *cvRepository) ListEducation(ctx context.Context, accountID int64) ([]models.EducationCV, error) { var educations []models.EducationCV if err := r.db.WithContext(ctx).Where("account_id = ?", accountID).Find(&educations).Error; err != nil { return nil, err } return educations, nil var educations []models.EducationCV if err := r.db.WithContext(ctx).Where("account_id = ?", accountID).Find(&educations).Error; err != nil { return nil, err } return educations, nil}
// GetEducation mengambil satu data pendidikan berdasarkan idfunc (r *cvRepository) GetEducation(ctx context.Context, id int64) (*models.EducationCV, error) { var education models.EducationCV if err := r.db.WithContext(ctx).Where("id = ?", id).First(&education).Error; err != nil { return nil, err } return &education, nil var education models.EducationCV if err := r.db.WithContext(ctx).Where("id = ?", id).First(&education).Error; err != nil { return nil, err } return &education, nil}
// DeleteEducation menghapus data pendidikan berdasarkan idfunc (r *cvRepository) DeleteEducation(ctx context.Context, id int64) error { if err := r.db.WithContext(ctx).Where("id = ?", id).Delete(&models.EducationCV{}).Error; err != nil { return err } return nil if err := r.db.WithContext(ctx).Where("id = ?", id).Delete(&models.EducationCV{}).Error; err != nil { return err } return nil}
// SaveJob menyimpan atau memperbarui data pekerjaan ke databasefunc (r *cvRepository) SaveJob(ctx context.Context, req *models.JobCV) (*models.JobCV, error) { if err := r.db.WithContext(ctx).Save(req).Error; err != nil { return req, err } return req, nil if err := r.db.WithContext(ctx).Save(req).Error; err != nil { return req, err } return req, nil}
// ListJob mengambil daftar data pekerjaan berdasarkan account_idfunc (r *cvRepository) ListJob(ctx context.Context, accountID int64) ([]models.JobCV, error) { var jobs []models.JobCV if err := r.db.WithContext(ctx).Where("account_id = ?", accountID).Find(&jobs).Error; err != nil { return nil, err } return jobs, nil var jobs []models.JobCV if err := r.db.WithContext(ctx).Where("account_id = ?", accountID).Find(&jobs).Error; err != nil { return nil, err } return jobs, nil}
// GetJob mengambil satu data pekerjaan berdasarkan idfunc (r *cvRepository) GetJob(ctx context.Context, id int64) (*models.JobCV, error) { var job models.JobCV if err := r.db.WithContext(ctx).Where("id = ?", id).First(&job).Error; err != nil { return nil, err } return &job, nil var job models.JobCV if err := r.db.WithContext(ctx).Where("id = ?", id).First(&job).Error; err != nil { return nil, err } return &job, nil}
// DeleteJob menghapus data pekerjaan berdasarkan idfunc (r *cvRepository) DeleteJob(ctx context.Context, id int64) error { if err := r.db.WithContext(ctx).Where("id = ?", id).Delete(&models.JobCV{}).Error; err != nil { return err } return nil if err := r.db.WithContext(ctx).Where("id = ?", id).Delete(&models.JobCV{}).Error; err != nil { return err } return nil}
// SaveAchievement menyimpan atau memperbarui data prestasi ke databasefunc (r *cvRepository) SaveAchievement(ctx context.Context, req *models.AchievementCV) (*models.AchievementCV, error) { if err := r.db.WithContext(ctx).Save(req).Error; err != nil { return req, err } return req, nil if err := r.db.WithContext(ctx).Save(req).Error; err != nil { return req, err } return req, nil}
// ListAchievement mengambil daftar data prestasi berdasarkan account_idfunc (r *cvRepository) ListAchievement(ctx context.Context, accountID int64) ([]models.AchievementCV, error) { var achievements []models.AchievementCV if err := r.db.WithContext(ctx).Where("account_id = ?", accountID).Find(&achievements).Error; err != nil { return nil, err } return achievements, nil var achievements []models.AchievementCV if err := r.db.WithContext(ctx).Where("account_id = ?", accountID).Find(&achievements).Error; err != nil { return nil, err } return achievements, nil}
// GetAchievement mengambil satu data prestasi berdasarkan idfunc (r *cvRepository) GetAchievement(ctx context.Context, id int64) (*models.AchievementCV, error) { var achievement models.AchievementCV if err := r.db.WithContext(ctx).Where("id = ?", id).First(&achievement).Error; err != nil { return nil, err } return &achievement, nil var achievement models.AchievementCV if err := r.db.WithContext(ctx).Where("id = ?", id).First(&achievement).Error; err != nil { return nil, err } return &achievement, nil}
// DeleteAchievement menghapus data prestasi berdasarkan idfunc (r *cvRepository) DeleteAchievement(ctx context.Context, id int64) error { if err := r.db.WithContext(ctx).Where("id = ?", id).Delete(&models.AchievementCV{}).Error; err != nil { return err } return nil if err := r.db.WithContext(ctx).Where("id = ?", id).Delete(&models.AchievementCV{}).Error; err != nil { return err } return nil}4 unmodified lines56789101158 unmodified lines70717272737374754 unmodified lines8081828485838485868788899091929394958996979899100101102103104105106107108109110111112113114115116117118921191201216 unmodified lines1281291301051311321331344 unmodified lines "errors" "math" "strconv" "strings"
"api.qobiltu.id/models" "api.qobiltu.id/pkg/storage"58 unmodified lines}
func (s *cvService) SaveAccountDetails(ctx context.Context, req *models.SaveAccountDetailsRequest) (*models.AccountDetails, error) { // notes // jika ingin mengubah value wajib kirimkan field beserta value nya if err := validation.Validate(req); err != nil { return nil, response.HandleValidationError(err) }4 unmodified lines return nil, response.HandleGormError(err, "Internal Server Error") }
// Apply perubahan if accountDetails == nil { // Cek apakah accountDetails baru atau existing isNew := accountDetails == nil if isNew { accountDetails = &models.AccountDetails{} accountDetails.AccountID = uint(req.AccountID) }
// Simpan gender lama jika ada oldGender := "" if accountDetails.Gender != nil { oldGender = strings.ToLower(*accountDetails.Gender) }
accountDetails.AccountID = uint(req.AccountID) // Update gender jika dikirim dari request var genderChanged bool if req.Gender != nil { newGender := strings.ToLower(*req.Gender) if oldGender != newGender { genderChanged = true accountDetails.Gender = req.Gender } }
// Jika gender baru atau gender berubah, generate InitialName baru via sequence if isNew || genderChanged { if accountDetails.Gender != nil { number, err := s.cvRepository.GetNextInitialNameNumber(ctx, *accountDetails.Gender) if err != nil { return nil, response.HandleGormError(err, "Gagal generate initial name") } accountDetails.InitialName = models.BuildInitialName(*accountDetails.Gender, number) } }
// Apply perubahan field lainnya utils.AssignIfNotNil(&accountDetails.FullName, req.FullName) utils.AssignIfNotNil(&accountDetails.Gender, req.Gender) utils.AssignIfNotNil(&accountDetails.DateOfBirth, req.DateOfBirth) utils.AssignIfNotNil(&accountDetails.PlaceOfBirth, req.PlaceOfBirth) utils.AssignIfNotNil(&accountDetails.Domicile, req.Domicile)6 unmodified lines accountDetails.PhoneNumber = &sanitizedPhone }
// Simpan data // Simpan ke database res, err := s.cvRepository.SaveAccountDetails(ctx, accountDetails) if err != nil { return nil, response.HandleGormError(err, "Internal Server Error")1 unmodified line234556764 unmodified lines72737475767778798080818283848586878889909192939495969783848586989910010110210310410510610710810911090911111121131141151161171181 unmodified line1201211221231241251261275 unmodified lines1331341351361371381391401411421431 unmodified line
import ( "regexp" "strconv" "strings"
"api.qobiltu.id/models"64 unmodified lines}
func (s *UserProfileService) Update() { // Sanitize phone number if s.Constructor.PhoneNumber != nil { phoneNumber := *s.Constructor.PhoneNumber *s.Constructor.PhoneNumber = SanitizePhoneNumber(phoneNumber) } usersCount := repositories.GetAllAccount().RowsCount
// Ambil data account details dari DB existingDetails := repositories.GetAccountDetailsByAccountID(uint(s.Constructor.AccountID)) if existingDetails.RowsError != nil { s.Error = existingDetails.RowsError return } if existingDetails.NoRecord { s.Exception.DataNotFound = true s.Exception.Message = "Account details not found" return }
// Update initial name jika gender berubah var initialName string shouldUpdateInitialName := false
if s.Constructor.Gender != nil { if strings.ToLower(*s.Constructor.Gender) == "laki-laki" { initialName = "IKH_" } else { initialName = "AKH_" newGender := strings.ToLower(*s.Constructor.Gender) oldGender := "" if existingDetails.Result.Gender != nil { oldGender = strings.ToLower(*existingDetails.Result.Gender) } if newGender != oldGender { initialNameNumber := repositories.GetNextInitialNameNumber(*s.Constructor.Gender) initialName = models.BuildInitialName(*s.Constructor.Gender, int64(initialNameNumber.Result)) s.Constructor.InitialName = initialName shouldUpdateInitialName = true } }
initialName += strconv.Itoa(usersCount) s.Constructor.InitialName = initialName // Update ke database if !shouldUpdateInitialName { s.Constructor.InitialName = existingDetails.Result.InitialName }
userProfile := repositories.UpdateAccountDetails(s.Constructor) s.Error = userProfile.RowsError if userProfile.NoRecord {1 unmodified line s.Exception.Message = "There is no account with given credentials!" return }
// Update flag isDetailCompleted di account account := repositories.GetAccountById(uint(s.Constructor.AccountID)) account.Result.IsDetailCompleted = (userProfile.Result.InitialName != "" && userProfile.Result.FullName != nil &&5 unmodified lines userProfile.Result.LastEducation != nil && userProfile.Result.MaritalStatus != nil) repositories.UpdateAccount(account.Result)
s.Result = models.UserProfileResponse{ Account: account.Result, Details: userProfile.Result, }
s.Result.Account.Password = "SECRET"}18 unmodified lines192021222322232425265 unmodified lines32333435363536373839153 unmodified lines1931941951961971981961971981992002018 unmodified lines2102112122132142132142152162172182192202212192202212222232242252262272282292282292302312322332342352362342352362372382392 unmodified lines2422432442452462452462472482492502512522532512522532542552569 unmodified lines26626726826927026927027127227327427527627727827928028128228328427527627727827928028128228328428528628728828929029129229329429529629728828929029129229329429529629729829930030130230330430530630130230330430530630730830918 unmodified lines}
type AccountDetails struct { ID uint64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"` AccountID uint `gorm:"column:account_id;not null;unique" json:"account_id"` ID uint64 `gorm:"column:id;primaryKey;autoIncrement" json:"id" counter:"skip"` AccountID uint `gorm:"column:account_id;not null;unique" json:"account_id" counter:"skip"` InitialName string `gorm:"column:initial_name;not null" json:"initial_name"` FullName *string `gorm:"column:full_name" json:"full_name"` DateOfBirth *time.Time `gorm:"column:date_of_birth" json:"date_of_birth"`5 unmodified lines MaritalStatus *string `gorm:"column:marital_status" json:"marital_status"` Avatar *string `gorm:"column:avatar" json:"avatar"` PhoneNumber *string `gorm:"column:phone_number" json:"phone_number"` CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"` UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at"` CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at" counter:"skip"` UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at" counter:"skip"` FieldCounter}
153 unmodified lines
type ( PersonalityAndPreferenceCV struct { ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"` AccountID int64 `gorm:"column:account_id;not null;unique" json:"account_id"` Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty"` ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id" counter:"skip"` AccountID int64 `gorm:"column:account_id;not null;unique" json:"account_id" counter:"skip"` Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty" counter:"skip"` PositiveTraits *string `gorm:"column:positive_traits" json:"positive_traits"` // sifat positif NegativeTraits *string `gorm:"column:negative_traits" json:"negative_traits"` // sifat negatif Hobbies *string `gorm:"column:hobbies" json:"hobbies"` // hobi8 unmodified lines CanCook *bool `gorm:"column:can_cook" json:"can_cook"` // bisa memasak TypesOfDishesCooked *string `gorm:"column:types_of_dishes_cooked" json:"types_of_dishes_cooked"` // jenis masakan yang bisa dimasak MonthlyExpenses *string `gorm:"column:monthly_expenses" json:"monthly_expenses"` // pengeluaran per bulan CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"` UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at"` CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at" counter:"skip"` UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at" counter:"skip"` FieldCounter }
FamilyMemberCV struct { ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"` AccountID int64 `gorm:"column:account_id;not null" json:"account_id"` Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty"` ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id" counter:"skip"` AccountID int64 `gorm:"column:account_id;not null" json:"account_id" counter:"skip"` Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty" counter:"skip"` Role *string `gorm:"column:role" json:"role"` // Peran dalam keluarga Status *string `gorm:"column:status" json:"status"` // Status (Hidup, Wafat) Religion *string `gorm:"column:religion" json:"religion"` // Agama Job *string `gorm:"column:job" json:"job"` // Pekerjaan LastEducation *string `gorm:"column:last_education" json:"last_education"` // Pendidikan terakhir Age *int `gorm:"column:age" json:"age"` // Usia CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"` UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at"` CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at" counter:"skip"` UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at" counter:"skip"` FieldCounter }
PhysicalAndHealthCV struct { ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"` AccountID int64 `gorm:"column:account_id;not null;unique" json:"account_id"` Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty"` ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id" counter:"skip"` AccountID int64 `gorm:"column:account_id;not null;unique" json:"account_id" counter:"skip"` Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty" counter:"skip"` HeightInCm *int `gorm:"column:height_cm" json:"height_cm"` // Tinggi badan dalam satuan sentimeter WeightInKg *int `gorm:"column:weight_kg" json:"weight_kg"` // Berat badan dalam satuan kilogram BodyShape *string `gorm:"column:body_shape" json:"body_shape"` // Bentuk tubuh2 unmodified lines MedicalHistory *pq.StringArray `gorm:"column:medical_history;type:varchar(255)[]" json:"medical_history"` // Riwayat penyakit PhysicalDisorder *string `gorm:"column:physical_disorder" json:"physical_disorder"` // Cacat fisik PhysicalTraits *string `gorm:"column:physical_traits" json:"physical_traits"` // Ciri khas fisik CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"` // Waktu data dibuat UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at"` // Waktu data terakhir diperbarui CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at" counter:"skip"` // Waktu data dibuat UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at" counter:"skip"` // Waktu data terakhir diperbarui FieldCounter }
WorshipAndReligiousUnderstandingCV struct { ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"` AccountID int64 `gorm:"column:account_id;not null;unique" json:"account_id"` Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty"` ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id" counter:"skip"` AccountID int64 `gorm:"column:account_id;not null;unique" json:"account_id" counter:"skip"` Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty" counter:"skip"` ObligatoryPrayer *string `gorm:"column:obligatory_prayer" json:"obligatory_prayer"` // sholat_wajib_5_waktu CongregationalPrayer *string `gorm:"column:congregational_prayer" json:"congregational_prayer"` // sholat_berjamaah_di_masjid TahajjudPrayer *string `gorm:"column:tahajjud_prayer" json:"tahajjud_prayer"` // sholat_tahajud9 unmodified lines OpinionOnVeil *string `gorm:"column:opinion_on_veil" json:"opinion_on_veil"` // pendapat_tentang_cadar WeeklyReligiousStudies *string `gorm:"column:weekly_religious_studies" json:"weekly_religious_studies"` // kajian_yang_diikuti_dalam_sepekan FollowedUstadz *string `gorm:"column:followed_ustadz" json:"followed_ustadz"` // ustadz_yang_diikuti CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"` UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at"` CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at" counter:"skip"` UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at" counter:"skip"` FieldCounter }
EducationCV struct { ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"` // id AccountID int64 `gorm:"column:account_id;not null" json:"account_id"` // id akun Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty"` // relasi ke akun LastEducation *string `gorm:"column:last_education" json:"last_education"` // pendidikan terakhir EducationInstitute *string `gorm:"column:education_institute" json:"education_institute"` // institusi pendidikan EducationMajor *string `gorm:"column:education_major" json:"education_major"` // jurusan pendidikan YearStart *int `gorm:"column:year_start" json:"year_start"` // tahun masuk YearGraduate *int `gorm:"column:year_graduate" json:"year_graduate"` // tahun lulus CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"` // tanggal dibuat UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at"` // tanggal diperbarui ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id" counter:"skip"` // id AccountID int64 `gorm:"column:account_id;not null" json:"account_id" counter:"skip"` // id akun Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty" counter:"skip"` // relasi ke akun LastEducation *string `gorm:"column:last_education" json:"last_education"` // pendidikan terakhir EducationInstitute *string `gorm:"column:education_institute" json:"education_institute"` // institusi pendidikan EducationMajor *string `gorm:"column:education_major" json:"education_major"` // jurusan pendidikan YearStart *int `gorm:"column:year_start" json:"year_start"` // tahun masuk YearGraduate *int `gorm:"column:year_graduate" json:"year_graduate"` // tahun lulus CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at" counter:"skip"` // tanggal dibuat UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at" counter:"skip"` // tanggal diperbarui }
JobCV struct { ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"` // id AccountID int64 `gorm:"column:account_id;not null" json:"account_id"` // id akun Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty"` // relasi ke akun InstitutionName *string `gorm:"column:institution_name" json:"institution_name"` // nama instansi CurrentJob *string `gorm:"column:current_job" json:"current_job"` // pekerjaan saat ini YearStartedWorking *int `gorm:"column:year_started_working" json:"year_started_working"` // tahun mulai bekerja MonthlyIncome *string `gorm:"column:monthly_income" json:"monthly_income"` // penghasilan per bulan IncomeSources *pq.StringArray `gorm:"column:income_sources;type:varchar(255)[]" json:"income_sources"` // sumber penghasilan CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"` // tanggal dibuat UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at"` // tanggal diperbarui ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id" counter:"skip"` // id AccountID int64 `gorm:"column:account_id;not null" json:"account_id" counter:"skip"` // id akun Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty" counter:"skip"` // relasi ke akun InstitutionName *string `gorm:"column:institution_name" json:"institution_name"` // nama instansi CurrentJob *string `gorm:"column:current_job" json:"current_job"` // pekerjaan saat ini YearStartedWorking *int `gorm:"column:year_started_working" json:"year_started_working"` // tahun mulai bekerja MonthlyIncome *string `gorm:"column:monthly_income" json:"monthly_income"` // penghasilan per bulan IncomeSources *pq.StringArray `gorm:"column:income_sources;type:varchar(255)[]" json:"income_sources"` // sumber penghasilan CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at" counter:"skip"` // tanggal dibuat UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at" counter:"skip"` // tanggal diperbarui }
AchievementCV struct { ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"` // id AccountID int64 `gorm:"column:account_id;not null" json:"account_id"` // id akun Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty"` // relasi ke akun AchievementOrAward *string `gorm:"column:achievement_or_award" json:"achievement_or_award"` // prestasi atau penghargaan CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"` // tanggal dibuat UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at"` // tanggal diperbarui ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id" counter:"skip"` // id AccountID int64 `gorm:"column:account_id;not null" json:"account_id" counter:"skip"` // id akun Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty" counter:"skip"` // relasi ke akun AchievementOrAward *string `gorm:"column:achievement_or_award" json:"achievement_or_award"` // prestasi atau penghargaan CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at" counter:"skip"` // tanggal dibuat UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at" counter:"skip"` // tanggal diperbarui })
123456710 unmodified lines1819202021222324252627282930313233343536373839404142252627282930package models
import ( "fmt" "reflect" "time")10 unmodified lines
// shouldSkipField menentukan apakah field harus dilewati dalam penghitunganfunc shouldSkipField(field reflect.StructField) bool { // Skip field dengan nama FieldCounter (embedded type) if field.Name == "FieldCounter" { return true }
// Skip field yang berasal dari GORM atau standard fields // seperti ID, timestamps, dan foreign keys if field.Name == "ID" || field.Name == "CreatedAt" || field.Name == "UpdatedAt" || field.Name == "DeletedAt" || field.Name == "AccountID" || field.Name == "Account" { return true }
// Periksa tag gorm untuk auto fields gormTag := field.Tag.Get("gorm") if len(gormTag) > 0 { // Skip kolom yang auto-increment atau auto-timestamp if gormTag == "primaryKey" || gormTag == "autoIncrement" || gormTag == "autoCreateTime" || gormTag == "autoUpdateTime" { return true } }
return false counterTag := field.Tag.Get("counter") fmt.Println(field.Name, "=", counterTag) return counterTag == "skip"}
// TotalFields menghitung jumlah total field dalam struct76 unmodified lines7778798081828376 unmodified lines &models.EducationCV{}, &models.JobCV{}, &models.AchievementCV{}, &models.MarriageReadinessProfile{}, )
if err != nil {123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566package cv_controller
import ( "net/http"
"api.qobiltu.id/middleware" "api.qobiltu.id/models" "api.qobiltu.id/response" "api.qobiltu.id/services" "github.com/gin-gonic/gin")
type MarriageReadinessProfileController interface { SaveMarriageReadinessProfile(ctx *gin.Context) GetMarriageReadinessProfile(ctx *gin.Context)}
type marriageReadinessProfileController struct { marriageReadinessProfileService services.MarriageReadinessProfileService}
func NewMarriageReadinessProfileController(marriageReadinessProfileService services.MarriageReadinessProfileService) MarriageReadinessProfileController { return &marriageReadinessProfileController{ marriageReadinessProfileService: marriageReadinessProfileService, }}
func (c *marriageReadinessProfileController) SaveMarriageReadinessProfile(ctx *gin.Context) { var req models.SaveMarriageReadinessProfileRequest if err := ctx.ShouldBindJSON(&req); err != nil { response.HandleError(ctx, models.Exception{ Message: "Invalid body request", BadRequest: true, Err: err, }) return }
accountData := middleware.GetAccountData(ctx) req.AccountID = int64(accountData.UserID)
res, err := c.marriageReadinessProfileService.SaveMarriageReadinessProfile(ctx, &req) if err != nil { response.HandleError(ctx, err) return }
response.HandleSuccess(ctx, http.StatusOK, "Marriage readiness profile saved", res, nil)}
func (c *marriageReadinessProfileController) GetMarriageReadinessProfile(ctx *gin.Context) { accountData := middleware.GetAccountData(ctx) accountID := int64(accountData.UserID)
req := models.GetMarriageReadinessProfileRequest{ AccountID: accountID, }
res, err := c.marriageReadinessProfileService.GetMarriageReadinessProfile(ctx, &req) if err != nil { response.HandleError(ctx, err) return }
response.HandleSuccess(ctx, http.StatusOK, "Get marriage readiness profile success", res, nil)}1234567856910111213143 unmodified lines18192016171821222338 unmodified lines626364656667686970713 unmodified lines75767778798081package main
import ( "log/slog" "net" "strconv"
"api.qobiltu.id/config" "api.qobiltu.id/controller/cv" "api.qobiltu.id/controller/health_check" cv_controller "api.qobiltu.id/controller/cv" health_check_controller "api.qobiltu.id/controller/health_check" marriage_readiness_profile_controller "api.qobiltu.id/controller/marriage_readiness_profile" "api.qobiltu.id/mail" "api.qobiltu.id/pkg/storage" "api.qobiltu.id/pkg/validation"3 unmodified lines "api.qobiltu.id/services" "api.qobiltu.id/utils" "github.com/hibiken/asynq" "log/slog" "net" "strconv")
func main() {38 unmodified lines cvService := services.NewCVService(cvRepository, localStorage) cvController := cv_controller.NewCVController(cvService)
marriageReadinessProfileRepository := repositories.NewMarriageReadinessProfileRepository(config.DB) marriageReadinessProfileService := services.NewMarriageReadinessProfileService(marriageReadinessProfileRepository) marriageReadinessProfileController := marriage_readiness_profile_controller.NewMarriageReadinessProfileController(marriageReadinessProfileService)
// start task processor err = taskProcessor.Start() utils.FatalIfErr("failed to start task processor", err)3 unmodified lines s, err := router.NewServer( healthCheckController, cvController, marriageReadinessProfileController, ) utils.FatalIfErr("failed to create server", err)
1234567891011121314151617181920212223242526272829303132333435363738package repositories
import ( "context"
"api.qobiltu.id/models" "gorm.io/gorm")
type MarriageReadinessProfileRepository interface { SaveMarriageReadinessProfile(ctx context.Context, req *models.MarriageReadinessProfile) (*models.MarriageReadinessProfile, error) GetMarriageReadinessProfile(ctx context.Context, accountID int64) (*models.MarriageReadinessProfile, error)}
type marriageReadinessProfileRepository struct { db *gorm.DB}
func NewMarriageReadinessProfileRepository(db *gorm.DB) MarriageReadinessProfileRepository { return &marriageReadinessProfileRepository{ db: db, }}
func (r *marriageReadinessProfileRepository) SaveMarriageReadinessProfile(ctx context.Context, req *models.MarriageReadinessProfile) (*models.MarriageReadinessProfile, error) { if err := r.db.WithContext(ctx).Save(req).Error; err != nil { return req, err } return req, nil}
func (r *marriageReadinessProfileRepository) GetMarriageReadinessProfile(ctx context.Context, accountID int64) (*models.MarriageReadinessProfile, error) { var marriageReadinessProfile models.MarriageReadinessProfile if err := r.db.WithContext(ctx).Where("account_id = ?", accountID).First(&marriageReadinessProfile).Error; err != nil { return nil, err } return &marriageReadinessProfile, nil}1234567891011package router
import "api.qobiltu.id/middleware"
func (s *Server) MarriageReadinessProfileRoute() { routerGroup := s.router.Group("/api/v1/marriage-readiness-profile").Use(middleware.AuthUser) { routerGroup.POST("", s.marriageReadinessProfileController.SaveMarriageReadinessProfile) routerGroup.GET("", s.marriageReadinessProfileController.GetMarriageReadinessProfile) }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990package services
import ( "context" "errors"
"api.qobiltu.id/models" "api.qobiltu.id/pkg/validation" "api.qobiltu.id/repositories" "api.qobiltu.id/response" "api.qobiltu.id/utils" "gorm.io/gorm")
type MarriageReadinessProfileService interface { SaveMarriageReadinessProfile(ctx context.Context, req *models.SaveMarriageReadinessProfileRequest) (*models.MarriageReadinessProfile, error) GetMarriageReadinessProfile(ctx context.Context, req *models.GetMarriageReadinessProfileRequest) (*models.MarriageReadinessProfile, error)}
type marriageReadinessProfileService struct { marriageReadinessProfileRepository repositories.MarriageReadinessProfileRepository}
func NewMarriageReadinessProfileService(marriageReadinessProfileRepository repositories.MarriageReadinessProfileRepository) MarriageReadinessProfileService { return &marriageReadinessProfileService{marriageReadinessProfileRepository: marriageReadinessProfileRepository}}
func (s *marriageReadinessProfileService) SaveMarriageReadinessProfile(ctx context.Context, req *models.SaveMarriageReadinessProfileRequest) (*models.MarriageReadinessProfile, error) { if err := validation.Validate(req); err != nil { return nil, response.HandleValidationError(err) }
marriageReadinessProfile, err := s.marriageReadinessProfileRepository.GetMarriageReadinessProfile(ctx, req.AccountID) if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { return nil, response.HandleGormError(err, "Internal Server Error") }
if marriageReadinessProfile == nil { marriageReadinessProfile = &models.MarriageReadinessProfile{} }
marriageReadinessProfile.AccountID = req.AccountID
utils.AssignIfNotNil(&marriageReadinessProfile.MarriageVision, req.MarriageVision) utils.AssignIfNotNil(&marriageReadinessProfile.LivingPlan, req.LivingPlan) utils.AssignIfNotNil(&marriageReadinessProfile.SpouseRoles, req.SpouseRoles) utils.AssignIfNotNil(&marriageReadinessProfile.SpouseRights, req.SpouseRights) utils.AssignIfNotNil(&marriageReadinessProfile.ConflictResolution, req.ConflictResolution) utils.AssignIfNotNil(&marriageReadinessProfile.ParentingStyle, req.ParentingStyle)
utils.AssignIfNotNil(&marriageReadinessProfile.ReadyToMarryDuration, req.ReadyToMarryDuration) utils.AssignIfNotNil(&marriageReadinessProfile.WeddingConcept, req.WeddingConcept) utils.AssignIfNotNil(&marriageReadinessProfile.WeddingFunding, req.WeddingFunding)
utils.AssignIfNotNil(&marriageReadinessProfile.CareerAfterMarriage, req.CareerAfterMarriage) utils.AssignIfNotNil(&marriageReadinessProfile.TimeManagement, req.TimeManagement) utils.AssignIfNotNil(&marriageReadinessProfile.CareerGoals, req.CareerGoals) utils.AssignIfNotNil(&marriageReadinessProfile.SelfDevelopment, req.SelfDevelopment)
utils.AssignIfNotNil(&marriageReadinessProfile.DelayChildren, req.DelayChildren) utils.AssignIfNotNil(&marriageReadinessProfile.ChildEducationPlan, req.ChildEducationPlan) utils.AssignIfNotNil(&marriageReadinessProfile.ReligiousEmotionalBond, req.ReligiousEmotionalBond) utils.AssignIfNotNil(&marriageReadinessProfile.ParentingChallenges, req.ParentingChallenges)
utils.AssignIfNotNil(&marriageReadinessProfile.MonthlyFinance, req.MonthlyFinance) utils.AssignIfNotNil(&marriageReadinessProfile.FamilyResponsibility, req.FamilyResponsibility) utils.AssignIfNotNil(&marriageReadinessProfile.DebtStatus, req.DebtStatus) utils.AssignIfNotNil(&marriageReadinessProfile.FinanceSharing, req.FinanceSharing) utils.AssignIfNotNil(&marriageReadinessProfile.IncomeGapView, req.IncomeGapView)
utils.AssignIfNotNil(&marriageReadinessProfile.DecisionMaking, req.DecisionMaking) utils.AssignIfNotNil(&marriageReadinessProfile.GrowthTogether, req.GrowthTogether) utils.AssignIfNotNil(&marriageReadinessProfile.ParentIntervention, req.ParentIntervention) utils.AssignIfNotNil(&marriageReadinessProfile.HabitResponse, req.HabitResponse)
res, err := s.marriageReadinessProfileRepository.SaveMarriageReadinessProfile(ctx, marriageReadinessProfile) if err != nil { return nil, response.HandleGormError(err, "Internal Server Error") }
return res, nil}
func (s *marriageReadinessProfileService) GetMarriageReadinessProfile(ctx context.Context, req *models.GetMarriageReadinessProfileRequest) (*models.MarriageReadinessProfile, error) { res, err := s.marriageReadinessProfileRepository.GetMarriageReadinessProfile(ctx, req.AccountID) if err != nil { return nil, response.HandleGormError(err, "Internal Server Error") } return res, nil}48 unmodified lines49505152525354558 unmodified lines64656667676869697071727374757613 unmodified lines90919293949596899798991005 unmodified lines10610710810110911010311111211311411511611711813 unmodified lines1321331341351361371381231391401411425 unmodified lines14814915013515115213715315415515615715815916017 unmodified lines1781791801611811821631831841851861871881891901911921671931941951966 unmodified lines20320420520620720820918021021121221310 unmodified lines22422522622722822923019723123223323410 unmodified lines2452462472482492502512142522532542555 unmodified lines26126226322626426522826626726826927027127227313 unmodified lines2872882892902912922932482942952962975 unmodified lines30330430526030630726230830931031131231331431513 unmodified lines3293303313323333343352823363373383394 unmodified lines34434534629334734829534935035135235335435535617 unmodified lines3743753763193773783213793803813823833843853863873883253893903913926 unmodified lines39940040140240340440533840640740840910 unmodified lines42042142242342442542635542742842943010 unmodified lines4414424434444454464473724484494504514 unmodified lines45645745838345946038546146246346446546646746817 unmodified lines4864874884094894904114914924934944954964974984995004155015025035046 unmodified lines51151251351451551651742851851952052110 unmodified lines53253353453553653753844553954054154210 unmodified lines5535545555565575585594625605615625634 unmodified lines56856957047357157247557357457557657757857958017 unmodified lines5985996004996016025016036046056066076086096106116125056136146156166 unmodified lines62362462562662762862951863063163263310 unmodified lines64464564664764864965053565165265365410 unmodified lines66566666766866967067155267267367467520 unmodified lines69669769857969970070170270370470570658370770870971048 unmodified lines DeleteAchievement(ctx *gin.Context)
UploadProfileImage(ctx *gin.Context) GetProgress(ctx *gin.Context) GetProgressCV(ctx *gin.Context)}
type cvController struct {8 unmodified lines
// --- Account Details ---func (c *cvController) SaveAccountDetails(ctx *gin.Context) { var req models.AccountDetailsRequest var req models.SaveAccountDetailsRequest if err := ctx.ShouldBindJSON(&req); err != nil { response.HandleError(ctx, err) response.HandleError(ctx, models.Exception{ Message: "Invalid body request", BadRequest: true, Err: err, }) return }
13 unmodified lines accountData := middleware.GetAccountData(ctx) accountID := int64(accountData.UserID)
req := models.GetAccountDetailsRequest{ AccountID: accountID, }
res, err := c.cvService.GetAccountDetails(ctx, accountID) res, err := c.cvService.GetAccountDetails(ctx, &req) if err != nil { response.HandleError(ctx, err) return5 unmodified lines// --- Personality & Preference ---
func (c *cvController) SavePersonalityAndPreference(ctx *gin.Context) { var req models.PersonalityAndPreferenceCVRequest var req models.SavePersonalityAndPreferenceRequest if err := ctx.ShouldBindJSON(&req); err != nil { response.HandleError(ctx, err) response.HandleError(ctx, models.Exception{ Message: "Invalid body request", BadRequest: true, Err: err, }) return }
13 unmodified lines accountData := middleware.GetAccountData(ctx) accountID := int64(accountData.UserID)
req := models.GetPersonalityAndPreferenceRequest{ AccountID: accountID, }
res, err := c.cvService.GetPersonalityAndPreference(ctx, accountID) res, err := c.cvService.GetPersonalityAndPreference(ctx, &req) if err != nil { response.HandleError(ctx, err) return5 unmodified lines// --- Family Member ---
func (c *cvController) CreateFamilyMember(ctx *gin.Context) { var req models.FamilyMemberRequest var req models.CreateFamilyMemberRequest if err := ctx.ShouldBindJSON(&req); err != nil { response.HandleError(ctx, err) response.HandleError(ctx, models.Exception{ Message: "Invalid body request", BadRequest: true, Err: err, }) return }
17 unmodified lines return }
var req models.FamilyMemberRequest var req models.UpdateFamilyMemberRequest if err := ctx.ShouldBindJSON(&req); err != nil { response.HandleError(ctx, err) response.HandleError(ctx, models.Exception{ Message: "Invalid body request", BadRequest: true, Err: err, }) return }
req.ID = id
res, err := c.cvService.UpdateFamilyMember(ctx, id, &req) res, err := c.cvService.UpdateFamilyMember(ctx, &req) if err != nil { response.HandleError(ctx, err) return6 unmodified lines accountData := middleware.GetAccountData(ctx) accountID := int64(accountData.UserID)
req := models.ListFamilyMemberRequest{ AccountID: accountID, }
list, err := c.cvService.ListFamilyMember(ctx, accountID) list, err := c.cvService.ListFamilyMember(ctx, &req) if err != nil { response.HandleError(ctx, err) return10 unmodified lines return }
req := models.GetFamilyMemberRequest{ ID: id, }
res, err := c.cvService.GetFamilyMember(ctx, id) res, err := c.cvService.GetFamilyMember(ctx, &req) if err != nil { response.HandleError(ctx, err) return10 unmodified lines return }
req := models.DeleteFamilyMemberRequest{ ID: id, }
err = c.cvService.DeleteFamilyMember(ctx, id) err = c.cvService.DeleteFamilyMember(ctx, &req) if err != nil { response.HandleError(ctx, err) return5 unmodified lines// --- Physical and Health ---
func (c *cvController) SavePhysicalAndHealth(ctx *gin.Context) { var req models.PhysicalAndHealthRequest var req models.SavePhysicalAndHealthRequest if err := ctx.ShouldBindJSON(&req); err != nil { response.HandleError(ctx, err) response.HandleError(ctx, models.Exception{ Message: "Invalid body request", BadRequest: true, Err: err, }) return }
13 unmodified lines accountData := middleware.GetAccountData(ctx) accountID := int64(accountData.UserID)
req := models.GetPhysicalAndHealthRequest{ AccountID: accountID, }
res, err := c.cvService.GetPhysicalAndHealth(ctx, accountID) res, err := c.cvService.GetPhysicalAndHealth(ctx, &req) if err != nil { response.HandleError(ctx, err) return5 unmodified lines// --- Worship and Religious Understanding ---
func (c *cvController) SaveWorshipAndReligiousUnderstanding(ctx *gin.Context) { var req models.WorshipAndReligiousUnderstandingRequest var req models.SaveWorshipAndReligiousUnderstandingRequest if err := ctx.ShouldBindJSON(&req); err != nil { response.HandleError(ctx, err) response.HandleError(ctx, models.Exception{ Message: "Invalid body request", BadRequest: true, Err: err, }) return }
13 unmodified lines accountData := middleware.GetAccountData(ctx) accountID := int64(accountData.UserID)
req := models.GetWorshipAndReligiousUnderstandingRequest{ AccountID: accountID, }
res, err := c.cvService.GetWorshipAndReligiousUnderstanding(ctx, accountID) res, err := c.cvService.GetWorshipAndReligiousUnderstanding(ctx, &req) if err != nil { response.HandleError(ctx, err) return4 unmodified lines
// --- Education ---func (c *cvController) CreateEducation(ctx *gin.Context) { var req models.EducationRequest var req models.CreateEducationRequest if err := ctx.ShouldBindJSON(&req); err != nil { response.HandleError(ctx, err) response.HandleError(ctx, models.Exception{ Message: "Invalid body request", BadRequest: true, Err: err, }) return }
17 unmodified lines return }
var req models.EducationRequest var req models.UpdateEducationRequest if err := ctx.ShouldBindJSON(&req); err != nil { response.HandleError(ctx, err) response.HandleError(ctx, models.Exception{ Message: "Invalid body request", BadRequest: true, Err: err, }) return }
req.ID = id
res, err := c.cvService.UpdateEducation(ctx, id, &req) res, err := c.cvService.UpdateEducation(ctx, &req) if err != nil { response.HandleError(ctx, err) return6 unmodified lines accountData := middleware.GetAccountData(ctx) accountID := int64(accountData.UserID)
req := models.ListEducationRequest{ AccountID: accountID, }
res, err := c.cvService.ListEducation(ctx, accountID) res, err := c.cvService.ListEducation(ctx, &req) if err != nil { response.HandleError(ctx, err) return10 unmodified lines return }
req := models.GetEducationRequest{ ID: id, }
res, err := c.cvService.GetEducation(ctx, id) res, err := c.cvService.GetEducation(ctx, &req) if err != nil { response.HandleError(ctx, err) return10 unmodified lines return }
req := models.DeleteEducationRequest{ ID: id, }
err = c.cvService.DeleteEducation(ctx, id) err = c.cvService.DeleteEducation(ctx, &req) if err != nil { response.HandleError(ctx, err) return4 unmodified lines
// --- Job ---func (c *cvController) CreateJob(ctx *gin.Context) { var req models.JobRequest var req models.CreateJobRequest if err := ctx.ShouldBindJSON(&req); err != nil { response.HandleError(ctx, err) response.HandleError(ctx, models.Exception{ Message: "Invalid body request", BadRequest: true, Err: err, }) return }
17 unmodified lines return }
var req models.JobRequest var req models.UpdateJobRequest if err := ctx.ShouldBindJSON(&req); err != nil { response.HandleError(ctx, err) response.HandleError(ctx, models.Exception{ Message: "Invalid body request", BadRequest: true, Err: err, }) return }
req.ID = id
res, err := c.cvService.UpdateJob(ctx, id, &req) res, err := c.cvService.UpdateJob(ctx, &req) if err != nil { response.HandleError(ctx, err) return6 unmodified lines accountData := middleware.GetAccountData(ctx) accountID := int64(accountData.UserID)
req := models.ListJobRequest{ AccountID: accountID, }
res, err := c.cvService.ListJob(ctx, accountID) res, err := c.cvService.ListJob(ctx, &req) if err != nil { response.HandleError(ctx, err) return10 unmodified lines return }
req := models.GetJobRequest{ ID: id, }
res, err := c.cvService.GetJob(ctx, id) res, err := c.cvService.GetJob(ctx, &req) if err != nil { response.HandleError(ctx, err) return10 unmodified lines return }
req := models.DeleteJobRequest{ ID: id, }
err = c.cvService.DeleteJob(ctx, id) err = c.cvService.DeleteJob(ctx, &req) if err != nil { response.HandleError(ctx, err) return4 unmodified lines
// --- Achievement ---func (c *cvController) CreateAchievement(ctx *gin.Context) { var req models.AchievementRequest var req models.CreateAchievementRequest if err := ctx.ShouldBindJSON(&req); err != nil { response.HandleError(ctx, err) response.HandleError(ctx, models.Exception{ Message: "Invalid body request", BadRequest: true, Err: err, }) return }
17 unmodified lines return }
var req models.AchievementRequest var req models.UpdateAchievementRequest if err := ctx.ShouldBindJSON(&req); err != nil { response.HandleError(ctx, err) response.HandleError(ctx, models.Exception{ Message: "Invalid body request", BadRequest: true, Err: err, }) return }
req.ID = id
res, err := c.cvService.UpdateAchievement(ctx, id, &req) res, err := c.cvService.UpdateAchievement(ctx, &req) if err != nil { response.HandleError(ctx, err) return6 unmodified lines accountData := middleware.GetAccountData(ctx) accountID := int64(accountData.UserID)
req := models.ListAchievementRequest{ AccountID: accountID, }
res, err := c.cvService.ListAchievement(ctx, accountID) res, err := c.cvService.ListAchievement(ctx, &req) if err != nil { response.HandleError(ctx, err) return10 unmodified lines return }
req := models.GetAchievementRequest{ ID: id, }
res, err := c.cvService.GetAchievement(ctx, id) res, err := c.cvService.GetAchievement(ctx, &req) if err != nil { response.HandleError(ctx, err) return10 unmodified lines return }
req := models.DeleteAchievementRequest{ ID: id, }
err = c.cvService.DeleteAchievement(ctx, id) err = c.cvService.DeleteAchievement(ctx, &req) if err != nil { response.HandleError(ctx, err) return20 unmodified lines response.HandleSuccess(ctx, http.StatusOK, "Profile image uploaded successfully", res, nil)}
func (c *cvController) GetProgress(ctx *gin.Context) {func (c *cvController) GetProgressCV(ctx *gin.Context) { accountData := middleware.GetAccountData(ctx) accountID := int64(accountData.UserID)
req := models.GetProgressCVRequest{ AccountID: accountID, }
res, err := c.cvService.GetProgress(ctx, accountID) res, err := c.cvService.GetProgressCV(ctx, &req) if err != nil { response.HandleError(ctx, err) return230 unmodified lines23123223323423523623723823924024124224324424524623423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927025125225325425525625725825926026126226326426526626726826927027127227311 unmodified lines28528628728828929029129229329429529629728828929029129229329429529629729829930038 unmodified lines33934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239324 unmodified lines418419420421422423230 unmodified lines }
PhysicalAndHealthCV struct { ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"` AccountID int64 `gorm:"column:account_id;not null;unique" json:"account_id"` Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty"` HeightInCm *int `gorm:"column:height_cm" json:"height_cm"` // Tinggi badan dalam satuan sentimeter WeightInKg *int `gorm:"column:weight_kg" json:"weight_kg"` // Berat badan dalam satuan kilogram BodyShape *string `gorm:"column:body_shape" json:"body_shape"` // Bentuk tubuh SkinColor *string `gorm:"column:skin_color" json:"skin_color"` // Warna kulit HairType *string `gorm:"column:hair_type" json:"hair_type"` // Tipe rambut MedicalHistory *string `gorm:"column:medical_history" json:"medical_history"` // Riwayat penyakit PhysicalDisorder *string `gorm:"column:physical_disorder" json:"physical_disorder"` // Cacat fisik PhysicalTraits *string `gorm:"column:physical_traits" json:"physical_traits"` // Ciri khas fisik CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"` // Waktu data dibuat UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at"` // Waktu data terakhir diperbarui ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"` AccountID int64 `gorm:"column:account_id;not null;unique" json:"account_id"` Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty"` HeightInCm *int `gorm:"column:height_cm" json:"height_cm"` // Tinggi badan dalam satuan sentimeter WeightInKg *int `gorm:"column:weight_kg" json:"weight_kg"` // Berat badan dalam satuan kilogram BodyShape *string `gorm:"column:body_shape" json:"body_shape"` // Bentuk tubuh SkinColor *string `gorm:"column:skin_color" json:"skin_color"` // Warna kulit HairType *string `gorm:"column:hair_type" json:"hair_type"` // Tipe rambut MedicalHistory *pq.StringArray `gorm:"column:medical_history;type:varchar(255)[]" json:"medical_history"` // Riwayat penyakit PhysicalDisorder *string `gorm:"column:physical_disorder" json:"physical_disorder"` // Cacat fisik PhysicalTraits *string `gorm:"column:physical_traits" json:"physical_traits"` // Ciri khas fisik CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"` // Waktu data dibuat UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at"` // Waktu data terakhir diperbarui FieldCounter }
WorshipAndReligiousUnderstandingCV struct { ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"` AccountID int64 `gorm:"column:account_id;not null;unique" json:"account_id"` Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty"` ObligatoryPrayer *string `gorm:"column:obligatory_prayer" json:"obligatory_prayer"` // sholat_wajib_5_waktu CongregationalPrayer *string `gorm:"column:congregational_prayer" json:"congregational_prayer"` // sholat_berjamaah_di_masjid TahajjudPrayer *string `gorm:"column:tahajjud_prayer" json:"tahajjud_prayer"` // sholat_tahajud DhuhaPrayer *string `gorm:"column:dhuha_prayer" json:"dhuha_prayer"` // sholat_dhuha QuranMemorization *string `gorm:"column:quran_memorization" json:"quran_memorization"` // hafalan_alquran QuranReadingAbility *string `gorm:"column:quran_reading_ability" json:"quran_reading_ability"` // kemampuan_baca_alquran DaudFasting *string `gorm:"column:daud_fasting" json:"daud_fasting"` // puasa_daud AyyamulBidhFasting *string `gorm:"column:ayyamul_bidh_fasting" json:"ayyamul_bidh_fasting"` // puasa_ayyamul_bidh HajjOrUmrah pq.StringArray `gorm:"column:hajj_or_umrah;type:varchar(255)[]" json:"hajj_or_umrah"` // ibadah_haji_umroh ListeningToMusic *string `gorm:"column:listening_to_music" json:"listening_to_music"` // mendengarkan_musik OpinionOnIkhtilat *string `gorm:"column:opinion_on_ikhtilat" json:"opinion_on_ikhtilat"` // pendapat_ikhtilat OpinionOnTouchingNonMahram *string `gorm:"column:opinion_on_touching_non_mahram" json:"opinion_on_touching_non_mahram"` // pendapat_menyentuh_non_mahram OpinionOnVeil *string `gorm:"column:opinion_on_veil" json:"opinion_on_veil"` // pendapat_tentang_cadar WeeklyReligiousStudies *string `gorm:"column:weekly_religious_studies" json:"weekly_religious_studies"` // kajian_yang_diikuti_dalam_sepekan FollowedUstadz *string `gorm:"column:followed_ustadz" json:"followed_ustadz"` // ustadz_yang_diikuti CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"` UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at"` ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"` AccountID int64 `gorm:"column:account_id;not null;unique" json:"account_id"` Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty"` ObligatoryPrayer *string `gorm:"column:obligatory_prayer" json:"obligatory_prayer"` // sholat_wajib_5_waktu CongregationalPrayer *string `gorm:"column:congregational_prayer" json:"congregational_prayer"` // sholat_berjamaah_di_masjid TahajjudPrayer *string `gorm:"column:tahajjud_prayer" json:"tahajjud_prayer"` // sholat_tahajud DhuhaPrayer *string `gorm:"column:dhuha_prayer" json:"dhuha_prayer"` // sholat_dhuha QuranMemorization *string `gorm:"column:quran_memorization" json:"quran_memorization"` // hafalan_alquran QuranReadingAbility *string `gorm:"column:quran_reading_ability" json:"quran_reading_ability"` // kemampuan_baca_alquran DaudFasting *string `gorm:"column:daud_fasting" json:"daud_fasting"` // puasa_daud AyyamulBidhFasting *string `gorm:"column:ayyamul_bidh_fasting" json:"ayyamul_bidh_fasting"` // puasa_ayyamul_bidh HajjOrUmrah *pq.StringArray `gorm:"column:hajj_or_umrah;type:varchar(255)[]" json:"hajj_or_umrah"` // ibadah_haji_umroh ListeningToMusic *string `gorm:"column:listening_to_music" json:"listening_to_music"` // mendengarkan_musik OpinionOnIkhtilat *string `gorm:"column:opinion_on_ikhtilat" json:"opinion_on_ikhtilat"` // pendapat_ikhtilat OpinionOnTouchingNonMahram *string `gorm:"column:opinion_on_touching_non_mahram" json:"opinion_on_touching_non_mahram"` // pendapat_menyentuh_non_mahram OpinionOnVeil *string `gorm:"column:opinion_on_veil" json:"opinion_on_veil"` // pendapat_tentang_cadar WeeklyReligiousStudies *string `gorm:"column:weekly_religious_studies" json:"weekly_religious_studies"` // kajian_yang_diikuti_dalam_sepekan FollowedUstadz *string `gorm:"column:followed_ustadz" json:"followed_ustadz"` // ustadz_yang_diikuti CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"` UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at"` FieldCounter }
11 unmodified lines }
JobCV struct { ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"` // id AccountID int64 `gorm:"column:account_id;not null" json:"account_id"` // id akun Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty"` // relasi ke akun InstitutionName *string `gorm:"column:institution_name" json:"institution_name"` // nama instansi CurrentJob *string `gorm:"column:current_job" json:"current_job"` // pekerjaan saat ini YearStartedWorking *int `gorm:"column:year_started_working" json:"year_started_working"` // tahun mulai bekerja MonthlyIncome *string `gorm:"column:monthly_income" json:"monthly_income"` // penghasilan per bulan IncomeSources pq.StringArray `gorm:"column:income_sources;type:varchar(255)[]" json:"income_sources"` // sumber penghasilan CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"` // tanggal dibuat UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at"` // tanggal diperbarui ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"` // id AccountID int64 `gorm:"column:account_id;not null" json:"account_id"` // id akun Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty"` // relasi ke akun InstitutionName *string `gorm:"column:institution_name" json:"institution_name"` // nama instansi CurrentJob *string `gorm:"column:current_job" json:"current_job"` // pekerjaan saat ini YearStartedWorking *int `gorm:"column:year_started_working" json:"year_started_working"` // tahun mulai bekerja MonthlyIncome *string `gorm:"column:monthly_income" json:"monthly_income"` // penghasilan per bulan IncomeSources *pq.StringArray `gorm:"column:income_sources;type:varchar(255)[]" json:"income_sources"` // sumber penghasilan CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"` // tanggal dibuat UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at"` // tanggal diperbarui }
AchievementCV struct {38 unmodified lines return w.FieldCounter.GetFilledFields(w)}
type ( MarriageReadinessProfile struct { ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"` AccountID int64 `gorm:"column:account_id;not null;unique" json:"account_id"` Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty"`
// Visi Misi Rumah Tangga MarriageVision *string `gorm:"column:marriage_vision" json:"marriage_vision"` // Apa visi dan tujuan utama kamu dalam membangun rumah tangga? LivingPlan *string `gorm:"column:living_plan" json:"living_plan"` // Setelah menikah, kamu berencana tinggal di mana? SpouseRoles *string `gorm:"column:spouse_roles" json:"spouse_roles"` // Menurutmu, apa peran utama suami dan istri dalam rumah tangga? SpouseRights *string `gorm:"column:spouse_rights" json:"spouse_rights"` // Apa saja hak suami dan istri menurutmu? ConflictResolution *string `gorm:"column:conflict_resolution" json:"conflict_resolution"` // Jika terjadi konflik, bagaimana kamu menyikapinya? ParentingStyle *string `gorm:"column:parenting_style" json:"parenting_style"` // Setelah punya anak, pola pengasuhan seperti apa yang kamu inginkan?
// Konsep Acara Pernikahan ReadyToMarryDuration *string `gorm:"column:ready_to_marry_duration" json:"ready_to_marry_duration"` // Setelah taaruf dimulai, berapa lama kamu butuh untuk siap menikah? WeddingConcept *string `gorm:"column:wedding_concept" json:"wedding_concept"` // Seperti apa konsep pernikahan yang kamu harapkan? WeddingFunding *string `gorm:"column:wedding_funding" json:"wedding_funding"` // Apakah kamu sudah mempersiapkan dana pernikahan? Dari mana sumbernya?
// Karir Kedepannya CareerAfterMarriage *string `gorm:"column:career_after_marriage" json:"career_after_marriage"` // Apakah kamu ingin tetap bekerja setelah menikah? TimeManagement *string `gorm:"column:time_management" json:"time_management"` // Bagaimana kamu membagi waktu antara keluarga, ibadah, dan pekerjaan? CareerGoals *string `gorm:"column:career_goals" json:"career_goals"` // Apa impian karier atau cita-cita kamu dalam 5 sampai 10 tahun ke depan? SelfDevelopment *string `gorm:"column:self_development" json:"self_development"` // Apa usaha kamu untuk terus mengembangkan diri dan skill?
// Pendidikan Keluarga DelayChildren *string `gorm:"column:delay_children" json:"delay_children"` // Apakah kamu berencana menunda memiliki anak? ChildEducationPlan *string `gorm:"column:child_education_plan" json:"child_education_plan"` // Apakah kamu sudah punya rencana pendidikan anak? ReligiousEmotionalBond *string `gorm:"column:religious_emotional_bond" json:"religious_emotional_bond"` // Bagaimana cara menjaga nilai agama & kedekatan emosional dengan anak? ParentingChallenges *string `gorm:"column:parenting_challenges" json:"parenting_challenges"` // Saat menghadapi tantangan pengasuhan, bagaimana kamu menyikapinya?
// Finansial Keluarga MonthlyFinance *string `gorm:"column:monthly_finance" json:"monthly_finance"` // Bagaimana kamu mengelola keuangan bulanan? FamilyResponsibility *string `gorm:"column:family_responsibility" json:"family_responsibility"` // Apakah kamu masih punya tanggungan keluarga setelah menikah? DebtStatus *string `gorm:"column:debt_status" json:"debt_status"` // Apakah kamu punya cicilan/utang setelah menikah? FinanceSharing *string `gorm:"column:finance_sharing" json:"finance_sharing"` // Setelah menikah, bagaimana pembagian tanggung jawab keuangan? IncomeGapView *string `gorm:"column:income_gap_view" json:"income_gap_view"` // Pandangan kamu jika istri berpenghasilan lebih besar dari suami?
// Keputusan dan Komunikasi DecisionMaking *string `gorm:"column:decision_making" json:"decision_making"` // Dalam mengambil keputusan, kamu lebih mempertimbangkan pasangan atau sendiri? GrowthTogether *string `gorm:"column:growth_together" json:"growth_together"` // Apakah kamu siap berjuang bersama pasangan? Apa saja yang ingin diperjuangkan? ParentIntervention *string `gorm:"column:parent_intervention" json:"parent_intervention"` // Sejauh mana orang tua/mertua boleh ikut campur dalam rumah tangga? HabitResponse *string `gorm:"column:habit_response" json:"habit_response"` // Bagaimana kamu menyikapi kebiasaan pasangan yang kurang kamu sukai?
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"` UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at"` })
// Gorm table name settingsfunc (Account) TableName() string { return "account" }func (AccountDetails) TableName() string { return "account_details" }24 unmodified linesfunc (EducationCV) TableName() string { return "education_cv" }func (JobCV) TableName() string { return "job_cv" }func (AchievementCV) TableName() string { return "achievement_cv" }func (MarriageReadinessProfile) TableName() string { return "marriage_readiness_profile"}57 unmodified lines585960616261626364656610 unmodified lines777879798080818283848586878889909192939495969798991001012 unmodified lines104105106899091929394959697981071081091101011111121131141151161171181191201211221231241251261271281291301311321331341351361371386 unmodified lines1451461471481491501511141151161171181191201211221231241251261271281291301311321331341521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891 unmodified line1911921931421431441451461471481941951961971511981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612623 unmodified lines2662672681652692702712722732742752765 unmodified lines28228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933057 unmodified lines}
type ( PersonalityAndPreferenceCVRequest struct { AccountID int64 `json:"-"` SavePersonalityAndPreferenceRequest struct { AccountID int64 `json:"-"`
PositiveTraits *string `json:"positive_traits"` // sifat positif NegativeTraits *string `json:"negative_traits"` // sifat negatif Hobbies *string `json:"hobbies"` // hobi10 unmodified lines MonthlyExpenses *string `json:"monthly_expenses" validate:"monthly_expenses"` // pengeluaran per bulan }
FamilyMemberRequest struct { AccountID int64 `json:"-"` GetPersonalityAndPreferenceRequest struct { AccountID int64 `json:"-"` }
CreateFamilyMemberRequest struct { AccountID int64 `json:"-"`
Role *string `json:"role" validate:"family_role"` // Peran dalam keluarga Status *string `json:"status" validate:"life_status"` // Status (Hidup, Wafat) Religion *string `json:"religion" validate:"religion"` // Agama Job *string `json:"job"` // Pekerjaan LastEducation *string `json:"last_education" validate:"last_education"` // Pendidikan terakhir Age *int `json:"age"` // Usia }
UpdateFamilyMemberRequest struct { ID int64 `json:"-"` AccountID int64 `json:"-"`
Role *string `json:"role" validate:"family_role"` // Peran dalam keluarga Status *string `json:"status" validate:"life_status"` // Status (Hidup, Wafat) Religion *string `json:"religion" validate:"religion"` // Agama2 unmodified lines Age *int `json:"age"` // Usia }
PhysicalAndHealthRequest struct { AccountID int64 `json:"-"` HeightInCm *int `json:"height_cm"` // Tinggi badan dalam satuan sentimeter WeightInKg *int `json:"weight_kg"` // Berat badan dalam satuan kilogram BodyShape *string `json:"body_shape" validate:"body_shape"` // Bentuk tubuh SkinColor *string `json:"skin_color" validate:"skin_color"` // Warna kulit HairType *string `json:"hair_type" validate:"hair_type"` // Tipe rambut MedicalHistory *string `json:"medical_history"` // Riwayat penyakit PhysicalDisorder *string `json:"physical_disorder"` // Cacat fisik PhysicalTraits *string `json:"physical_traits"` // Ciri khas fisik ListFamilyMemberRequest struct { AccountID int64 `json:"-"` }
AccountDetailsRequest struct { GetFamilyMemberRequest struct { ID int64 `json:"-"` }
DeleteFamilyMemberRequest struct { ID int64 `json:"-"` }
SavePhysicalAndHealthRequest struct { AccountID int64 `json:"-"` HeightInCm *int `json:"height_cm"` // Tinggi badan dalam satuan sentimeter WeightInKg *int `json:"weight_kg"` // Berat badan dalam satuan kilogram BodyShape *string `json:"body_shape" validate:"body_shape"` // Bentuk tubuh SkinColor *string `json:"skin_color" validate:"skin_color"` // Warna kulit HairType *string `json:"hair_type" validate:"hair_type"` // Tipe rambut MedicalHistory *pq.StringArray `json:"medical_history"` // Riwayat penyakit PhysicalDisorder *string `json:"physical_disorder"` // Cacat fisik PhysicalTraits *string `json:"physical_traits"` // Ciri khas fisik }
GetPhysicalAndHealthRequest struct { AccountID int64 `json:"-"` }
SaveAccountDetailsRequest struct { AccountID int64 `json:"-"` FullName *string `json:"full_name"` Gender *string `json:"gender" validate:"gender"`6 unmodified lines PhoneNumber *string `json:"phone_number" validate:"phone_number"` }
GetAccountDetailsRequest struct { AccountID int64 `json:"account_id"` }
WorshipAndReligiousUnderstandingRequest struct { AccountID int64 `json:"-"` ObligatoryPrayer *string `json:"obligatory_prayer"` // sholat_wajib_5_waktu CongregationalPrayer *string `json:"congregational_prayer"` // sholat_berjamaah_di_masjid TahajjudPrayer *string `json:"tahajjud_prayer"` // sholat_tahajud DhuhaPrayer *string `json:"dhuha_prayer"` // sholat_dhuha QuranMemorization *string `json:"quran_memorization"` // hafalan_alquran QuranReadingAbility *string `json:"quran_reading_ability" validate:"quran_reading_ability"` // kemampuan_baca_alquran DaudFasting *string `json:"daud_fasting"` // puasa_daud AyyamulBidhFasting *string `json:"ayyamul_bidh_fasting"` // puasa_ayyamul_bidh HajjOrUmrah pq.StringArray `json:"hajj_or_umrah"` // ibadah_haji_umroh ListeningToMusic *string `json:"listening_to_music"` // mendengarkan_musik OpinionOnIkhtilat *string `json:"opinion_on_ikhtilat"` // pendapat_ikhtilat OpinionOnTouchingNonMahram *string `json:"opinion_on_touching_non_mahram"` // pendapat_menyentuh_non_mahram OpinionOnVeil *string `json:"opinion_on_veil"` // pendapat_tentang_cadar WeeklyReligiousStudies *string `json:"weekly_religious_studies"` // kajian_yang_diikuti_dalam_sepekan FollowedUstadz *string `json:"followed_ustadz"` // ustadz_yang_diikuti }
EducationRequest struct { AccountID int64 `json:"account_id"` SaveWorshipAndReligiousUnderstandingRequest struct { AccountID int64 `json:"-"` ObligatoryPrayer *string `json:"obligatory_prayer"` // sholat_wajib_5_waktu CongregationalPrayer *string `json:"congregational_prayer"` // sholat_berjamaah_di_masjid TahajjudPrayer *string `json:"tahajjud_prayer"` // sholat_tahajud DhuhaPrayer *string `json:"dhuha_prayer"` // sholat_dhuha QuranMemorization *string `json:"quran_memorization"` // hafalan_alquran QuranReadingAbility *string `json:"quran_reading_ability" validate:"quran_reading_ability"` // kemampuan_baca_alquran DaudFasting *string `json:"daud_fasting"` // puasa_daud AyyamulBidhFasting *string `json:"ayyamul_bidh_fasting"` // puasa_ayyamul_bidh HajjOrUmrah *pq.StringArray `json:"hajj_or_umrah"` // ibadah_haji_umroh ListeningToMusic *string `json:"listening_to_music"` // mendengarkan_musik OpinionOnIkhtilat *string `json:"opinion_on_ikhtilat"` // pendapat_ikhtilat OpinionOnTouchingNonMahram *string `json:"opinion_on_touching_non_mahram"` // pendapat_menyentuh_non_mahram OpinionOnVeil *string `json:"opinion_on_veil"` // pendapat_tentang_cadar WeeklyReligiousStudies *string `json:"weekly_religious_studies"` // kajian_yang_diikuti_dalam_sepekan FollowedUstadz *string `json:"followed_ustadz"` // ustadz_yang_diikuti }
GetWorshipAndReligiousUnderstandingRequest struct { AccountID int64 `json:"-"` }
CreateEducationRequest struct { AccountID int64 `json:"-"` LastEducation *string `json:"last_education" validate:"last_education"` // pendidikan terakhir EducationInstitute *string `json:"education_institute"` // institusi pendidikan EducationMajor *string `json:"education_major"` // jurusan pendidikan YearStart *int `json:"year_start"` // tahun masuk YearGraduate *int `json:"year_graduate"` // tahun lulus }
UpdateEducationRequest struct { ID int64 `json:"-"` AccountID int64 `json:"-"` LastEducation *string `json:"last_education" validate:"last_education"` // pendidikan terakhir EducationInstitute *string `json:"education_institute"` // institusi pendidikan EducationMajor *string `json:"education_major"` // jurusan pendidikan1 unmodified line YearGraduate *int `json:"year_graduate"` // tahun lulus }
JobRequest struct { AccountID int64 `json:"account_id"` InstitutionName *string `json:"institution_name"` // nama instansi CurrentJob *string `json:"current_job"` // pekerjaan saat ini YearStartedWorking *int `json:"year_started_working"` // tahun mulai bekerja MonthlyIncome *string `json:"monthly_income" validate:"monthly_income"` // penghasilan per bulan IncomeSources pq.StringArray `json:"income_sources"` // sumber penghasilan ListEducationRequest struct { AccountID int64 `json:"-"` }
AchievementRequest struct { GetEducationRequest struct { ID int64 `json:"-"` }
DeleteEducationRequest struct { ID int64 `json:"-"` }
CreateJobRequest struct { AccountID int64 `json:"account_id"` InstitutionName *string `json:"institution_name"` // nama instansi CurrentJob *string `json:"current_job"` // pekerjaan saat ini YearStartedWorking *int `json:"year_started_working"` // tahun mulai bekerja MonthlyIncome *string `json:"monthly_income" validate:"monthly_income"` // penghasilan per bulan IncomeSources *pq.StringArray `json:"income_sources"` // sumber penghasilan }
UpdateJobRequest struct { ID int64 `json:"-"` AccountID int64 `json:"-"` InstitutionName *string `json:"institution_name"` // nama instansi CurrentJob *string `json:"current_job"` // pekerjaan saat ini YearStartedWorking *int `json:"year_started_working"` // tahun mulai bekerja MonthlyIncome *string `json:"monthly_income" validate:"monthly_income"` // penghasilan per bulan IncomeSources *pq.StringArray `json:"income_sources"` // sumber penghasilan }
ListJobRequest struct { AccountID int64 `json:"-"` }
GetJobRequest struct { ID int64 `json:"-"` }
DeleteJobRequest struct { ID int64 `json:"-"` }
CreateAchievementRequest struct { AccountID int64 `json:"account_id"` AchievementOrAward *string `json:"achievement_or_award"` // prestasi atau penghargaan }
UpdateAchievementRequest struct { ID int64 `json:"-"` AccountID int64 `json:"-"` AchievementOrAward *string `json:"achievement_or_award"` // prestasi atau penghargaan }
ListAchievementRequest struct { AccountID int64 `json:"-"` }
GetAchievementRequest struct { ID int64 `json:"-"` }
DeleteAchievementRequest struct { ID int64 `json:"-"` }
UploadProfileImageRequest struct { AccountID int64 File *multipart.FileHeader3 unmodified lines URL string `json:"url"` }
ProgressResponse struct { GetProgressCVRequest struct { AccountID int64 `json:"-"` }
GetProgressCVResponse struct { AccountDetailsProgress float64 `json:"account_details_progress"` PersonalityAndPreferenceCVProgress float64 `json:"personality_and_preference_cv_progress"` FamilyMemberCVProgress float64 `json:"family_member_cv_progress"`5 unmodified lines TotalProgress float64 `json:"total_progress"` })
type SaveMarriageReadinessProfileRequest struct { AccountID int64 `json:"account_id"`
// Visi Misi Rumah Tangga MarriageVision *string `gorm:"column:marriage_vision" json:"marriage_vision"` // Apa visi dan tujuan utama kamu dalam membangun rumah tangga? LivingPlan *string `gorm:"column:living_plan" json:"living_plan"` // Setelah menikah, kamu berencana tinggal di mana? SpouseRoles *string `gorm:"column:spouse_roles" json:"spouse_roles"` // Menurutmu, apa peran utama suami dan istri dalam rumah tangga? SpouseRights *string `gorm:"column:spouse_rights" json:"spouse_rights"` // Apa saja hak suami dan istri menurutmu? ConflictResolution *string `gorm:"column:conflict_resolution" json:"conflict_resolution"` // Jika terjadi konflik, bagaimana kamu menyikapinya? ParentingStyle *string `gorm:"column:parenting_style" json:"parenting_style"` // Setelah punya anak, pola pengasuhan seperti apa yang kamu inginkan?
// Konsep Acara Pernikahan ReadyToMarryDuration *string `gorm:"column:ready_to_marry_duration" json:"ready_to_marry_duration"` // Setelah taaruf dimulai, berapa lama kamu butuh untuk siap menikah? WeddingConcept *string `gorm:"column:wedding_concept" json:"wedding_concept"` // Seperti apa konsep pernikahan yang kamu harapkan? WeddingFunding *string `gorm:"column:wedding_funding" json:"wedding_funding"` // Apakah kamu sudah mempersiapkan dana pernikahan? Dari mana sumbernya?
// Karir Kedepannya CareerAfterMarriage *string `gorm:"column:career_after_marriage" json:"career_after_marriage"` // Apakah kamu ingin tetap bekerja setelah menikah? TimeManagement *string `gorm:"column:time_management" json:"time_management"` // Bagaimana kamu membagi waktu antara keluarga, ibadah, dan pekerjaan? CareerGoals *string `gorm:"column:career_goals" json:"career_goals"` // Apa impian karier atau cita-cita kamu dalam 5 sampai 10 tahun ke depan? SelfDevelopment *string `gorm:"column:self_development" json:"self_development"` // Apa usaha kamu untuk terus mengembangkan diri dan skill?
// Pendidikan Keluarga DelayChildren *string `gorm:"column:delay_children" json:"delay_children"` // Apakah kamu berencana menunda memiliki anak? ChildEducationPlan *string `gorm:"column:child_education_plan" json:"child_education_plan"` // Apakah kamu sudah punya rencana pendidikan anak? ReligiousEmotionalBond *string `gorm:"column:religious_emotional_bond" json:"religious_emotional_bond"` // Bagaimana cara menjaga nilai agama & kedekatan emosional dengan anak? ParentingChallenges *string `gorm:"column:parenting_challenges" json:"parenting_challenges"` // Saat menghadapi tantangan pengasuhan, bagaimana kamu menyikapinya?
// Finansial Keluarga MonthlyFinance *string `gorm:"column:monthly_finance" json:"monthly_finance"` // Bagaimana kamu mengelola keuangan bulanan? FamilyResponsibility *string `gorm:"column:family_responsibility" json:"family_responsibility"` // Apakah kamu masih punya tanggungan keluarga setelah menikah? DebtStatus *string `gorm:"column:debt_status" json:"debt_status"` // Apakah kamu punya cicilan/utang setelah menikah? FinanceSharing *string `gorm:"column:finance_sharing" json:"finance_sharing"` // Setelah menikah, bagaimana pembagian tanggung jawab keuangan? IncomeGapView *string `gorm:"column:income_gap_view" json:"income_gap_view"` // Pandangan kamu jika istri berpenghasilan lebih besar dari suami?
// Keputusan dan Komunikasi DecisionMaking *string `gorm:"column:decision_making" json:"decision_making"` // Dalam mengambil keputusan, kamu lebih mempertimbangkan pasangan atau sendiri? GrowthTogether *string `gorm:"column:growth_together" json:"growth_together"` // Apakah kamu siap berjuang bersama pasangan? Apa saja yang ingin diperjuangkan? ParentIntervention *string `gorm:"column:parent_intervention" json:"parent_intervention"` // Sejauh mana orang tua/mertua boleh ikut campur dalam rumah tangga? HabitResponse *string `gorm:"column:habit_response" json:"habit_response"` // Bagaimana kamu menyikapi kebiasaan pasangan yang kurang kamu sukai?}
type GetMarriageReadinessProfileRequest struct { AccountID int64 `json:"-"`}2 unmodified lines3456789120 unmodified lines1301311321331341351361371381391401418 unmodified lines1501511521501531541551561571581591601611621631642 unmodified linesimport ( "errors" "fmt" "reflect" "strings"
"github.com/go-playground/locales/en"120 unmodified lines if validatorInstance == nil { return []ErrorMessage{{Field: "", Message: "Validator belum diinisialisasi. Panggil validation.New() terlebih dahulu."}} }
err := validatorInstance.validate.Struct(s) if err != nil { return TranslateError(err) }
return nil}
8 unmodified lines return nil }
errorMessages := make([]ErrorMessage, 0, len(validationErrors)) var errorMessages []ErrorMessage
for _, e := range validationErrors { fieldLabel := e.Field()
if e.Kind() == reflect.Ptr { continue }
msg, err := validatorInstance.translator.T(e.Tag(), fieldLabel) if err != nil { msg = fieldLabel + " is Invalid"123445679811910111213141547 unmodified lines636465656667686970717273727374757677package worker
import ( "api.qobiltu.id/assets" "bytes" "context" "encoding/json" "fmt" "github.com/hibiken/asynq" "html/template" "log/slog" "time"
"api.qobiltu.id/assets" "github.com/hibiken/asynq")
const (47 unmodified lines } htmlContent := body.String()
slog.Info("Sending forgot password email", slog.String("email", payload.EmailAddress)) fmt.Println("Sending forgot password email", payload.EmailAddress) start := time.Now()
err = p.emailSender.Send(payload.EmailAddress, payload.Subject, htmlContent, payload) if err != nil { return fmt.Errorf("failed to send forgot password email: %w", err) }
slog.Info("Forgot password email sent successfully", slog.String("email", payload.EmailAddress))
fmt.Println("Forgot password email sent successfully", payload.EmailAddress) fmt.Println("Time taken", time.Since(start)) return nil}123445679811910111213141547 unmodified lines636465656667686970717273727475767778package worker
import ( "api.qobiltu.id/assets" "bytes" "context" "encoding/json" "fmt" "github.com/hibiken/asynq" "html/template" "log/slog" "time"
"api.qobiltu.id/assets" "github.com/hibiken/asynq")
const (47 unmodified lines } htmlContent := body.String()
slog.Info("Sending verification email", slog.String("email", payload.EmailAddress)) fmt.Println("Sending verification email", payload.EmailAddress) start := time.Now()
err = p.emailSender.Send(payload.EmailAddress, payload.Subject, htmlContent, payload) if err != nil { return fmt.Errorf("failed to send verify email: %w", err) }
slog.Info("Verification email sent successfully", slog.String("email", payload.EmailAddress)) fmt.Println("Verification email sent successfully", payload.EmailAddress) fmt.Println("Time taken", time.Since(start))
return nil}41 unmodified lines4243444545464741 unmodified lines routerGroup.PUT("/achievements/:id", s.cvController.UpdateAchievement) routerGroup.DELETE("/achievements/:id", s.cvController.DeleteAchievement)
routerGroup.GET("/progress", s.cvController.GetProgress) routerGroup.GET("/progress", s.cvController.GetProgressCV) }}17 unmodified lines18192021222317 unmodified lines // another way to register routes s.HealthCheckRoute() s.CVRoute() s.MarriageReadinessProfileRoute() s.StorageRoute()}1 unmodified line2345567891010111211121314151617181920212223242526242526272829303132331 unmodified line
import ( cv_controller "api.qobiltu.id/controller/cv" "api.qobiltu.id/controller/health_check" health_check_controller "api.qobiltu.id/controller/health_check" marriage_readiness_profile_controller "api.qobiltu.id/controller/marriage_readiness_profile" "github.com/gin-gonic/gin")
type Server struct { router *gin.Engine healthCheckController health_check_controller.HealthCheckController cvController cv_controller.CVController router *gin.Engine healthCheckController health_check_controller.HealthCheckController cvController cv_controller.CVController marriageReadinessProfileController marriage_readiness_profile_controller.MarriageReadinessProfileController}
func NewServer( healthCheckController health_check_controller.HealthCheckController, cvController cv_controller.CVController, marriageReadinessProfileController marriage_readiness_profile_controller.MarriageReadinessProfileController,) (*Server, error) {
router := gin.Default() router.Use(gin.Recovery())
server := &Server{ healthCheckController: healthCheckController, cvController: cvController, router: router, healthCheckController: healthCheckController, cvController: cvController, marriageReadinessProfileController: marriageReadinessProfileController, router: router, }
server.setupRoutes()10 unmodified lines111213141516171818192021222324252627282930313233343536373839404142434445464748495051521920212223242526272829303132333435363738394041424344454647484950515253545555565758598 unmodified lines6869707071727374757610 unmodified lines8788898788899091929394909192939495969798991001019 unmodified lines11111211311011111411511611311711811912012111812212312412510 unmodified lines1361371381351361371381391401411421431441451461471481391401411421431441451461471481491501511521531541551563 unmodified lines1601611621581591631641651661671 unmodified line16917017116717217317417512 unmodified lines1881891901861911921931941951961921931971981991952002012022032042002012052062072032082092102112122082092132142152112162172182192202162212222232242252212262272232282292302262272282292302312312322332342352362372382392352402412422432442452412462472482491 unmodified line2512522532492542552562573 unmodified lines2612622632592602612622632642652662642652662672682692702712722732742752762712772782792802812822772782832842852802862872882892902852912922932941 unmodified line2962972982932993003013023 unmodified lines3063073083033043053063073083093103113123133143153163173093103113123133143153163173183193203213223233243253263274 unmodified lines3323333343283293353363373313383393403413423363433443453469 unmodified lines3563573583523593603613623633643583653663673683693633703713653723733743683693703713723753763773783793803813823763833843853863873813823883893903913853863923933943883953963973983993933944004014024033974044054064078 unmodified lines41641741841241942042142242341742442542642742842242943042443143243342742842943043143443543643743843944044143544244344444544644044144744844945044444545145245344745445545645745845245345946046146245646346446546646746846946347047147247347447546947047647747847247948048148248348448547948648748848949049148548649249349449548949049649749849249950050150250349749850450550650750867 unmodified lines5765775785725735795805815825831 unmodified line5855865875815885895905911 unmodified line5935945955895965975985991 unmodified line6016026035976046056066071 unmodified line60961061160561261361461561661061761861962062161562262362462562662062762862963021 unmodified lines65265365464865565665065765865966013 unmodified lines67467567667067767867968010 unmodified lines "api.qobiltu.id/pkg/validation" "api.qobiltu.id/repositories" "api.qobiltu.id/response" "api.qobiltu.id/utils" "gorm.io/gorm")
type CVService interface { SaveAccountDetails(ctx context.Context, req *models.AccountDetailsRequest) (*models.AccountDetails, error) GetAccountDetails(ctx context.Context, id int64) (*models.AccountDetails, error)
SavePersonalityAndPreference(ctx context.Context, req *models.PersonalityAndPreferenceCVRequest) (*models.PersonalityAndPreferenceCV, error) GetPersonalityAndPreference(ctx context.Context, id int64) (*models.PersonalityAndPreferenceCV, error)
CreateFamilyMember(ctx context.Context, req *models.FamilyMemberRequest) (*models.FamilyMemberCV, error) UpdateFamilyMember(ctx context.Context, id int64, req *models.FamilyMemberRequest) (*models.FamilyMemberCV, error) ListFamilyMember(ctx context.Context, accountID int64) ([]models.FamilyMemberCV, error) GetFamilyMember(ctx context.Context, id int64) (*models.FamilyMemberCV, error) DeleteFamilyMember(ctx context.Context, id int64) error
SavePhysicalAndHealth(ctx context.Context, req *models.PhysicalAndHealthRequest) (*models.PhysicalAndHealthCV, error) GetPhysicalAndHealth(ctx context.Context, id int64) (*models.PhysicalAndHealthCV, error)
SaveWorshipAndReligiousUnderstanding(ctx context.Context, req *models.WorshipAndReligiousUnderstandingRequest) (*models.WorshipAndReligiousUnderstandingCV, error) GetWorshipAndReligiousUnderstanding(ctx context.Context, id int64) (*models.WorshipAndReligiousUnderstandingCV, error)
CreateEducation(ctx context.Context, req *models.EducationRequest) (*models.EducationCV, error) UpdateEducation(ctx context.Context, id int64, req *models.EducationRequest) (*models.EducationCV, error) ListEducation(ctx context.Context, accountID int64) ([]models.EducationCV, error) GetEducation(ctx context.Context, id int64) (*models.EducationCV, error) DeleteEducation(ctx context.Context, id int64) error
CreateJob(ctx context.Context, req *models.JobRequest) (*models.JobCV, error) UpdateJob(ctx context.Context, id int64, req *models.JobRequest) (*models.JobCV, error) ListJob(ctx context.Context, accountID int64) ([]models.JobCV, error) GetJob(ctx context.Context, id int64) (*models.JobCV, error) DeleteJob(ctx context.Context, id int64) error
CreateAchievement(ctx context.Context, req *models.AchievementRequest) (*models.AchievementCV, error) UpdateAchievement(ctx context.Context, id int64, req *models.AchievementRequest) (*models.AchievementCV, error) ListAchievement(ctx context.Context, accountID int64) ([]models.AchievementCV, error) GetAchievement(ctx context.Context, id int64) (*models.AchievementCV, error) DeleteAchievement(ctx context.Context, id int64) error SaveAccountDetails(ctx context.Context, req *models.SaveAccountDetailsRequest) (*models.AccountDetails, error) GetAccountDetails(ctx context.Context, req *models.GetAccountDetailsRequest) (*models.AccountDetails, error)
SavePersonalityAndPreference(ctx context.Context, req *models.SavePersonalityAndPreferenceRequest) (*models.PersonalityAndPreferenceCV, error) GetPersonalityAndPreference(ctx context.Context, req *models.GetPersonalityAndPreferenceRequest) (*models.PersonalityAndPreferenceCV, error)
CreateFamilyMember(ctx context.Context, req *models.CreateFamilyMemberRequest) (*models.FamilyMemberCV, error) UpdateFamilyMember(ctx context.Context, req *models.UpdateFamilyMemberRequest) (*models.FamilyMemberCV, error) ListFamilyMember(ctx context.Context, req *models.ListFamilyMemberRequest) ([]models.FamilyMemberCV, error) GetFamilyMember(ctx context.Context, req *models.GetFamilyMemberRequest) (*models.FamilyMemberCV, error) DeleteFamilyMember(ctx context.Context, req *models.DeleteFamilyMemberRequest) error
SavePhysicalAndHealth(ctx context.Context, req *models.SavePhysicalAndHealthRequest) (*models.PhysicalAndHealthCV, error) GetPhysicalAndHealth(ctx context.Context, req *models.GetPhysicalAndHealthRequest) (*models.PhysicalAndHealthCV, error)
SaveWorshipAndReligiousUnderstanding(ctx context.Context, req *models.SaveWorshipAndReligiousUnderstandingRequest) (*models.WorshipAndReligiousUnderstandingCV, error) GetWorshipAndReligiousUnderstanding(ctx context.Context, req *models.GetWorshipAndReligiousUnderstandingRequest) (*models.WorshipAndReligiousUnderstandingCV, error)
CreateEducation(ctx context.Context, req *models.CreateEducationRequest) (*models.EducationCV, error) UpdateEducation(ctx context.Context, req *models.UpdateEducationRequest) (*models.EducationCV, error) ListEducation(ctx context.Context, req *models.ListEducationRequest) ([]models.EducationCV, error) GetEducation(ctx context.Context, req *models.GetEducationRequest) (*models.EducationCV, error) DeleteEducation(ctx context.Context, req *models.DeleteEducationRequest) error
CreateJob(ctx context.Context, req *models.CreateJobRequest) (*models.JobCV, error) UpdateJob(ctx context.Context, req *models.UpdateJobRequest) (*models.JobCV, error) ListJob(ctx context.Context, req *models.ListJobRequest) ([]models.JobCV, error) GetJob(ctx context.Context, req *models.GetJobRequest) (*models.JobCV, error) DeleteJob(ctx context.Context, req *models.DeleteJobRequest) error
CreateAchievement(ctx context.Context, req *models.CreateAchievementRequest) (*models.AchievementCV, error) UpdateAchievement(ctx context.Context, req *models.UpdateAchievementRequest) (*models.AchievementCV, error) ListAchievement(ctx context.Context, req *models.ListAchievementRequest) ([]models.AchievementCV, error) GetAchievement(ctx context.Context, req *models.GetAchievementRequest) (*models.AchievementCV, error) DeleteAchievement(ctx context.Context, req *models.DeleteAchievementRequest) error
UploadProfileImage(ctx context.Context, req *models.UploadProfileImageRequest) (*models.UploadProfileImageResponse, error) GetProgress(ctx context.Context, accountID int64) (*models.ProgressResponse, error) GetProgressCV(ctx context.Context, req *models.GetProgressCVRequest) (*models.GetProgressCVResponse, error)}
type cvService struct {8 unmodified lines }}
func (s *cvService) SaveAccountDetails(ctx context.Context, req *models.AccountDetailsRequest) (*models.AccountDetails, error) {func (s *cvService) SaveAccountDetails(ctx context.Context, req *models.SaveAccountDetailsRequest) (*models.AccountDetails, error) { // notes // jika ingin mengubah value wajib kirimkan field beserta value nya if err := validation.Validate(req); err != nil { return nil, response.HandleValidationError(err) }10 unmodified lines }
accountDetails.AccountID = uint(req.AccountID) accountDetails.FullName = req.FullName accountDetails.Gender = req.Gender accountDetails.DateOfBirth = req.DateOfBirth accountDetails.PlaceOfBirth = req.PlaceOfBirth accountDetails.Domicile = req.Domicile accountDetails.MaritalStatus = req.MaritalStatus accountDetails.LastEducation = req.LastEducation accountDetails.LastJob = req.LastJob
utils.AssignIfNotNil(&accountDetails.FullName, req.FullName) utils.AssignIfNotNil(&accountDetails.Gender, req.Gender) utils.AssignIfNotNil(&accountDetails.DateOfBirth, req.DateOfBirth) utils.AssignIfNotNil(&accountDetails.PlaceOfBirth, req.PlaceOfBirth) utils.AssignIfNotNil(&accountDetails.Domicile, req.Domicile) utils.AssignIfNotNil(&accountDetails.MaritalStatus, req.MaritalStatus) utils.AssignIfNotNil(&accountDetails.LastEducation, req.LastEducation) utils.AssignIfNotNil(&accountDetails.LastJob, req.LastJob)
if req.PhoneNumber != nil { sanitizedPhone := validation.SanitizePhoneNumber(*req.PhoneNumber)9 unmodified lines return res, nil}
func (s *cvService) GetAccountDetails(ctx context.Context, id int64) (*models.AccountDetails, error) { res, err := s.cvRepository.GetAccountDetailsByAccountID(ctx, id)func (s *cvService) GetAccountDetails(ctx context.Context, req *models.GetAccountDetailsRequest) (*models.AccountDetails, error) { res, err := s.cvRepository.GetAccountDetailsByAccountID(ctx, req.AccountID) if err != nil { return nil, response.HandleGormError(err, "Data diri tidak ditemukan") return nil, response.HandleGormError(err, "Internal Server Error") } return res, nil}
func (s *cvService) SavePersonalityAndPreference(ctx context.Context, req *models.PersonalityAndPreferenceCVRequest) (*models.PersonalityAndPreferenceCV, error) {func (s *cvService) SavePersonalityAndPreference(ctx context.Context, req *models.SavePersonalityAndPreferenceRequest) (*models.PersonalityAndPreferenceCV, error) { if err := validation.Validate(req); err != nil { return nil, response.HandleValidationError(err) }10 unmodified lines }
personalityAndPreference.AccountID = req.AccountID personalityAndPreference.PositiveTraits = req.PositiveTraits personalityAndPreference.NegativeTraits = req.NegativeTraits personalityAndPreference.Hobbies = req.Hobbies personalityAndPreference.LifeGoals = req.LifeGoals personalityAndPreference.DailyActivities = req.DailyActivities personalityAndPreference.LeisureActivities = req.LeisureActivities personalityAndPreference.Likes = req.Likes personalityAndPreference.Dislikes = req.Dislikes personalityAndPreference.StressHandling = req.StressHandling personalityAndPreference.AngerTriggers = req.AngerTriggers personalityAndPreference.FavoriteFoodAndDrinks = req.FavoriteFoodAndDrinks personalityAndPreference.CanCook = req.CanCook personalityAndPreference.TypesOfDishesCooked = req.TypesOfDishesCooked personalityAndPreference.MonthlyExpenses = req.MonthlyExpenses
utils.AssignIfNotNil(&personalityAndPreference.PositiveTraits, req.PositiveTraits) utils.AssignIfNotNil(&personalityAndPreference.NegativeTraits, req.NegativeTraits) utils.AssignIfNotNil(&personalityAndPreference.Hobbies, req.Hobbies) utils.AssignIfNotNil(&personalityAndPreference.LifeGoals, req.LifeGoals) utils.AssignIfNotNil(&personalityAndPreference.DailyActivities, req.DailyActivities) utils.AssignIfNotNil(&personalityAndPreference.LeisureActivities, req.LeisureActivities) utils.AssignIfNotNil(&personalityAndPreference.Likes, req.Likes) utils.AssignIfNotNil(&personalityAndPreference.Dislikes, req.Dislikes) utils.AssignIfNotNil(&personalityAndPreference.StressHandling, req.StressHandling) utils.AssignIfNotNil(&personalityAndPreference.AngerTriggers, req.AngerTriggers) utils.AssignIfNotNil(&personalityAndPreference.FavoriteFoodAndDrinks, req.FavoriteFoodAndDrinks) utils.AssignIfNotNil(&personalityAndPreference.CanCook, req.CanCook) utils.AssignIfNotNil(&personalityAndPreference.TypesOfDishesCooked, req.TypesOfDishesCooked) utils.AssignIfNotNil(&personalityAndPreference.MonthlyExpenses, req.MonthlyExpenses)
res, err := s.cvRepository.SavePersonalityAndPreference(ctx, personalityAndPreference) if err != nil {3 unmodified lines return res, nil}
func (s *cvService) GetPersonalityAndPreference(ctx context.Context, id int64) (*models.PersonalityAndPreferenceCV, error) { res, err := s.cvRepository.GetPersonalityAndPreferenceByAccountID(ctx, id)func (s *cvService) GetPersonalityAndPreference(ctx context.Context, req *models.GetPersonalityAndPreferenceRequest) (*models.PersonalityAndPreferenceCV, error) { res, err := s.cvRepository.GetPersonalityAndPreferenceByAccountID(ctx, req.AccountID) if err != nil { return nil, response.HandleGormError(err, "Internal Server Error") }1 unmodified line return res, nil}
func (s *cvService) CreateFamilyMember(ctx context.Context, req *models.FamilyMemberRequest) (*models.FamilyMemberCV, error) {func (s *cvService) CreateFamilyMember(ctx context.Context, req *models.CreateFamilyMemberRequest) (*models.FamilyMemberCV, error) { if err := validation.Validate(req); err != nil { return nil, response.HandleValidationError(err) }12 unmodified lines // Simpan ke repository res, err := s.cvRepository.SaveFamilyMember(ctx, familyMember) if err != nil { return nil, response.HandleGormError(err, "Gagal menyimpan anggota keluarga") return nil, response.HandleGormError(err, "Internal Server Error") }
return res, nil}
func (s *cvService) ListFamilyMember(ctx context.Context, accountID int64) ([]models.FamilyMemberCV, error) { list, err := s.cvRepository.ListFamilyMember(ctx, accountID)func (s *cvService) ListFamilyMember(ctx context.Context, req *models.ListFamilyMemberRequest) ([]models.FamilyMemberCV, error) { list, err := s.cvRepository.ListFamilyMember(ctx, req.AccountID) if err != nil { return nil, response.HandleGormError(err, "Gagal mengambil daftar anggota keluarga") return nil, response.HandleGormError(err, "Internal Server Error") } return list, nil}
func (s *cvService) GetFamilyMember(ctx context.Context, id int64) (*models.FamilyMemberCV, error) { res, err := s.cvRepository.GetFamilyMember(ctx, id)func (s *cvService) GetFamilyMember(ctx context.Context, req *models.GetFamilyMemberRequest) (*models.FamilyMemberCV, error) { res, err := s.cvRepository.GetFamilyMember(ctx, req.ID) if err != nil { return nil, response.HandleGormError(err, "Data anggota keluarga tidak ditemukan") return nil, response.HandleGormError(err, "Internal Server Error") } return res, nil}
func (s *cvService) DeleteFamilyMember(ctx context.Context, id int64) error { err := s.cvRepository.DeleteFamilyMember(ctx, id)func (s *cvService) DeleteFamilyMember(ctx context.Context, req *models.DeleteFamilyMemberRequest) error { err := s.cvRepository.DeleteFamilyMember(ctx, req.ID) if err != nil { return response.HandleGormError(err, "Gagal menghapus anggota keluarga") return response.HandleGormError(err, "Internal Server Error") } return nil}
func (s *cvService) UpdateFamilyMember(ctx context.Context, id int64, req *models.FamilyMemberRequest) (*models.FamilyMemberCV, error) {func (s *cvService) UpdateFamilyMember(ctx context.Context, req *models.UpdateFamilyMemberRequest) (*models.FamilyMemberCV, error) { if err := validation.Validate(req); err != nil { return nil, response.HandleValidationError(err) }
existing, err := s.cvRepository.GetFamilyMember(ctx, id) existing, err := s.cvRepository.GetFamilyMember(ctx, req.ID) if err != nil { return nil, response.HandleGormError(err, "Data anggota keluarga tidak ditemukan") return nil, response.HandleGormError(err, "Internal Server Error") }
existing.Role = req.Role existing.Status = req.Status existing.Religion = req.Religion existing.Job = req.Job existing.LastEducation = req.LastEducation existing.Age = req.Age utils.AssignIfNotNil(&existing.Role, req.Role) utils.AssignIfNotNil(&existing.Status, req.Status) utils.AssignIfNotNil(&existing.Religion, req.Religion) utils.AssignIfNotNil(&existing.Job, req.Job) utils.AssignIfNotNil(&existing.LastEducation, req.LastEducation) utils.AssignIfNotNil(&existing.Age, req.Age)
updated, err := s.cvRepository.SaveFamilyMember(ctx, existing) if err != nil { return nil, response.HandleGormError(err, "Gagal memperbarui anggota keluarga") return nil, response.HandleGormError(err, "Internal Server Error") }
return updated, nil}
func (s *cvService) SavePhysicalAndHealth(ctx context.Context, req *models.PhysicalAndHealthRequest) (*models.PhysicalAndHealthCV, error) {func (s *cvService) SavePhysicalAndHealth(ctx context.Context, req *models.SavePhysicalAndHealthRequest) (*models.PhysicalAndHealthCV, error) { if err := validation.Validate(req); err != nil { return nil, response.HandleValidationError(err) }1 unmodified line // Cek apakah data sudah ada berdasarkan account_id existing, err := s.cvRepository.GetPhysicalAndHealthByAccountID(ctx, req.AccountID) if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { return nil, response.HandleGormError(err, "Terjadi kesalahan saat mengambil data fisik dan kesehatan") return nil, response.HandleGormError(err, "Internal Server Error") }
// Jika belum ada, buat objek baru3 unmodified lines
// Mapping field dari request existing.AccountID = req.AccountID existing.HeightInCm = req.HeightInCm existing.WeightInKg = req.WeightInKg existing.BodyShape = req.BodyShape existing.SkinColor = req.SkinColor existing.HairType = req.HairType existing.MedicalHistory = req.MedicalHistory existing.PhysicalDisorder = req.PhysicalDisorder existing.PhysicalTraits = req.PhysicalTraits
utils.AssignIfNotNil(&existing.HeightInCm, req.HeightInCm) utils.AssignIfNotNil(&existing.WeightInKg, req.WeightInKg) utils.AssignIfNotNil(&existing.BodyShape, req.BodyShape) utils.AssignIfNotNil(&existing.SkinColor, req.SkinColor) utils.AssignIfNotNil(&existing.HairType, req.HairType) utils.AssignIfNotNil(&existing.MedicalHistory, req.MedicalHistory) utils.AssignIfNotNil(&existing.PhysicalDisorder, req.PhysicalDisorder) utils.AssignIfNotNil(&existing.PhysicalTraits, req.PhysicalTraits)
// Simpan data res, err := s.cvRepository.SavePhysicalAndHealth(ctx, existing) if err != nil { return nil, response.HandleGormError(err, "Gagal menyimpan data fisik dan kesehatan") return nil, response.HandleGormError(err, "Internal Server Error") }
return res, nil}
func (s *cvService) GetPhysicalAndHealth(ctx context.Context, id int64) (*models.PhysicalAndHealthCV, error) { res, err := s.cvRepository.GetPhysicalAndHealthByAccountID(ctx, id)func (s *cvService) GetPhysicalAndHealth(ctx context.Context, req *models.GetPhysicalAndHealthRequest) (*models.PhysicalAndHealthCV, error) { res, err := s.cvRepository.GetPhysicalAndHealthByAccountID(ctx, req.AccountID) if err != nil { return nil, response.HandleGormError(err, "Data fisik dan kesehatan tidak ditemukan") return nil, response.HandleGormError(err, "Internal Server Error") } return res, nil}
func (s *cvService) SaveWorshipAndReligiousUnderstanding(ctx context.Context, req *models.WorshipAndReligiousUnderstandingRequest) (*models.WorshipAndReligiousUnderstandingCV, error) {func (s *cvService) SaveWorshipAndReligiousUnderstanding(ctx context.Context, req *models.SaveWorshipAndReligiousUnderstandingRequest) (*models.WorshipAndReligiousUnderstandingCV, error) { if err := validation.Validate(req); err != nil { return nil, response.HandleValidationError(err) }1 unmodified line // Cek apakah data sudah ada berdasarkan account_id worshipAndReligiousUnderstanding, err := s.cvRepository.GetWorshipAndReligiousUnderstandingByAccountID(ctx, req.AccountID) if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { return nil, response.HandleGormError(err, "Terjadi kesalahan saat mengambil data agama dan pemahaman agama") return nil, response.HandleGormError(err, "Internal Server Error") }
// Jika belum ada, buat objek baru3 unmodified lines
// Mapping field dari request worshipAndReligiousUnderstanding.AccountID = req.AccountID worshipAndReligiousUnderstanding.ObligatoryPrayer = req.ObligatoryPrayer worshipAndReligiousUnderstanding.CongregationalPrayer = req.CongregationalPrayer worshipAndReligiousUnderstanding.TahajjudPrayer = req.TahajjudPrayer worshipAndReligiousUnderstanding.DhuhaPrayer = req.DhuhaPrayer worshipAndReligiousUnderstanding.QuranMemorization = req.QuranMemorization worshipAndReligiousUnderstanding.QuranReadingAbility = req.QuranReadingAbility worshipAndReligiousUnderstanding.DaudFasting = req.DaudFasting worshipAndReligiousUnderstanding.AyyamulBidhFasting = req.AyyamulBidhFasting worshipAndReligiousUnderstanding.HajjOrUmrah = req.HajjOrUmrah worshipAndReligiousUnderstanding.ListeningToMusic = req.ListeningToMusic worshipAndReligiousUnderstanding.OpinionOnIkhtilat = req.OpinionOnIkhtilat worshipAndReligiousUnderstanding.OpinionOnTouchingNonMahram = req.OpinionOnTouchingNonMahram worshipAndReligiousUnderstanding.OpinionOnVeil = req.OpinionOnVeil worshipAndReligiousUnderstanding.WeeklyReligiousStudies = req.WeeklyReligiousStudies worshipAndReligiousUnderstanding.FollowedUstadz = req.FollowedUstadz
utils.AssignIfNotNil(&worshipAndReligiousUnderstanding.ObligatoryPrayer, req.ObligatoryPrayer) utils.AssignIfNotNil(&worshipAndReligiousUnderstanding.CongregationalPrayer, req.CongregationalPrayer) utils.AssignIfNotNil(&worshipAndReligiousUnderstanding.TahajjudPrayer, req.TahajjudPrayer) utils.AssignIfNotNil(&worshipAndReligiousUnderstanding.DhuhaPrayer, req.DhuhaPrayer) utils.AssignIfNotNil(&worshipAndReligiousUnderstanding.QuranMemorization, req.QuranMemorization) utils.AssignIfNotNil(&worshipAndReligiousUnderstanding.QuranReadingAbility, req.QuranReadingAbility) utils.AssignIfNotNil(&worshipAndReligiousUnderstanding.DaudFasting, req.DaudFasting) utils.AssignIfNotNil(&worshipAndReligiousUnderstanding.AyyamulBidhFasting, req.AyyamulBidhFasting) utils.AssignIfNotNil(&worshipAndReligiousUnderstanding.HajjOrUmrah, req.HajjOrUmrah) utils.AssignIfNotNil(&worshipAndReligiousUnderstanding.ListeningToMusic, req.ListeningToMusic) utils.AssignIfNotNil(&worshipAndReligiousUnderstanding.OpinionOnIkhtilat, req.OpinionOnIkhtilat) utils.AssignIfNotNil(&worshipAndReligiousUnderstanding.OpinionOnTouchingNonMahram, req.OpinionOnTouchingNonMahram) utils.AssignIfNotNil(&worshipAndReligiousUnderstanding.OpinionOnVeil, req.OpinionOnVeil) utils.AssignIfNotNil(&worshipAndReligiousUnderstanding.WeeklyReligiousStudies, req.WeeklyReligiousStudies) utils.AssignIfNotNil(&worshipAndReligiousUnderstanding.FollowedUstadz, req.FollowedUstadz)
// Simpan data res, err := s.cvRepository.SaveWorshipAndReligiousUnderstanding(ctx, worshipAndReligiousUnderstanding)4 unmodified lines return res, nil}
func (s *cvService) GetWorshipAndReligiousUnderstanding(ctx context.Context, id int64) (*models.WorshipAndReligiousUnderstandingCV, error) { res, err := s.cvRepository.GetWorshipAndReligiousUnderstandingByAccountID(ctx, id)func (s *cvService) GetWorshipAndReligiousUnderstanding(ctx context.Context, req *models.GetWorshipAndReligiousUnderstandingRequest) (*models.WorshipAndReligiousUnderstandingCV, error) { res, err := s.cvRepository.GetWorshipAndReligiousUnderstandingByAccountID(ctx, req.AccountID) if err != nil { return nil, response.HandleGormError(err, "Data agama dan pemahaman agama tidak ditemukan") return nil, response.HandleGormError(err, "Internal Server Error") } return res, nil}
func (s *cvService) CreateEducation(ctx context.Context, req *models.EducationRequest) (*models.EducationCV, error) {func (s *cvService) CreateEducation(ctx context.Context, req *models.CreateEducationRequest) (*models.EducationCV, error) { if err := validation.Validate(req); err != nil { return nil, response.HandleValidationError(err) }9 unmodified lines
res, err := s.cvRepository.SaveEducation(ctx, edu) if err != nil { return nil, response.HandleGormError(err, "Gagal menambahkan data pendidikan") return nil, response.HandleGormError(err, "Internal Server Error") }
return res, nil}
func (s *cvService) UpdateEducation(ctx context.Context, id int64, req *models.EducationRequest) (*models.EducationCV, error) {func (s *cvService) UpdateEducation(ctx context.Context, req *models.UpdateEducationRequest) (*models.EducationCV, error) { if err := validation.Validate(req); err != nil { return nil, response.HandleValidationError(err) }
edu, err := s.cvRepository.GetEducation(ctx, id) edu, err := s.cvRepository.GetEducation(ctx, req.ID) if err != nil { return nil, response.HandleGormError(err, "Data pendidikan tidak ditemukan") return nil, response.HandleGormError(err, "Internal Server Error") }
edu.LastEducation = req.LastEducation edu.EducationInstitute = req.EducationInstitute edu.EducationMajor = req.EducationMajor edu.YearStart = req.YearStart edu.YearGraduate = req.YearGraduate utils.AssignIfNotNil(&edu.LastEducation, req.LastEducation) utils.AssignIfNotNil(&edu.EducationInstitute, req.EducationInstitute) utils.AssignIfNotNil(&edu.EducationMajor, req.EducationMajor) utils.AssignIfNotNil(&edu.YearStart, req.YearStart) utils.AssignIfNotNil(&edu.YearGraduate, req.YearGraduate)
res, err := s.cvRepository.SaveEducation(ctx, edu) if err != nil { return nil, response.HandleGormError(err, "Gagal memperbarui data pendidikan") return nil, response.HandleGormError(err, "Internal Server Error") } return res, nil}
func (s *cvService) ListEducation(ctx context.Context, accountID int64) ([]models.EducationCV, error) { return s.cvRepository.ListEducation(ctx, accountID)func (s *cvService) ListEducation(ctx context.Context, req *models.ListEducationRequest) ([]models.EducationCV, error) { return s.cvRepository.ListEducation(ctx, req.AccountID)}
func (s *cvService) GetEducation(ctx context.Context, id int64) (*models.EducationCV, error) { edu, err := s.cvRepository.GetEducation(ctx, id)func (s *cvService) GetEducation(ctx context.Context, req *models.GetEducationRequest) (*models.EducationCV, error) { edu, err := s.cvRepository.GetEducation(ctx, req.ID) if err != nil { return nil, response.HandleGormError(err, "Data pendidikan tidak ditemukan") return nil, response.HandleGormError(err, "Internal Server Error") } return edu, nil}
func (s *cvService) DeleteEducation(ctx context.Context, id int64) error { return s.cvRepository.DeleteEducation(ctx, id)func (s *cvService) DeleteEducation(ctx context.Context, req *models.DeleteEducationRequest) error { return s.cvRepository.DeleteEducation(ctx, req.ID)}
func (s *cvService) CreateJob(ctx context.Context, req *models.JobRequest) (*models.JobCV, error) {func (s *cvService) CreateJob(ctx context.Context, req *models.CreateJobRequest) (*models.JobCV, error) { if err := validation.Validate(req); err != nil { return nil, response.HandleValidationError(err) }8 unmodified lines } res, err := s.cvRepository.SaveJob(ctx, job) if err != nil { return nil, response.HandleGormError(err, "Gagal menambahkan data pekerjaan") return nil, response.HandleGormError(err, "Internal Server Error") } return res, nil}
func (s *cvService) UpdateJob(ctx context.Context, id int64, req *models.JobRequest) (*models.JobCV, error) {func (s *cvService) UpdateJob(ctx context.Context, req *models.UpdateJobRequest) (*models.JobCV, error) { if err := validation.Validate(req); err != nil { return nil, response.HandleValidationError(err) }
job, err := s.cvRepository.GetJob(ctx, id) job, err := s.cvRepository.GetJob(ctx, req.ID) if err != nil { return nil, response.HandleGormError(err, "Data pekerjaan tidak ditemukan") return nil, response.HandleGormError(err, "Internal Server Error") }
job.InstitutionName = req.InstitutionName job.CurrentJob = req.CurrentJob job.YearStartedWorking = req.YearStartedWorking job.MonthlyIncome = req.MonthlyIncome job.IncomeSources = req.IncomeSources utils.AssignIfNotNil(&job.InstitutionName, req.InstitutionName) utils.AssignIfNotNil(&job.CurrentJob, req.CurrentJob) utils.AssignIfNotNil(&job.YearStartedWorking, req.YearStartedWorking) utils.AssignIfNotNil(&job.MonthlyIncome, req.MonthlyIncome) utils.AssignIfNotNil(&job.IncomeSources, req.IncomeSources)
res, err := s.cvRepository.SaveJob(ctx, job) if err != nil { return nil, response.HandleGormError(err, "Gagal memperbarui data pekerjaan") return nil, response.HandleGormError(err, "Internal Server Error") } return res, nil}
func (s *cvService) ListJob(ctx context.Context, accountID int64) ([]models.JobCV, error) { return s.cvRepository.ListJob(ctx, accountID)func (s *cvService) ListJob(ctx context.Context, req *models.ListJobRequest) ([]models.JobCV, error) { return s.cvRepository.ListJob(ctx, req.AccountID)}
func (s *cvService) GetJob(ctx context.Context, id int64) (*models.JobCV, error) { job, err := s.cvRepository.GetJob(ctx, id)func (s *cvService) GetJob(ctx context.Context, req *models.GetJobRequest) (*models.JobCV, error) { job, err := s.cvRepository.GetJob(ctx, req.ID) if err != nil { return nil, response.HandleGormError(err, "Data pekerjaan tidak ditemukan") return nil, response.HandleGormError(err, "Internal Server Error") } return job, nil}
func (s *cvService) DeleteJob(ctx context.Context, id int64) error { return s.cvRepository.DeleteJob(ctx, id)func (s *cvService) DeleteJob(ctx context.Context, req *models.DeleteJobRequest) error { return s.cvRepository.DeleteJob(ctx, req.ID)}
func (s *cvService) CreateAchievement(ctx context.Context, req *models.AchievementRequest) (*models.AchievementCV, error) {func (s *cvService) CreateAchievement(ctx context.Context, req *models.CreateAchievementRequest) (*models.AchievementCV, error) { ach := &models.AchievementCV{ AccountID: req.AccountID, AchievementOrAward: req.AchievementOrAward, } res, err := s.cvRepository.SaveAchievement(ctx, ach) if err != nil { return nil, response.HandleGormError(err, "Gagal menambahkan data prestasi") return nil, response.HandleGormError(err, "Internal Server Error") }
return res, nil}
func (s *cvService) UpdateAchievement(ctx context.Context, id int64, req *models.AchievementRequest) (*models.AchievementCV, error) { ach, err := s.cvRepository.GetAchievement(ctx, id)func (s *cvService) UpdateAchievement(ctx context.Context, req *models.UpdateAchievementRequest) (*models.AchievementCV, error) { ach, err := s.cvRepository.GetAchievement(ctx, req.ID) if err != nil { return nil, response.HandleGormError(err, "Data prestasi tidak ditemukan") return nil, response.HandleGormError(err, "Internal Server Error") }
ach.AchievementOrAward = req.AchievementOrAward
res, err := s.cvRepository.SaveAchievement(ctx, ach) if err != nil { return nil, response.HandleGormError(err, "Gagal memperbarui data prestasi") return nil, response.HandleGormError(err, "Internal Server Error") }
return res, nil}
func (s *cvService) ListAchievement(ctx context.Context, accountID int64) ([]models.AchievementCV, error) { return s.cvRepository.ListAchievement(ctx, accountID)func (s *cvService) ListAchievement(ctx context.Context, req *models.ListAchievementRequest) ([]models.AchievementCV, error) { return s.cvRepository.ListAchievement(ctx, req.AccountID)}
func (s *cvService) GetAchievement(ctx context.Context, id int64) (*models.AchievementCV, error) { ach, err := s.cvRepository.GetAchievement(ctx, id)func (s *cvService) GetAchievement(ctx context.Context, req *models.GetAchievementRequest) (*models.AchievementCV, error) { ach, err := s.cvRepository.GetAchievement(ctx, req.ID) if err != nil { return nil, response.HandleGormError(err, "Data prestasi tidak ditemukan") return nil, response.HandleGormError(err, "Internal Server Error") } return ach, nil}
func (s *cvService) DeleteAchievement(ctx context.Context, id int64) error { return s.cvRepository.DeleteAchievement(ctx, id)func (s *cvService) DeleteAchievement(ctx context.Context, req *models.DeleteAchievementRequest) error { return s.cvRepository.DeleteAchievement(ctx, req.ID)}
func (s *cvService) UploadProfileImage(ctx context.Context, req *models.UploadProfileImageRequest) (*models.UploadProfileImageResponse, error) {67 unmodified lines }, nil}
func (s *cvService) GetProgress(ctx context.Context, accountID int64) (*models.ProgressResponse, error) { accountDetails, err := s.cvRepository.GetAccountDetailsByAccountID(ctx, accountID)func (s *cvService) GetProgressCV(ctx context.Context, req *models.GetProgressCVRequest) (*models.GetProgressCVResponse, error) { accountDetails, err := s.cvRepository.GetAccountDetailsByAccountID(ctx, req.AccountID) if err != nil { if !errors.Is(err, gorm.ErrRecordNotFound) { return nil, response.HandleGormError(err, "Internal Server Error")1 unmodified line accountDetails = &models.AccountDetails{} }
personalityAndPreferenceCV, err := s.cvRepository.GetPersonalityAndPreferenceByAccountID(ctx, accountID) personalityAndPreferenceCV, err := s.cvRepository.GetPersonalityAndPreferenceByAccountID(ctx, req.AccountID) if err != nil { if !errors.Is(err, gorm.ErrRecordNotFound) { return nil, response.HandleGormError(err, "Internal Server Error")1 unmodified line personalityAndPreferenceCV = &models.PersonalityAndPreferenceCV{} }
physicalAndHealthCV, err := s.cvRepository.GetPhysicalAndHealthByAccountID(ctx, accountID) physicalAndHealthCV, err := s.cvRepository.GetPhysicalAndHealthByAccountID(ctx, req.AccountID) if err != nil { if !errors.Is(err, gorm.ErrRecordNotFound) { return nil, response.HandleGormError(err, "Internal Server Error")1 unmodified line physicalAndHealthCV = &models.PhysicalAndHealthCV{} }
worshipAndReligiousUnderstandingCV, err := s.cvRepository.GetWorshipAndReligiousUnderstandingByAccountID(ctx, accountID) worshipAndReligiousUnderstandingCV, err := s.cvRepository.GetWorshipAndReligiousUnderstandingByAccountID(ctx, req.AccountID) if err != nil { if !errors.Is(err, gorm.ErrRecordNotFound) { return nil, response.HandleGormError(err, "Internal Server Error")1 unmodified line worshipAndReligiousUnderstandingCV = &models.WorshipAndReligiousUnderstandingCV{} }
educationCV, err := s.cvRepository.ListEducation(ctx, accountID) educationCV, err := s.cvRepository.ListEducation(ctx, req.AccountID) if err != nil { return nil, response.HandleGormError(err, "Internal Server Error") }
familyMemberCV, err := s.cvRepository.ListFamilyMember(ctx, accountID) familyMemberCV, err := s.cvRepository.ListFamilyMember(ctx, req.AccountID) if err != nil { return nil, response.HandleGormError(err, "Internal Server Error") }
jobCV, err := s.cvRepository.ListJob(ctx, accountID) jobCV, err := s.cvRepository.ListJob(ctx, req.AccountID) if err != nil { return nil, response.HandleGormError(err, "Internal Server Error") }
achievementCV, err := s.cvRepository.ListAchievement(ctx, accountID) achievementCV, err := s.cvRepository.ListAchievement(ctx, req.AccountID) if err != nil { return nil, response.HandleGormError(err, "Internal Server Error") }21 unmodified lines familyMemberCV int, jobCV int, achievementCV int,) *models.ProgressResponse {) *models.GetProgressCVResponse {
// fullIfPresent returns 100 if the data is greater than 0, otherwise returns 0 // fullIfPresent mengembalikan 100 jika data lebih dari 0, jika tidak maka mengembalikan 0 fullIfPresent := func(data int) float64 { if data > 0 { return 10013 unmodified lines
overallProgress := (accountDetailsPercentage + personalityAndPreferenceCVPercentage + physicalAndHealthCVPercentage + worshipAndReligiousUnderstandingCVPercentage + educationCVPercentage + familyMemberCVPercentage + jobCVPercentage + achievementCVPercentage) / 8
return &models.ProgressResponse{ return &models.GetProgressCVResponse{ AccountDetailsProgress: math.Round(accountDetailsPercentage*100) / 100, PersonalityAndPreferenceCVProgress: math.Round(personalityAndPreferenceCVPercentage*100) / 100, FamilyMemberCVProgress: math.Round(familyMemberCVPercentage*100) / 100,52 unmodified lines5354555657585952 unmodified lines }
return
})
s.Exception = QuizAttemptService.Exception
s.Error = errors.Join(s.Error, QuizAttemptService.Error)
return
}1234567832 unmodified lines4142434445464748package services
import (
"errors"
"api.qobiltu.id/models"
"api.qobiltu.id/repositories"
)32 unmodified lines }
return
})
s.Exception = QuizAttemptService.Exception
s.Error = errors.Join(s.Error, QuizAttemptService.Error)
return
}123456789101112131415161718192021222324package controller
import (
"strconv"
"api.qobiltu.id/controller"
"api.qobiltu.id/models"
"api.qobiltu.id/services"
"github.com/gin-gonic/gin"
)
func Result(c *gin.Context) {
quizResult := services.QuizResultService{}
quizResultController := controller.Controller[any, models.QuizAttempt, []models.QuizResultResponse]{
Service: &quizResult.Service,
}
quizResultController.HeaderParse(c, func() {
academyId, _ := strconv.Atoi(c.Param("attempt_id"))
quizResult.Constructor.AccountID = uint(quizResultController.AccountData.UserID)
quizResult.Constructor.ID = uint(academyId) | 0
quizResult.Retrieve()
quizResultController.Response(c)
})
}14 unmodified lines1516171819201819202122232414 unmodified lines Service: &submitQuiz.Service,
}
submitQuizController.HeaderParse(c, func() {
quizId, _ := strconv.Atoi(c.Param("attempt_id"))
submitQuizController.Service.Constructor.ID = uint(quizId)
submitQuiz.Create(submitQuizController.AccountData.UserID)
attemptId, _ := strconv.Atoi(c.Param("attempt_id"))
submitQuizController.Service.Constructor.ID = uint(attemptId)
submitQuizController.Service.Constructor.AccountID = uint(submitQuizController.AccountData.UserID)
submitQuiz.Create()
submitQuizController.Response(c)
})
}151 unmodified lines1521531541551551561571581591 unmodified line161162163163164165166167107 unmodified lines275276277277278279280281151 unmodified lines QuizID uint `json:"quiz_id"` Content string `json:"content"` Order int `json:"order"` CorrectAnswer uint `json:"-"` CorrectAnswer uint `json:"corrent_answer"` Review string `json:"reviews"`}type Quiz struct { ID uint `gorm:"primaryKey" json:"id"`1 unmodified line Slug string `json:"slug" gorm:"uniqueIndex" ` Title string `json:"title"` Description string `json:"description"` TotalQuestions string `json:"total_questions"` TotalQuestions int `json:"total_questions"` AttemptLimit int `json:"attempt_limit"` TimeLimit int `json:"time_limit"` MinScore int `json:"min_score"`107 unmodified lines ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"` // id AccountID int64 `gorm:"column:account_id;not null" json:"account_id"` // id akun Account *Account `gorm:"foreignKey:AccountID;constraint:OnDelete:CASCADE" json:"account,omitempty"` // relasi ke akun LastEducation *string `gorm:"column:last_education" json:"last_education" validate:""` // pendidikan terakhir LastEducation *string `gorm:"column:last_education" json:"last_education"` // pendidikan terakhir EducationInstitute *string `gorm:"column:education_institute" json:"education_institute"` // institusi pendidikan EducationMajor *string `gorm:"column:education_major" json:"education_major"` // jurusan pendidikan YearStart *int `gorm:"column:year_start" json:"year_start"` // tahun masukmain.go-6
models/database_orm_model.go+8-6
models/request_model.go+8-6
router/router.go-1
router/server.go-4
services/partner_criteria_service.go+4-2
space/pkg/validation/validation.go+16-155
space/response/validation.go+19-2
space/services/marriage_readiness_profile_service.go+4-3
space/services/partner_criteria_service.go+4-3
space/space/controller/partner_criteria/partner_criteria_controller.goAdded+66
space/space/main.go+9-3
space/space/models/database_orm_model.go+54-20
space/space/models/request_model.go+112-77
space/space/pkg/validation/custom_rules.go+236-116
space/space/repositories/partner_criteria_repository.goAdded+38
space/space/router/partner_criteria_route.goAdded+11
space/space/router/router.go+1
space/space/router/server.go+4
space/space/services/cv_service.go+16-13
space/space/services/partner_criteria_service.goAdded+77
space/space/space/config/database_connection_config.go+13-2
space/space/space/models/sequence.goAdded+25
space/space/space/repositories/account_repository.go+18
space/space/space/repositories/cv_repository.go+162-146
space/space/space/services/cv_service.go+33-7
space/space/space/services/user_profile_service.go+36-8
space/space/space/space/models/database_orm_model.go+50-50
space/space/space/space/models/field_counter.go+4-19
space/space/space/space/space/config/database_connection_config.go+1
space/space/space/space/space/controller/marriage_readiness_profile/marriage_readiness_profile_controller.goAdded+66
space/space/space/space/space/main.go+12-5
space/space/space/space/space/repositories/marriage_readiness_profile_repository.goAdded+38
space/space/space/space/space/router/marriage_readiness_profile_route.goAdded+11
space/space/space/space/space/services/marriage_readiness_profile_service.goAdded+90
space/space/space/space/space/space/controller/cv/cv_controller.go+171-47
space/space/space/space/space/space/models/database_orm_model.go+95-43
space/space/space/space/space/space/models/request_model.go+199-45
space/space/space/space/space/space/pkg/validation/validation.go+10-1
space/space/space/space/space/space/pkg/worker/task_send_forgot_password_email.go+8-6
space/space/space/space/space/space/pkg/worker/task_send_verify_email.go+8-5
space/space/space/space/space/space/router/cv_route.go+1-1
space/space/space/space/space/space/router/router.go+1
space/space/space/space/space/space/router/server.go+11-7
space/space/space/space/space/space/services/cv_service.go+188-181
space/space/space/space/space/space/space/services/academy_quiz_answer_service.go+3
space/space/space/space/space/space/space/services/academy_quiz_question_service.go+6
space/space/space/space/space/space/space/space/controller/quiz/result_quiz_controller.goAdded+24
space/space/space/space/space/space/space/space/controller/quiz/submit_quiz_controller.go+4-3
space/space/space/space/space/space/space/space/models/database_orm_model.go+4-3