Spaces:
Configuration error
Configuration error
Commit ·
8e28672
1
Parent(s): 21e6a10
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)
- space/services/email_verification_service.go+11-60
- space/space/space/services/email_verification_service.go+60-11
- space/space/space/space/services/user_profile_service.go+3-1
- space/space/space/space/space/models/request_model.go+4-2
- space/space/space/space/space/services/authentication_service.go+2
- space/space/space/space/space/services/email_verification_service.go+4
- space/space/space/space/space/services/user_profile_service.go+5-2
- space/space/space/space/space/space/repositories/account_repository.go+9
- space/space/space/space/space/space/services/external_authentication_service.go+1-1
- space/space/space/space/space/space/services/user_profile_service.go+8
- space/space/space/space/space/space/space/services/user_profile_service.go-2
- space/space/space/space/space/space/space/space/docker-compose.yml+1-1
- space/space/space/space/space/space/space/space/space/space/Dockerfile+3
- space/space/space/space/space/space/space/space/space/space/space/space/space/controller/user/user_profile_controller.go+1-1
- space/space/space/space/space/space/space/space/space/space/space/space/space/controller/user/user_update_profile_controller.go+2-4
- space/space/space/space/space/space/space/space/space/space/space/space/space/logs/error_log.txt+1
- space/space/space/space/space/space/space/space/space/space/space/space/space/middleware/authentication_middleware.go-3
- space/space/space/space/space/space/space/space/space/space/space/space/space/models/response_model.go+5
- space/space/space/space/space/space/space/space/space/space/space/space/space/repositories/account_repository.go-4
- space/space/space/space/space/space/space/space/space/space/space/space/space/repositories/forgot_password_repository.goAdded+22
- space/space/space/space/space/space/space/space/space/space/space/space/space/router/router.go+8-1
- space/space/space/space/space/space/space/space/space/space/space/space/space/services/external_authentication_service.go+4-5
- space/space/space/space/space/space/space/space/space/space/space/space/space/services/user_profile_service.go+50-6
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/.gitignore+4-2
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/config/config.go+10
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/config/database_connection_config.go+4
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/controller/auth/auth_external_controller.goAdded+20
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/controller/auth/auth_forgot_password_controller.goAdded+1
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/controller/email/email_create_verification_controller.goAdded+21
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/controller/email/email_validate_controller.goAdded+24
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/controller/options/option_category_controller.goAdded+19
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/controller/options/option_value_controller.goAdded+19
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/controller/region/city/city_list_controller.goAdded+21
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/controller/region/city/city_seeds_controller.goAdded+17
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/controller/region/province/province_list_controller.goAdded+17
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/controller/region/province/province_seeds_controller.goAdded+17
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/go.mod+23-2
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/go.sum+46
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/middleware/authentication_middleware.go+3-3
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/models/request_model.go+17-4
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/models/response_model.go+7
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/repositories/email_verification_repository.go+15-1
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/repositories/external_auth_repository.goAdded+37
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/repositories/option_repository.goAdded+43
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/repositories/region_repository.goAdded+47
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/router/auth_route.go+1
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/router/email_route.go+3-3
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/router/options_route.goAdded+20
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/router/router.go+1
- space/space/space/space/space/space/space/space/space/space/space/space/space/space/services/authentication_service.go+1-4
1234567835 unmodified lines4445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114package servicesimport ("crypto/tls""fmt""math/rand/v2""net/smtp""time"35 unmodified linessmtpHost := config.SMTP_HOSTsmtpPort := config.SMTP_PORTtlsconfig := &tls.Config{InsecureSkipVerify: true,ServerName: smtpHost,}conn, err := tls.Dial("tcp", fmt.Sprintf("%s:%d", smtpHost, smtpPort), tlsconfig)if err != nil {panic(err)}client, err := smtp.NewClient(conn, smtpHost)if err != nil {panic(err)}// auth := smtp.PlainAuth("", from, password, smtpHost)auth := smtp.PlainAuth("", from, password, smtpHost)if err = client.Auth(auth); err != nil {panic(err)}if err = client.Mail(from); err != nil {panic(err)}to := []string{toEmail}for _, addr := range to {if err = client.Rcpt(addr); err != nil {panic(err)}}wc, err := client.Data()if err != nil {panic(err)}msg := []byte("Subject: Test Email\r\n\r\nThis is the email body.")_, err = wc.Write(msg)if err != nil {panic(err)}err = wc.Close()if err != nil {panic(err)}client.Quit()fmt.Println("Email sent successfully!")// subject := "Email Verification Token"// body := fmt.Sprintf("Your verification token is: %06d\nPlease use it before it expires.", token)// msg := []byte("To: " + toEmail + "\r\n" +// "Subject: " + subject + "\r\n" +// "\r\n" +// body + "\r\n")// err := smtp.SendMail(smtpHost+":"+smtpPort, auth, from, []string{toEmail}, msg)// if err != nil {// s.Error = err// log.Printf("Error sending verification email: %v", err)// return// }}(accountRepo.Result.Email, token)}1234567835 unmodified lines44454647484950515253545556575859606162636465package servicesimport ("fmt""log""math/rand/v2""net/smtp""time"35 unmodified linessmtpHost := config.SMTP_HOSTsmtpPort := config.SMTP_PORTauth := smtp.PlainAuth("", from, password, smtpHost)subject := "Email Verification Token"body := fmt.Sprintf("Your verification token is: %06d\nPlease use it before it expires.", token)msg := []byte("To: " + toEmail + "\r\n" +"Subject: " + subject + "\r\n" +"\r\n" +body + "\r\n")err := smtp.SendMail(smtpHost+":"+smtpPort, auth, from, []string{toEmail}, msg)if err != nil {s.Error = errlog.Printf("Error sending verification email: %v", err)return}}(accountRepo.Result.Email, token)}
1234567835 unmodified lines44454647484950515253545556575859606162636465package servicesimport ("fmt""log""math/rand/v2""net/smtp""time"35 unmodified linessmtpHost := config.SMTP_HOSTsmtpPort := config.SMTP_PORTauth := smtp.PlainAuth("", from, password, smtpHost)subject := "Email Verification Token"body := fmt.Sprintf("Your verification token is: %06d\nPlease use it before it expires.", token)msg := []byte("To: " + toEmail + "\r\n" +"Subject: " + subject + "\r\n" +"\r\n" +body + "\r\n")err := smtp.SendMail(smtpHost+":"+smtpPort, auth, from, []string{toEmail}, msg)if err != nil {s.Error = errlog.Printf("Error sending verification email: %v", err)return}}(accountRepo.Result.Email, token)}1234567835 unmodified lines4445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114package servicesimport ("crypto/tls""fmt""math/rand/v2""net/smtp""time"35 unmodified linessmtpHost := config.SMTP_HOSTsmtpPort := config.SMTP_PORTtlsconfig := &tls.Config{InsecureSkipVerify: true,ServerName: smtpHost,}conn, err := tls.Dial("tcp", fmt.Sprintf("%s:%d", smtpHost, smtpPort), tlsconfig)if err != nil {panic(err)}client, err := smtp.NewClient(conn, smtpHost)if err != nil {panic(err)}// auth := smtp.PlainAuth("", from, password, smtpHost)auth := smtp.PlainAuth("", from, password, smtpHost)if err = client.Auth(auth); err != nil {panic(err)}if err = client.Mail(from); err != nil {panic(err)}to := []string{toEmail}for _, addr := range to {if err = client.Rcpt(addr); err != nil {panic(err)}}wc, err := client.Data()if err != nil {panic(err)}msg := []byte("Subject: Test Email\r\n\r\nThis is the email body.")_, err = wc.Write(msg)if err != nil {panic(err)}err = wc.Close()if err != nil {panic(err)}client.Quit()fmt.Println("Email sent successfully!")// subject := "Email Verification Token"// body := fmt.Sprintf("Your verification token is: %06d\nPlease use it before it expires.", token)// msg := []byte("To: " + toEmail + "\r\n" +// "Subject: " + subject + "\r\n" +// "\r\n" +// body + "\r\n")// err := smtp.SendMail(smtpHost+":"+smtpPort, auth, from, []string{toEmail}, msg)// if err != nil {// s.Error = err// log.Printf("Error sending verification email: %v", err)// return// }}(accountRepo.Result.Email, token)}
1 unmodified line23456774 unmodified lines828384858687881 unmodified lineimport ("regexp""strings""api.qobiltu.id/models"74 unmodified lines} else {initialName = "AKH_"}initialName += string(usersCount)userProfile := repositories.UpdateAccountDetails(s.Constructor)s.Error = userProfile.RowsErrorif userProfile.NoRecord {1 unmodified line234567874 unmodified lines83848586878889901 unmodified lineimport ("regexp""strconv""strings""api.qobiltu.id/models"74 unmodified lines} else {initialName = "AKH_"}initialName += strconv.Itoa(usersCount)s.Constructor.InitialName = initialNameuserProfile := repositories.UpdateAccountDetails(s.Constructor)s.Error = userProfile.RowsErrorif userProfile.NoRecord {
29 unmodified lines30313233343529 unmodified lines}type ExternalAuthRequest struct {OauthID string `json:"oauth_id" binding:"required"`OauthProvider string `json:"oauth_provider" binding:"required"`}29 unmodified lines303132333435363729 unmodified lines}type ExternalAuthRequest struct {OauthID string `json:"oauth_id" binding:"required"`OauthProvider string `json:"oauth_provider" binding:"required"`IsAgreeTerms bool `json:"is_agree_terms"`IsSexualDisease bool `json:"is_sexual_disease"`}
17 unmodified lines1819202122234 unmodified lines28293031323317 unmodified liness.Exception.Message = "there is no account with given credentials!"return}if VerifyPassword(accountData.Result.Password, s.Constructor.Password) != nil {s.Exception.Unauthorized = trues.Exception.Message = "incorrect password!"4 unmodified linesif err_tok != nil {s.Error = errors.Join(s.Error, err_tok)}accountData.Result.Password = "SECRET"17 unmodified lines181920212223244 unmodified lines2930313233343517 unmodified liness.Exception.Message = "there is no account with given credentials!"return}if VerifyPassword(accountData.Result.Password, s.Constructor.Password) != nil {s.Exception.Unauthorized = trues.Exception.Message = "incorrect password!"4 unmodified linesif err_tok != nil {s.Error = errors.Join(s.Error, err_tok)return}accountData.Result.Password = "SECRET"
55 unmodified lines5657585960616212 unmodified lines75767778798081828355 unmodified lineserr := smtp.SendMail(smtpHost+":"+smtpPort, auth, from, []string{toEmail}, msg)if err != nil {log.Printf("Error sending verification email: %v", err)}}(accountRepo.Result.Email, token)}12 unmodified liness.Exception.Unauthorized = trues.Exception.Message = "Token has expired!"repositories.UpdateExpiredEmailVerification(s.Constructor.UUID)return}s.Result = repo.Result}func (s *EmailVerificationService) Delete() {55 unmodified lines56575859606162636412 unmodified lines777879808182838485868755 unmodified lineserr := smtp.SendMail(smtpHost+":"+smtpPort, auth, from, []string{toEmail}, msg)if err != nil {s.Error = errlog.Printf("Error sending verification email: %v", err)return}}(accountRepo.Result.Email, token)}12 unmodified liness.Exception.Unauthorized = trues.Exception.Message = "Token has expired!"repositories.UpdateExpiredEmailVerification(s.Constructor.UUID)s.Delete()return}s.Result = repo.Results.Delete()}func (s *EmailVerificationService) Delete() {
70 unmodified lines717273747576777813 unmodified lines9293949570 unmodified lines}func (s *UserProfileService) Update() {phoneNumber := *s.Constructor.PhoneNumber*s.Constructor.PhoneNumber = SanitizePhoneNumber(phoneNumber)usersCount := repositories.GetAllAccount().RowsCountvar initialName stringif *s.Constructor.Gender {13 unmodified linesAccount: repositories.GetAccountById(s.Constructor.AccountID).Result,Details: userProfile.Result,}}70 unmodified lines7172737475767778798013 unmodified lines949596979870 unmodified lines}func (s *UserProfileService) Update() {if s.Constructor.PhoneNumber != nil {phoneNumber := *s.Constructor.PhoneNumber*s.Constructor.PhoneNumber = SanitizePhoneNumber(phoneNumber)}usersCount := repositories.GetAllAccount().RowsCountvar initialName stringif *s.Constructor.Gender {13 unmodified linesAccount: repositories.GetAccountById(s.Constructor.AccountID).Result,Details: userProfile.Result,}s.Result.Account.Password = "SECRET"}
14 unmodified lines15161718192014 unmodified linesreturn *repo}func GetAccountById(accountId uint) Repository[models.Account, models.Account] {repo := Construct[models.Account, models.Account](models.Account{Id: accountId},14 unmodified lines15161718192021222324252627282914 unmodified linesreturn *repo}func GetAllAccount() Repository[models.Account, []models.Account] {repo := Construct[models.Account, []models.Account](models.Account{},)repo.Transactions(Find[models.Account, []models.Account],)return *repo}func GetAccountById(accountId uint) Repository[models.Account, models.Account] {repo := Construct[models.Account, models.Account](models.Account{Id: accountId},
32 unmodified lines3334353637383932 unmodified lines})s.Constructor.AccountID = createAccount.Result.IdcreateGoogleAuth := repositories.CreateExternalAuth(s.Constructor)s.Error = createGoogleAuth.RowsErrors.Error = errors.Join(s.Error, createAccount.RowsError)}32 unmodified lines3334353637383932 unmodified lines})s.Constructor.AccountID = createAccount.Result.IdcreateGoogleAuth := repositories.CreateExternalAuth(s.Constructor)GoogleAuth.Result.AccountID = createGoogleAuth.Result.IDs.Error = createGoogleAuth.RowsErrors.Error = errors.Join(s.Error, createAccount.RowsError)}
72 unmodified lines73747576777872 unmodified linesfunc (s *UserProfileService) Update() {phoneNumber := *s.Constructor.PhoneNumber*s.Constructor.PhoneNumber = SanitizePhoneNumber(phoneNumber)userProfile := repositories.UpdateAccountDetails(s.Constructor)s.Error = userProfile.RowsErrorif userProfile.NoRecord {72 unmodified lines737475767778798081828384858672 unmodified linesfunc (s *UserProfileService) Update() {phoneNumber := *s.Constructor.PhoneNumber*s.Constructor.PhoneNumber = SanitizePhoneNumber(phoneNumber)usersCount := repositories.GetAllAccount().RowsCountvar initialName stringif *s.Constructor.Gender {initialName = "IKH_"} else {initialName = "AKH_"}initialName += string(usersCount)userProfile := repositories.UpdateAccountDetails(s.Constructor)s.Error = userProfile.RowsErrorif userProfile.NoRecord {
43 unmodified lines444546474849505143 unmodified linesreturn input}func (s *UserProfileService) Create() {phoneNumber := *s.Constructor.PhoneNumber*s.Constructor.PhoneNumber = SanitizePhoneNumber(phoneNumber)userProfile := repositories.CreateAccountDetails(s.Constructor)s.Error = userProfile.RowsErrorif userProfile.NoRecord {43 unmodified lines44454647484943 unmodified linesreturn input}func (s *UserProfileService) Create() {userProfile := repositories.CreateAccountDetails(s.Constructor)s.Error = userProfile.RowsErrorif userProfile.NoRecord {
23 unmodified lines2425262728293023 unmodified linesports:- "5432:5432"volumes:- db-data:/var/lib/postgresql/datarestart: alwaysvolumes:23 unmodified lines2425262728293023 unmodified linesports:- "5432:5432"volumes:- /home/qobiltu/postgres-data:/var/lib/postgresql/datarestart: alwaysvolumes:
27 unmodified lines28293031323327 unmodified lines# Copy hasil build dari builder ke image runtimeCOPY --from=builder /app/main .# Copy file .env untuk konfigurasi environmentCOPY .env .env27 unmodified lines28293031323334353627 unmodified lines# Copy hasil build dari builder ke image runtimeCOPY --from=builder /app/main .# Copy folder utils (termasuk file seeder) dari builder ke runtimeCOPY --from=builder /app/utils ./utils# Copy file .env untuk konfigurasi environmentCOPY .env .env
8 unmodified lines91011121314158 unmodified linesfunc Profile(c *gin.Context) {userProfile := services.UserProfileService{}userProfileController := controller.Controller[any, models.AccountDetails, models.AccountDetails]{Service: &userProfile.Service,}userProfileController.HeaderParse(c, func() {8 unmodified lines91011121314158 unmodified linesfunc Profile(c *gin.Context) {userProfile := services.UserProfileService{}userProfileController := controller.Controller[any, models.AccountDetails, models.UserProfileResponse]{Service: &userProfile.Service,}userProfileController.HeaderParse(c, func() {
123456782 unmodified lines111213141516171 unmodified line19202122232425package userimport ("fmt""api.qobiltu.id/controller""api.qobiltu.id/models""api.qobiltu.id/services"2 unmodified linesfunc UpdateProfile(c *gin.Context) {userProfile := services.UserProfileService{}userUpdateProfileController := controller.Controller[models.AccountDetails, models.AccountDetails, models.AccountDetails]{Service: &userProfile.Service,}1 unmodified lineuserUpdateProfileController.Service.Constructor = userUpdateProfileController.RequestuserUpdateProfileController.HeaderParse(c, func() {userUpdateProfileController.Service.Constructor.AccountID = uint(userUpdateProfileController.AccountData.UserID)fmt.Println("Account ID:", userUpdateProfileController.Service.Constructor.AccountID)})userProfile.Update()},1234562 unmodified lines91011121314151 unmodified line17181920212223package userimport ("api.qobiltu.id/controller""api.qobiltu.id/models""api.qobiltu.id/services"2 unmodified linesfunc UpdateProfile(c *gin.Context) {userProfile := services.UserProfileService{}userUpdateProfileController := controller.Controller[models.AccountDetails, models.AccountDetails, models.UserProfileResponse]{Service: &userProfile.Service,}1 unmodified lineuserUpdateProfileController.Service.Constructor = userUpdateProfileController.RequestuserUpdateProfileController.HeaderParse(c, func() {userUpdateProfileController.Service.Constructor.AccountID = uint(userUpdateProfileController.AccountData.UserID)})userProfile.Update()},
1
2 unmodified lines3456789106 unmodified lines171819202122232 unmodified linespackage middlewareimport ("fmt""api.qobiltu.id/models""api.qobiltu.id/services""api.qobiltu.id/utils"6 unmodified linestoken := c.Request.Header["Authorization"]currAccData.UserID, currAccData.VerifyStatus, currAccData.ErrVerif = services.VerifyToken(token[0])fmt.Println(token[0])if currAccData.VerifyStatus == "invalid-token" || currAccData.VerifyStatus == "expired" {currAccData.UserID = 02 unmodified lines3456786 unmodified lines1516171819202 unmodified linespackage middlewareimport ("api.qobiltu.id/models""api.qobiltu.id/services""api.qobiltu.id/utils"6 unmodified linestoken := c.Request.Header["Authorization"]currAccData.UserID, currAccData.VerifyStatus, currAccData.ErrVerif = services.VerifyToken(token[0])if currAccData.VerifyStatus == "invalid-token" || currAccData.VerifyStatus == "expired" {currAccData.UserID = 0
24 unmodified lines25262724 unmodified linestype OptionsResponse struct {Options []Options `json:"options"`}24 unmodified lines252627282930313224 unmodified linestype OptionsResponse struct {Options []Options `json:"options"`}type UserProfileResponse struct {Account Account `json:"account"`Details AccountDetails `json:"details"`}
1234567855 unmodified lines6465666768697071package repositoriesimport ("fmt""api.qobiltu.id/models")55 unmodified linesrepo := Construct[models.AccountDetails, models.AccountDetails](accountDetails,)fmt.Println(accountDetails)fmt.Println("Account ID : ", accountDetails.AccountID)Create(repo)return *repo}12345655 unmodified lines626364656667package repositoriesimport ("api.qobiltu.id/models")55 unmodified linesrepo := Construct[models.AccountDetails, models.AccountDetails](accountDetails,)Create(repo)return *repo}
12345678910111213141516171819202122package repositories
import "api.qobiltu.id/models"
func CreateForgotPassword(forgotPassword models.ForgotPassword) Repository[models.ForgotPassword, models.ForgotPassword] {
repo := Construct[models.ForgotPassword, models.ForgotPassword](
forgotPassword,
)
Create(repo)
return *repo
}
func GetForgotPasswordByToken(token uint) Repository[models.ForgotPassword, models.ForgotPassword] {
repo := Construct[models.ForgotPassword, models.ForgotPassword](
models.ForgotPassword{Token: token},
)
repo.Transactions(
WhereGivenConstructor[models.ForgotPassword, models.ForgotPassword],
Find[models.ForgotPassword, models.ForgotPassword],
)
return *repo
}1234562 unmodified lines91011121314151617package routerimport ("api.qobiltu.id/config""api.qobiltu.id/controller""github.com/gin-gonic/gin"2 unmodified linesfunc StartService() {router := gin.Default()router.GET("/", controller.HomeController)AuthRoute(router)UserRoute(router)EmailRoute(router)OptionsRoute(router)router.Run(config.TCP_ADDRESS)}123456782 unmodified lines1112131415161718192021222324package routerimport ("log""api.qobiltu.id/config""api.qobiltu.id/controller""github.com/gin-gonic/gin"2 unmodified linesfunc StartService() {router := gin.Default()router.GET("/", controller.HomeController)AuthRoute(router)UserRoute(router)EmailRoute(router)OptionsRoute(router)err := router.Run(config.TCP_ADDRESS)if err != nil {log.Fatalf("Failed to run server: %v", err)}}
26 unmodified lines27282930313233343536373839404126 unmodified linesif GoogleAuth.NoRecord {s.Constructor.UUID = uuid.NewV4()s.Constructor.OauthProvider = "Google"createGoogleAuth := repositories.CreateExternalAuth(s.Constructor)s.Error = createGoogleAuth.RowsErrorcreateAccount := repositories.CreateAccount(models.Account{Email: email.(string),IsEmailVerified: true,})s.Error = errors.Join(s.Error, createAccount.RowsError)}accountData := repositories.GetAccountById(GoogleAuth.Result.AccountID)26 unmodified lines272829303132333435363738394026 unmodified linesif GoogleAuth.NoRecord {s.Constructor.UUID = uuid.NewV4()s.Constructor.OauthProvider = "Google"createAccount := repositories.CreateAccount(models.Account{Email: email.(string),IsEmailVerified: true,})s.Constructor.AccountID = createAccount.Result.IdcreateGoogleAuth := repositories.CreateExternalAuth(s.Constructor)s.Error = createGoogleAuth.RowsErrors.Error = errors.Join(s.Error, createAccount.RowsError)}accountData := repositories.GetAccountById(GoogleAuth.Result.AccountID)
12345678910111213141516171 unmodified line192021222324253 unmodified lines29303132333435363738391 unmodified line4142434445package servicesimport ("fmt""api.qobiltu.id/models""api.qobiltu.id/repositories")type UserProfileService struct {Service[models.AccountDetails, models.AccountDetails]}func (s *UserProfileService) Create() {userProfile := repositories.CreateAccountDetails(s.Constructor)s.Error = userProfile.RowsErrorif userProfile.NoRecord {1 unmodified lines.Exception.Message = "There is no account with given credentials!"return}s.Result = userProfile.Result}func (s *UserProfileService) Retrieve() {userProfile := repositories.GetDetailAccountById(s.Constructor.AccountID)3 unmodified liness.Exception.Message = "There is no account with given credentials!"return}s.Result = userProfile.Result}func (s *UserProfileService) Update() {fmt.Println("Account ID:", s.Constructor.AccountID)userProfile := repositories.UpdateAccountDetails(s.Constructor)s.Error = userProfile.RowsErrorif userProfile.NoRecord {1 unmodified lines.Exception.Message = "There is no account with given credentials!"return}s.Result = userProfile.Result}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950511 unmodified line535455565758596061623 unmodified lines6667686970717273747576777879801 unmodified line8283848586878889package servicesimport ("regexp""strings""api.qobiltu.id/models""api.qobiltu.id/repositories")type UserProfileService struct {Service[models.AccountDetails, models.UserProfileResponse]}// SanitizePhoneNumber membersihkan dan menormalkan nomor telepon ke format +62func SanitizePhoneNumber(input string) string {// Hilangkan semua spasi dan stripinput = strings.ReplaceAll(input, " ", "")input = strings.ReplaceAll(input, "-", "")input = strings.ReplaceAll(input, "(", "")input = strings.ReplaceAll(input, ")", "")// Hilangkan semua karakter non-digit kecuali +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:]}// 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}func (s *UserProfileService) Create() {phoneNumber := *s.Constructor.PhoneNumber*s.Constructor.PhoneNumber = SanitizePhoneNumber(phoneNumber)userProfile := repositories.CreateAccountDetails(s.Constructor)s.Error = userProfile.RowsErrorif userProfile.NoRecord {1 unmodified lines.Exception.Message = "There is no account with given credentials!"return}s.Result = models.UserProfileResponse{Account: repositories.GetAccountById(s.Constructor.AccountID).Result,Details: userProfile.Result,}}func (s *UserProfileService) Retrieve() {userProfile := repositories.GetDetailAccountById(s.Constructor.AccountID)3 unmodified liness.Exception.Message = "There is no account with given credentials!"return}s.Result = models.UserProfileResponse{Account: repositories.GetAccountById(s.Constructor.AccountID).Result,Details: userProfile.Result,}}func (s *UserProfileService) Update() {phoneNumber := *s.Constructor.PhoneNumber*s.Constructor.PhoneNumber = SanitizePhoneNumber(phoneNumber)userProfile := repositories.UpdateAccountDetails(s.Constructor)s.Error = userProfile.RowsErrorif userProfile.NoRecord {1 unmodified lines.Exception.Message = "There is no account with given credentials!"return}s.Result = models.UserProfileResponse{Account: repositories.GetAccountById(s.Constructor.AccountID).Result,Details: userProfile.Result,}}
12345.envvendor/quzuu-be.exeREADME.md.qodo1234567.envvendor/quzuu-be.exeREADME.md.qodo.errorlogs/
8 unmodified lines91011121314151617181 unmodified line20212223248 unmodified linesvar TCP_ADDRESS stringvar LOG_PATH stringvar HOST_ADDRESS stringvar HOST_PORT stringvar EMAIL_VERIFICATION_DURATION intfunc init() {godotenv.Load()HOST_ADDRESS = os.Getenv("HOST_ADDRESS")1 unmodified lineTCP_ADDRESS = HOST_ADDRESS + ":" + HOST_PORTLOG_PATH = os.Getenv("LOG_PATH")EMAIL_VERIFICATION_DURATION, _ = strconv.Atoi(os.Getenv("EMAIL_VERIFICATION_DURATION"))// Menampilkan nilai variabel lingkungan}8 unmodified lines91011121314151617181920212223241 unmodified line2627282930313233348 unmodified linesvar TCP_ADDRESS stringvar LOG_PATH stringvar HOST_ADDRESS stringvar HOST_PORT stringvar EMAIL_VERIFICATION_DURATION intvar SMTP_SENDER_EMAIL stringvar SMTP_SENDER_PASSWORD stringvar SMTP_HOST stringvar SMTP_PORT stringfunc init() {godotenv.Load()HOST_ADDRESS = os.Getenv("HOST_ADDRESS")1 unmodified lineTCP_ADDRESS = HOST_ADDRESS + ":" + HOST_PORTLOG_PATH = os.Getenv("LOG_PATH")EMAIL_VERIFICATION_DURATION, _ = strconv.Atoi(os.Getenv("EMAIL_VERIFICATION_DURATION"))SMTP_SENDER_EMAIL = os.Getenv("SMTP_SENDER_EMAIL")SMTP_SENDER_PASSWORD = os.Getenv("SMTP_SENDER_PASSWORD")SMTP_HOST = os.Getenv("SMTP_HOST")SMTP_PORT = os.Getenv("SMTP_PORT")// Menampilkan nilai variabel lingkungan}
59 unmodified lines60616263646559 unmodified lines&models.AcademyContent{},&models.AcademyMaterialProgress{},&models.AcademyContentProgress{},)if err != nil {59 unmodified lines6061626364656667686959 unmodified lines&models.AcademyContent{},&models.AcademyMaterialProgress{},&models.AcademyContentProgress{},&models.RegionCity{},&models.RegionProvince{},&models.OptionCategory{},&models.OptionValues{},)if err != nil {
1234567891011121314151617181920package auth
import (
"api.qobiltu.id/controller"
"api.qobiltu.id/models"
"api.qobiltu.id/services"
"github.com/gin-gonic/gin"
)
func ExternalAuth(c *gin.Context) {
ExternalAuthController := controller.Controller[models.ExternalAuthRequest, models.ExternalAuth, models.AuthenticatedUser]{}
ExternalAuthController.RequestJSON(c, func() {
if ExternalAuthController.Request.OauthProvider == "google" {
GoogleLogin := services.GoogleAuthService{}
ExternalAuthController.Service = &GoogleLogin.Service
ExternalAuthController.Service.Constructor.OauthID = ExternalAuthController.Request.OauthID
GoogleLogin.Authenticate()
}
})
}1package auth123456789101112131415161718192021package controller
import (
"api.qobiltu.id/controller"
"api.qobiltu.id/models"
"api.qobiltu.id/services"
"github.com/gin-gonic/gin"
)
func CreateVerification(c *gin.Context) {
emailVerification := services.EmailVerificationService{}
emailVerificationController := controller.Controller[models.CreateVerifyEmailRequest, models.EmailVerification, models.EmailVerification]{
Service: &emailVerification.Service,
}
emailVerificationController.HeaderParse(c, func() {
emailVerificationController.Service.Constructor.AccountID = uint(emailVerificationController.AccountData.UserID)
emailVerification.Create()
emailVerificationController.Response(c)
})
}123456789101112131415161718192021222324package controller
import (
"api.qobiltu.id/controller"
"api.qobiltu.id/models"
"api.qobiltu.id/services"
"github.com/gin-gonic/gin"
)
func Verify(c *gin.Context) {
emailVerification := services.EmailVerificationService{}
emailVerificationController := controller.Controller[models.CreateVerifyEmailRequest, models.EmailVerification, models.EmailVerification]{
Service: &emailVerification.Service,
}
emailVerificationController.HeaderParse(c, func() {
emailVerificationController.Service.Constructor.AccountID = uint(emailVerificationController.AccountData.UserID)
emailVerificationController.RequestJSON(c, func() {
emailVerificationController.Service.Constructor.Token = emailVerificationController.Request.Token
emailVerificationController.Service.Constructor.UUID = emailVerificationController.Request.UUID
emailVerification.Validate()
})
})
}12345678910111213141516171819package options
import (
"api.qobiltu.id/controller"
"api.qobiltu.id/models"
"api.qobiltu.id/services"
"github.com/gin-gonic/gin"
)
func AddOptions(c *gin.Context) {
options := services.OptionService{}
addOptionController := controller.Controller[[]models.OptionsRequest, []models.OptionsRequest, models.OptionsResponse]{
Service: &options.Service,
}
addOptionController.RequestJSON(c, func() {
options.Constructor = addOptionController.Request
options.Create()
})
}12345678910111213141516171819package options
import (
"api.qobiltu.id/controller"
"api.qobiltu.id/models"
"api.qobiltu.id/services"
"github.com/gin-gonic/gin"
)
func List(c *gin.Context) {
options := services.OptionValueService{}
optionValueController := controller.Controller[any, models.OptionCategory, models.Options]{
Service: &options.Service,
}
slug := c.Param("slug")
options.Constructor.OptionSlug = slug
options.Retrieve()
optionValueController.Response(c)
}123456789101112131415161718192021package city
import (
"strconv"
"api.qobiltu.id/controller"
"api.qobiltu.id/models"
"api.qobiltu.id/services"
"github.com/gin-gonic/gin"
)
func List(c *gin.Context) {
city := services.CityService{}
CityController := controller.Controller[any, models.RegionCity, []models.RegionCity]{
Service: &city.Service,
}
ProvinceID, _ := strconv.Atoi(c.Query("province_id"))
city.Constructor.ProvinceID = uint(ProvinceID)
city.Retrieve()
CityController.Response(c)
}1234567891011121314151617package city
import (
"api.qobiltu.id/controller"
"api.qobiltu.id/models"
"api.qobiltu.id/services"
"github.com/gin-gonic/gin"
)
func Seeds(c *gin.Context) {
city := services.CityService{}
CityController := controller.Controller[any, models.RegionCity, []models.RegionCity]{
Service: &city.Service,
}
city.Create()
CityController.Response(c)
}1234567891011121314151617package province
import (
"api.qobiltu.id/controller"
"api.qobiltu.id/models"
"api.qobiltu.id/services"
"github.com/gin-gonic/gin"
)
func List(c *gin.Context) {
province := services.ProvinceService{}
ProvinceController := controller.Controller[any, models.RegionProvince, []models.RegionProvince]{
Service: &province.Service,
}
province.Retrieve()
ProvinceController.Response(c)
}1234567891011121314151617package province
import (
"api.qobiltu.id/controller"
"api.qobiltu.id/models"
"api.qobiltu.id/services"
"github.com/gin-gonic/gin"
)
func Seeds(c *gin.Context) {
province := services.ProvinceService{}
ProvinceController := controller.Controller[any, models.RegionProvince, []models.RegionProvince]{
Service: &province.Service,
}
province.Create()
ProvinceController.Response(c)
}12 unmodified lines1314151617181920212223242526278 unmodified lines363738394041424344454647484912 unmodified lines)require (github.com/bytedance/sonic v1.13.1 // indirectgithub.com/bytedance/sonic/loader v0.2.4 // indirectgithub.com/cloudwego/base64x v0.1.5 // indirectgithub.com/gabriel-vasile/mimetype v1.4.8 // indirectgithub.com/gin-contrib/sse v1.0.0 // indirectgithub.com/go-playground/locales v0.14.1 // indirectgithub.com/go-playground/universal-translator v0.18.1 // indirectgithub.com/go-playground/validator/v10 v10.25.0 // indirectgithub.com/goccy/go-json v0.10.5 // indirectgithub.com/jackc/pgpassfile v1.0.0 // indirectgithub.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirectgithub.com/jackc/pgx/v5 v5.7.2 // indirect8 unmodified linesgithub.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirectgithub.com/modern-go/reflect2 v1.0.2 // indirectgithub.com/pelletier/go-toml/v2 v2.2.3 // indirectgithub.com/rogpeppe/go-internal v1.11.0 // indirectgithub.com/twitchyliquid64/golang-asm v0.15.1 // indirectgithub.com/ugorji/go/codec v1.2.12 // indirectgolang.org/x/arch v0.15.0 // indirectgolang.org/x/net v0.37.0 // indirectgolang.org/x/sync v0.12.0 // indirectgolang.org/x/sys v0.31.0 // indirectgolang.org/x/text v0.23.0 // indirectgoogle.golang.org/protobuf v1.36.5 // indirectgopkg.in/yaml.v3 v3.0.1 // indirect)12 unmodified lines13141516171819202122232425262728293031323334353637388 unmodified lines47484950515253545556575859606162636465666768697012 unmodified lines)require (cloud.google.com/go/auth v0.15.0 // indirectcloud.google.com/go/auth/oauth2adapt v0.2.8 // indirectcloud.google.com/go/compute/metadata v0.6.0 // indirectgithub.com/bytedance/sonic v1.13.1 // indirectgithub.com/bytedance/sonic/loader v0.2.4 // indirectgithub.com/cloudwego/base64x v0.1.5 // indirectgithub.com/felixge/httpsnoop v1.0.4 // indirectgithub.com/gabriel-vasile/mimetype v1.4.8 // indirectgithub.com/gin-contrib/sse v1.0.0 // indirectgithub.com/go-logr/logr v1.4.2 // indirectgithub.com/go-logr/stdr v1.2.2 // indirectgithub.com/go-playground/locales v0.14.1 // indirectgithub.com/go-playground/universal-translator v0.18.1 // indirectgithub.com/go-playground/validator/v10 v10.25.0 // indirectgithub.com/goccy/go-json v0.10.5 // indirectgithub.com/google/s2a-go v0.1.9 // indirectgithub.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirectgithub.com/googleapis/gax-go/v2 v2.14.1 // indirectgithub.com/gosimple/slug v1.15.0 // indirectgithub.com/gosimple/unidecode v1.0.1 // indirectgithub.com/jackc/pgpassfile v1.0.0 // indirectgithub.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirectgithub.com/jackc/pgx/v5 v5.7.2 // indirect8 unmodified linesgithub.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirectgithub.com/modern-go/reflect2 v1.0.2 // indirectgithub.com/pelletier/go-toml/v2 v2.2.3 // indirectgithub.com/rogpeppe/go-internal v1.13.1 // indirectgithub.com/twitchyliquid64/golang-asm v0.15.1 // indirectgithub.com/ugorji/go/codec v1.2.12 // indirectgo.opentelemetry.io/auto/sdk v1.1.0 // indirectgo.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0 // indirectgo.opentelemetry.io/otel v1.34.0 // indirectgo.opentelemetry.io/otel/metric v1.34.0 // indirectgo.opentelemetry.io/otel/trace v1.34.0 // indirectgolang.org/x/arch v0.15.0 // indirectgolang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirectgolang.org/x/net v0.37.0 // indirectgolang.org/x/oauth2 v0.28.0 // indirectgolang.org/x/sync v0.12.0 // indirectgolang.org/x/sys v0.31.0 // indirectgolang.org/x/text v0.23.0 // indirectgoogle.golang.org/api v0.228.0 // indirectgoogle.golang.org/genproto/googleapis/rpc v0.0.0-20250313205543-e70fdf4c4cb4 // indirectgoogle.golang.org/grpc v1.71.0 // indirectgoogle.golang.org/protobuf v1.36.6 // indirectgopkg.in/yaml.v3 v3.0.1 // indirect)
1236 unmodified lines1011121314151617181920219 unmodified lines31323334353633 unmodified lines70717273747512 unmodified lines8889909192939495969798993 unmodified lines103104105106107108109110github.com/bytedance/sonic v1.13.1 h1:Jyd5CIvdFnkOWuKXr+wm4Nyk2h0yAFsr8ucJgEasO3g=github.com/bytedance/sonic v1.13.1/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4=github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=6 unmodified linesgithub.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM=github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8=github.com/gin-contrib/sse v1.0.0 h1:y3bT1mUWUxDpW4JLQg/HnTqV4rozuW4tC9eFKTxYI9E=github.com/gin-contrib/sse v1.0.0/go.mod h1:zNuFdwarAygJBht0NTKiSi3jRf6RbqeILZ9Sp6Slhe0=github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=9 unmodified linesgithub.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=33 unmodified linesgithub.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=12 unmodified linesgithub.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=golang.org/x/arch v0.15.0 h1:QtOrQd0bTUnhNVNndMpLHNWrDmYzZ2KDqSrEymqInZw=golang.org/x/arch v0.15.0/go.mod h1:JmwW7aLIoRUKgaTzhkiEFxvcEiQGyOg9BMonBJUS7EE=golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c=golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=3 unmodified linesgolang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=1234567896 unmodified lines161718192021222324252627282930313233349 unmodified lines4445464748495051525354555657585933 unmodified lines9394959697989912 unmodified lines1121131141151161171181191201211221231241251261271281291301311321331341351361373 unmodified lines141142143144145146147148149150151152153154155156cloud.google.com/go/auth v0.15.0 h1:Ly0u4aA5vG/fsSsxu98qCQBemXtAtJf+95z9HK+cxps=cloud.google.com/go/auth v0.15.0/go.mod h1:WJDGqZ1o9E9wKIL+IwStfyn/+s59zl4Bi+1KQNVXLZ8=cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIiLpZnkHRbnc=cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c=cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I=cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg=github.com/bytedance/sonic v1.13.1 h1:Jyd5CIvdFnkOWuKXr+wm4Nyk2h0yAFsr8ucJgEasO3g=github.com/bytedance/sonic v1.13.1/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4=github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=6 unmodified linesgithub.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM=github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8=github.com/gin-contrib/sse v1.0.0 h1:y3bT1mUWUxDpW4JLQg/HnTqV4rozuW4tC9eFKTxYI9E=github.com/gin-contrib/sse v1.0.0/go.mod h1:zNuFdwarAygJBht0NTKiSi3jRf6RbqeILZ9Sp6Slhe0=github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=9 unmodified linesgithub.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0=github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM=github.com/googleapis/enterprise-certificate-proxy v0.3.6 h1:GW/XbdyBFQ8Qe+YAmFU9uHLo7OnF5tL52HFAgMmyrf4=github.com/googleapis/enterprise-certificate-proxy v0.3.6/go.mod h1:MkHOF77EYAE7qfSuSS9PU6g4Nt4e11cnsDUowfwewLA=github.com/googleapis/gax-go/v2 v2.14.1 h1:hb0FFeiPaQskmvakKu5EbCbpntQn48jyHuvrkurSS/Q=github.com/googleapis/gax-go/v2 v2.14.1/go.mod h1:Hb/NubMaVM88SrNkvl8X/o8XWwDJEPqouaLeN2IUxoA=github.com/gosimple/slug v1.15.0 h1:wRZHsRrRcs6b0XnxMUBM6WK1U1Vg5B0R7VkIf1Xzobo=github.com/gosimple/slug v1.15.0/go.mod h1:UiRaFH+GEilHstLUmcBgWcI42viBN7mAb818JrYOeFQ=github.com/gosimple/unidecode v1.0.1 h1:hZzFTMMqSswvf0LBJZCZgThIZrpDHFXux9KeGmn6T/o=github.com/gosimple/unidecode v1.0.1/go.mod h1:CP0Cr1Y1kogOtx0bJblKzsVWrqYaqfNOnHzpgWw4Awc=github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=33 unmodified linesgithub.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=12 unmodified linesgithub.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0 h1:CV7UdSGJt/Ao6Gp4CXckLxVRRsRgDHoI8XjbL3PDl8s=go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0/go.mod h1:FRmFuRJfag1IZ2dPkHnEoSFVgTVPUd2qf5Vi69hLb8I=go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY=go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI=go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ=go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE=go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k=go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE=golang.org/x/arch v0.15.0 h1:QtOrQd0bTUnhNVNndMpLHNWrDmYzZ2KDqSrEymqInZw=golang.org/x/arch v0.15.0/go.mod h1:JmwW7aLIoRUKgaTzhkiEFxvcEiQGyOg9BMonBJUS7EE=golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw=golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM=golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c=golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=golang.org/x/oauth2 v0.28.0 h1:CrgCKl8PPAVtLnU3c+EDw6x11699EWlsDeWNWKdIOkc=golang.org/x/oauth2 v0.28.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8=golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=3 unmodified linesgolang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=google.golang.org/api v0.228.0 h1:X2DJ/uoWGnY5obVjewbp8icSL5U4FzuCfy9OjbLSnLs=google.golang.org/api v0.228.0/go.mod h1:wNvRS1Pbe8r4+IfBIniV8fwCpGwTrYa+kMUDiC5z5a4=google.golang.org/genproto/googleapis/rpc v0.0.0-20250313205543-e70fdf4c4cb4 h1:iK2jbkWL86DXjEx0qiHcRE9dE4/Ahua5k6V8OWFb//c=google.golang.org/genproto/googleapis/rpc v0.0.0-20250313205543-e70fdf4c4cb4/go.mod h1:LuRYeWDFV6WOn90g357N17oMCaxpgCnbi/44qJvDn2I=google.golang.org/grpc v1.71.0 h1:kF77BGdPTQ4/JZWMlb9VpJ5pa25aqvVqogsxNHHdeBg=google.golang.org/grpc v1.71.0/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec=google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
2 unmodified lines3456784 unmodified lines13141516171819202122232 unmodified linespackage middlewareimport ("api.qobiltu.id/models""api.qobiltu.id/services""api.qobiltu.id/utils"4 unmodified linesvar currAccData models.AccountDataif c.Request.Header["Authorization"] != nil {token := c.Request.Header["Authorization"]// fmt.Println("Authorization :", token)currAccData.UserID, currAccData.VerifyStatus, currAccData.ErrVerif = services.VerifyToken(token[0])// fmt.Println("Verify Status :", currAccData.VerifyStatus)// fmt.Println("Verify UserID :", currAccData.UserID)if currAccData.VerifyStatus == "invalid-token" || currAccData.VerifyStatus == "expired" {currAccData.UserID = 02 unmodified lines3456789104 unmodified lines1516171819202122232 unmodified linespackage middlewareimport ("fmt""api.qobiltu.id/models""api.qobiltu.id/services""api.qobiltu.id/utils"4 unmodified linesvar currAccData models.AccountDataif c.Request.Header["Authorization"] != nil {token := c.Request.Header["Authorization"]currAccData.UserID, currAccData.VerifyStatus, currAccData.ErrVerif = services.VerifyToken(token[0])fmt.Println(token[0])if currAccData.VerifyStatus == "invalid-token" || currAccData.VerifyStatus == "expired" {currAccData.UserID = 0
123456 unmodified lines1213141516171819202122package modelstype LoginRequest struct {Email string `json:"email" binding:"required"`Password string `json:"password" binding:"required"`6 unmodified linesPassword string `json:"password" binding:"required"`}type CreateEmailVerificationRequest struct {AccountID int `json:"account_id" binding:"required"`}type ChangePasswordRequest struct {OldPassword string `json:"old_password" binding:"required" `NewPassword string `json:"new_password" binding:"required" `}12345676 unmodified lines14151617181920212223242526272829303132333435package modelsimport uuid "github.com/satori/go.uuid"type LoginRequest struct {Email string `json:"email" binding:"required"`Password string `json:"password" binding:"required"`6 unmodified linesPassword string `json:"password" binding:"required"`}type ChangePasswordRequest struct {OldPassword string `json:"old_password" binding:"required" `NewPassword string `json:"new_password" binding:"required" `}type CreateVerifyEmailRequest struct {Token uint `json:"token" binding:"required"`UUID uuid.UUID `json:"uuid" binding:"required"`}type OptionsRequest struct {OptionName string `json:"option_name" binding:"required"`OptionValue []string `json:"option_values" binding:"required"`}type ExternalAuthRequest struct {OauthID string `json:"oauth_id" binding:"required"`OauthProvider string `json:"oauth_provider" binding:"required"`}
17 unmodified lines18192017 unmodified linesAccount Account `json:"account"`Token string `json:"token"`}17 unmodified lines1819202122232425262717 unmodified linesAccount Account `json:"account"`Token string `json:"token"`}type Options struct {OptionCategory OptionCategory `json:"option_category"`OptionValues []OptionValues `json:"option_values"`}type OptionsResponse struct {Options []Options `json:"options"`}
3 unmodified lines45678910111213141516171815 unmodified lines3435363738393 unmodified lines"time""api.qobiltu.id/models")func CreateEmailVerification(accountId uint, dueTime time.Time, token uint) Repository[models.EmailVerification, models.EmailVerification] {repo := Construct[models.EmailVerification, models.EmailVerification](models.EmailVerification{AccountID: accountId,IsExpired: false,ExpiredAt: dueTime,Token: token,},)Create(repo)15 unmodified linesreturn *repo}func DeleteEmailVerification(token uint) Repository[models.EmailVerification, models.EmailVerification] {repo := Construct[models.EmailVerification, models.EmailVerification](models.EmailVerification{3 unmodified lines456789101112131415161718192015 unmodified lines3637383940414243444546474849505152533 unmodified lines"time""api.qobiltu.id/models"uuid "github.com/satori/go.uuid")func CreateEmailVerification(uuid uuid.UUID, accountId uint, dueTime time.Time, token uint) Repository[models.EmailVerification, models.EmailVerification] {repo := Construct[models.EmailVerification, models.EmailVerification](models.EmailVerification{AccountID: accountId,IsExpired: false,ExpiredAt: dueTime,Token: token,UUID: uuid,},)Create(repo)15 unmodified linesreturn *repo}func UpdateExpiredEmailVerification(uuid uuid.UUID) Repository[models.EmailVerification, models.EmailVerification] {repo := Construct[models.EmailVerification, models.EmailVerification](models.EmailVerification{UUID: uuid},)repo.Transaction.Where("UUID = ?", uuid).First(&repo.Constructor)repo.Constructor.IsExpired = truerepo.Transaction.Updates(repo.Constructor)repo.Result = repo.Constructorreturn *repo}func DeleteEmailVerification(token uint) Repository[models.EmailVerification, models.EmailVerification] {repo := Construct[models.EmailVerification, models.EmailVerification](models.EmailVerification{
12345678910111213141516171819202122232425262728293031323334353637package repositories
import "api.qobiltu.id/models"
func CreateExternalAuth(oauth models.ExternalAuth) Repository[models.ExternalAuth, models.ExternalAuth] {
repo := Construct[models.ExternalAuth, models.ExternalAuth](
oauth,
)
Create(repo)
return *repo
}
func GetExternalAuthByAccountId(accountId uint) Repository[models.ExternalAuth, []models.ExternalAuth] {
repo := Construct[models.ExternalAuth, []models.ExternalAuth](
models.ExternalAuth{
AccountID: accountId,
},
)
repo.Transactions(
WhereGivenConstructor[models.ExternalAuth, []models.ExternalAuth],
Find[models.ExternalAuth, []models.ExternalAuth],
)
return *repo
}
func GetExternalAccountByOauthId(oauthId string) Repository[models.ExternalAuth, models.ExternalAuth] {
repo := Construct[models.ExternalAuth, models.ExternalAuth](
models.ExternalAuth{
OauthID: oauthId,
},
)
repo.Transactions(
WhereGivenConstructor[models.ExternalAuth, models.ExternalAuth],
Find[models.ExternalAuth, models.ExternalAuth],
)
return *repo
}12345678910111213141516171819202122232425262728293031323334353637383940414243package repositories
import (
"api.qobiltu.id/models"
)
func CreateOptionCategory(categories models.OptionCategory) Repository[models.OptionCategory, models.OptionCategory] {
repo := Construct[models.OptionCategory, models.OptionCategory](
categories,
)
Create(repo)
return *repo
}
func CreateOptionValues(values models.OptionValues) Repository[models.OptionValues, models.OptionValues] {
repo := Construct[models.OptionValues, models.OptionValues](
values,
)
Create(repo)
return *repo
}
func GetOptionCategoryBySlug(slug string) Repository[models.OptionCategory, models.OptionCategory] {
repo := Construct[models.OptionCategory, models.OptionCategory](
models.OptionCategory{OptionSlug: slug},
)
repo.Transactions(
WhereGivenConstructor[models.OptionCategory, models.OptionCategory],
Find[models.OptionCategory, models.OptionCategory],
)
return *repo
}
func GetOptionValuesByCategoryId(categoryId uint) Repository[models.OptionValues, []models.OptionValues] {
repo := Construct[models.OptionValues, []models.OptionValues](
models.OptionValues{OptionCategoryID: categoryId},
)
repo.Transactions(
WhereGivenConstructor[models.OptionValues, []models.OptionValues],
Find[models.OptionValues, []models.OptionValues],
)
return *repo
}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647package repositories
import (
"api.qobiltu.id/models"
)
func BulkCreateProvince(provinces []models.RegionProvince) Repository[[]models.RegionProvince, []models.RegionProvince] {
repo := Construct[[]models.RegionProvince, []models.RegionProvince](
provinces,
)
Create(repo)
return *repo
}
func BulkCreateCity(cities []models.RegionCity) Repository[[]models.RegionCity, []models.RegionCity] {
repo := Construct[[]models.RegionCity, []models.RegionCity](
cities,
)
Create(repo)
return *repo
}
func GetListProvinces() Repository[models.RegionProvince, []models.RegionProvince] {
repo := Construct[models.RegionProvince, []models.RegionProvince](
models.RegionProvince{},
)
repo.Transactions(
Find[models.RegionProvince, []models.RegionProvince],
)
return *repo
}
func GetListCitiesByProvinceId(provinceId uint) Repository[models.RegionCity, []models.RegionCity] {
repo := Construct[models.RegionCity, []models.RegionCity](
models.RegionCity{
ProvinceID: provinceId,
},
)
repo.Transactions(
WhereGivenConstructor[models.RegionCity, []models.RegionCity],
Find[models.RegionCity, []models.RegionCity],
)
return *repo
}8 unmodified lines910111213148 unmodified linesfunc AuthRoute(router *gin.Engine) {routerGroup := router.Group("/api/v1/auth"){routerGroup.POST("/login", AuthController.Login)routerGroup.POST("/register", AuthController.Register)routerGroup.PUT("/change-password", middleware.AuthUser, AuthController.ChangePassword)8 unmodified lines91011121314158 unmodified linesfunc AuthRoute(router *gin.Engine) {routerGroup := router.Group("/api/v1/auth"){routerGroup.POST("/external-login", AuthController.ExternalAuth)routerGroup.POST("/login", AuthController.Login)routerGroup.POST("/register", AuthController.Register)routerGroup.PUT("/change-password", middleware.AuthUser, AuthController.ChangePassword)
1 unmodified line234567891011121314151 unmodified lineimport (EmailController "api.qobiltu.id/controller/email""github.com/gin-gonic/gin")func EmailRoute(router *gin.Engine) {routerGroup := router.Group("/api/v1/email"){routerGroup.POST("/verify", EmailController.CreateVerification)routerGroup.POST("/create-verification", EmailController.CreateVerification)routerGroup.DELETE("/delete-verification", EmailController.DeleteVerification)}}1 unmodified line234567891011121314151 unmodified lineimport (EmailController "api.qobiltu.id/controller/email""api.qobiltu.id/middleware""github.com/gin-gonic/gin")func EmailRoute(router *gin.Engine) {routerGroup := router.Group("/api/v1/email"){routerGroup.POST("/verify", middleware.AuthUser, EmailController.Verify)routerGroup.POST("/create-verification", middleware.AuthUser, EmailController.CreateVerification)}}
1234567891011121314151617181920package router
import (
OptionsController "api.qobiltu.id/controller/options"
CityController "api.qobiltu.id/controller/region/city"
ProvinceController "api.qobiltu.id/controller/region/province"
"github.com/gin-gonic/gin"
)
func OptionsRoute(router *gin.Engine) {
routerGroup := router.Group("/api/v1/options")
{
routerGroup.POST("/create", OptionsController.AddOptions)
routerGroup.GET("/list/:slug", OptionsController.List)
routerGroup.GET("/region/provinces", ProvinceController.List)
routerGroup.GET("/region/cities", CityController.List)
routerGroup.POST("/region/seed-provinces", ProvinceController.Seeds)
routerGroup.POST("/region/seed-cities", CityController.Seeds)
}
}11 unmodified lines121314151611 unmodified linesAuthRoute(router)UserRoute(router)EmailRoute(router)router.Run(config.TCP_ADDRESS)}11 unmodified lines12131415161711 unmodified linesAuthRoute(router)UserRoute(router)EmailRoute(router)OptionsRoute(router)router.Run(config.TCP_ADDRESS)}
1 unmodified line234567836 unmodified lines4546474849505152535455565758591 unmodified lineimport ("errors""fmt""api.qobiltu.id/models""api.qobiltu.id/repositories"36 unmodified liness.Exception.Message = "Password must have at least 8 characters!"return}accountData := repositories.GetAccountbyId(s.Constructor.Id)if accountData.NoRecord {s.Exception.DataNotFound = trues.Exception.Message = "there is no account with given credentials!"return}fmt.Println("Result Password", accountData.Result.Password)fmt.Println("old Password given", oldPassword)if VerifyPassword(accountData.Result.Password, oldPassword) != nil {s.Exception.Unauthorized = trues.Exception.Message = "incorrect old password!"1 unmodified line23456736 unmodified lines444546474849505152535455561 unmodified lineimport ("errors""api.qobiltu.id/models""api.qobiltu.id/repositories"36 unmodified liness.Exception.Message = "Password must have at least 8 characters!"return}accountData := repositories.GetAccountById(s.Constructor.Id)if accountData.NoRecord {s.Exception.DataNotFound = trues.Exception.Message = "there is no account with given credentials!"return}if VerifyPassword(accountData.Result.Password, oldPassword) != nil {s.Exception.Unauthorized = trues.Exception.Message = "incorrect old password!"
space/services/email_verification_service.go+11-60
space/space/space/services/email_verification_service.go+60-11
space/space/space/space/services/user_profile_service.go+3-1
space/space/space/space/space/models/request_model.go+4-2
space/space/space/space/space/services/authentication_service.go+2
space/space/space/space/space/services/email_verification_service.go+4
space/space/space/space/space/services/user_profile_service.go+5-2
space/space/space/space/space/space/repositories/account_repository.go+9
space/space/space/space/space/space/services/external_authentication_service.go+1-1
space/space/space/space/space/space/services/user_profile_service.go+8
space/space/space/space/space/space/space/services/user_profile_service.go-2
space/space/space/space/space/space/space/space/docker-compose.yml+1-1
space/space/space/space/space/space/space/space/space/space/Dockerfile+3
space/space/space/space/space/space/space/space/space/space/space/space/space/controller/user/user_profile_controller.go+1-1
space/space/space/space/space/space/space/space/space/space/space/space/space/controller/user/user_update_profile_controller.go+2-4
space/space/space/space/space/space/space/space/space/space/space/space/space/logs/error_log.txt+1
space/space/space/space/space/space/space/space/space/space/space/space/space/middleware/authentication_middleware.go-3
space/space/space/space/space/space/space/space/space/space/space/space/space/models/response_model.go+5
space/space/space/space/space/space/space/space/space/space/space/space/space/repositories/account_repository.go-4
space/space/space/space/space/space/space/space/space/space/space/space/space/repositories/forgot_password_repository.goAdded+22
space/space/space/space/space/space/space/space/space/space/space/space/space/router/router.go+8-1
space/space/space/space/space/space/space/space/space/space/space/space/space/services/external_authentication_service.go+4-5
space/space/space/space/space/space/space/space/space/space/space/space/space/services/user_profile_service.go+50-6
space/space/space/space/space/space/space/space/space/space/space/space/space/space/.gitignore+4-2
space/space/space/space/space/space/space/space/space/space/space/space/space/space/config/config.go+10
space/space/space/space/space/space/space/space/space/space/space/space/space/space/config/database_connection_config.go+4
space/space/space/space/space/space/space/space/space/space/space/space/space/space/controller/auth/auth_external_controller.goAdded+20
space/space/space/space/space/space/space/space/space/space/space/space/space/space/controller/auth/auth_forgot_password_controller.goAdded+1
space/space/space/space/space/space/space/space/space/space/space/space/space/space/controller/email/email_create_verification_controller.goAdded+21
space/space/space/space/space/space/space/space/space/space/space/space/space/space/controller/email/email_validate_controller.goAdded+24
space/space/space/space/space/space/space/space/space/space/space/space/space/space/controller/options/option_category_controller.goAdded+19
space/space/space/space/space/space/space/space/space/space/space/space/space/space/controller/options/option_value_controller.goAdded+19
space/space/space/space/space/space/space/space/space/space/space/space/space/space/controller/region/city/city_list_controller.goAdded+21
space/space/space/space/space/space/space/space/space/space/space/space/space/space/controller/region/city/city_seeds_controller.goAdded+17
space/space/space/space/space/space/space/space/space/space/space/space/space/space/controller/region/province/province_list_controller.goAdded+17
space/space/space/space/space/space/space/space/space/space/space/space/space/space/controller/region/province/province_seeds_controller.goAdded+17
space/space/space/space/space/space/space/space/space/space/space/space/space/space/go.mod+23-2
space/space/space/space/space/space/space/space/space/space/space/space/space/space/go.sum+46
space/space/space/space/space/space/space/space/space/space/space/space/space/space/middleware/authentication_middleware.go+3-3
space/space/space/space/space/space/space/space/space/space/space/space/space/space/models/request_model.go+17-4
space/space/space/space/space/space/space/space/space/space/space/space/space/space/models/response_model.go+7
space/space/space/space/space/space/space/space/space/space/space/space/space/space/repositories/email_verification_repository.go+15-1
space/space/space/space/space/space/space/space/space/space/space/space/space/space/repositories/external_auth_repository.goAdded+37
space/space/space/space/space/space/space/space/space/space/space/space/space/space/repositories/option_repository.goAdded+43
space/space/space/space/space/space/space/space/space/space/space/space/space/space/repositories/region_repository.goAdded+47
space/space/space/space/space/space/space/space/space/space/space/space/space/space/router/auth_route.go+1
space/space/space/space/space/space/space/space/space/space/space/space/space/space/router/email_route.go+3-3
space/space/space/space/space/space/space/space/space/space/space/space/space/space/router/options_route.goAdded+20
space/space/space/space/space/space/space/space/space/space/space/space/space/space/router/router.go+1
space/space/space/space/space/space/space/space/space/space/space/space/space/space/services/authentication_service.go+1-4