Spaces:
Configuration error
Configuration error
Commit ·
464fa94
1
Parent(s): c771fff
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)
- .gitignore+4-2
- config/config.go+10
- config/database_connection_config.go+4
- controller/auth/auth_change_password_controller.go+1-1
- controller/auth/auth_external_controller.goAdded+20
- controller/auth/auth_forgot_password_controller.goAdded+1
- controller/auth/auth_login_controller.go+1-1
- controller/auth/auth_register_controller.go+1-1
- controller/email/email_create_verification_controller.goAdded+21
- controller/email/email_validate_controller.goAdded+24
- controller/options/option_category_controller.goAdded+19
- controller/options/option_value_controller.goAdded+19
- controller/region/city/city_list_controller.goAdded+21
- controller/region/city/city_seeds_controller.goAdded+17
- controller/region/province/province_list_controller.goAdded+17
- controller/region/province/province_seeds_controller.goAdded+17
- go.mod+23-2
- go.sum+46
- logs/error_log.txt-9
- middleware/authentication_middleware.go+3-3
- models/database_orm_model.go+33-5
- models/request_model.go+17-4
- models/response_model.go+7
- repositories/account_repository.go-1
- repositories/email_verification_repository.go+15-1
- repositories/external_auth_repository.goAdded+37
- repositories/option_repository.goAdded+43
- repositories/region_repository.goAdded+47
- router/auth_route.go+1
- router/email_route.go+3-3
- router/options_route.goAdded+20
- router/router.go+1
- services/authentication_service.go-3
- services/email_verification_service.go+36-1
- services/external_authentication_service.goAdded+55
- services/option_service.goAdded+70
- services/region_service.goAdded+90
- space/controller/email/email_create_verification.go+6-7
- space/controller/user/user_update_profile_controller.go+3
- space/logs/error_log.txt+9
- space/models/database_orm_model.go+2
- space/repositories/account_repository.go+12-5
- space/repositories/repository.go+1-1
- space/services/email_verification_service.go+5-5
- space/services/user_profile_service.go+3
- space/space/controller/user/auth_profile_controller.goAdded+21
- space/space/controller/user/auth_update_profile_controller.goAdded+24
- space/space/router/auth_route.go-2
- space/space/router/router.go+1
- space/space/space/models/database_orm_model.go+12-12
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 {
1234package userimport ("api.qobiltu.id/controller"1234package authimport ("api.qobiltu.id/controller"
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 auth1234package userimport ("api.qobiltu.id/controller"1234package authimport ("api.qobiltu.id/controller"
1234package userimport ("api.qobiltu.id/controller"1234package authimport ("api.qobiltu.id/controller"
123456789101112131415161718192021package 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=
1234567892025/03/23 11:04:52 Error Log : ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification (SQLSTATE 42P10)2025/03/23 11:06:58 Error Log : ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification (SQLSTATE 42P10)2025/03/23 11:24:49 Error Log : WHERE conditions required2025/03/23 11:58:50 Error Log : WHERE conditions required2025/03/23 12:01:28 Error Log : WHERE conditions required2025/03/24 19:52:15 Error Log : ERROR: nama tabel « account_details » ditentukan lebih dari satu kali (SQLSTATE 42712)2025/03/24 19:53:48 Error Log : ERROR: nama tabel « account_details » ditentukan lebih dari satu kali (SQLSTATE 42712)2025/03/24 19:54:14 Error Log : WHERE conditions required2025/03/24 19:55:31 Error Log : ERROR: nama tabel « account_details » ditentukan lebih dari satu kali (SQLSTATE 42712)
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
27 unmodified lines282930313233349 unmodified lines4445464748495051525337 unmodified lines919293949596979 unmodified lines1071081091101111126 unmodified lines11912012127 unmodified linesLastJob *string `json:"last_job"`Gender *bool `json:"gender"`LastEducation *string `json:"last_education"`MaritalStatus *bool `json:"marital_status"`Avatar *string `json:"avatar"`PhoneNumber *uint `json:"phone_number"`}9 unmodified lines}type ExternalAuth struct {ID uint `gorm:"primaryKey" json:"id"`OauthID string `json:"oauth_id"`AccountID uint `json:"account_id"`OauthProvider string `json:"oauth_provider"`}type FCM struct {37 unmodified linesAcademyMaterialID uint `json:"academy_material_id"`Description string `json:"description"`}type AcademyMaterialProgress struct {ID uint `gorm:"primaryKey" json:"id"`UUID uuid.UUID `gorm:"type:uuid" json:"uuid"`9 unmodified linesAcademyID uint `json:"academy_id"`}// Gorm table name settingsfunc (Account) TableName() string { return "account" }func (AccountDetails) TableName() string { return "account_details" }6 unmodified linesfunc (AcademyContent) TableName() string { return "academy_contents" }func (AcademyMaterialProgress) TableName() string { return "academy_materials_progress" }func (AcademyContentProgress) TableName() string { return "academy_contents_progress" }27 unmodified lines282930313233349 unmodified lines444546474849505152535437 unmodified lines92939495969798991001011021031041051061071089 unmodified lines1181191201211221231241251261271281291301311321331341351361371386 unmodified lines14514614714814927 unmodified linesLastJob *string `json:"last_job"`Gender *bool `json:"gender"`LastEducation *string `json:"last_education"`MaritalStatus *string `json:"marital_status"`Avatar *string `json:"avatar"`PhoneNumber *uint `json:"phone_number"`}9 unmodified lines}type ExternalAuth struct {ID uint `gorm:"primaryKey" json:"id"`UUID uuid.UUID `gorm:"type:uuid" json:"uuid" `OauthID string `json:"oauth_id"`AccountID uint `json:"account_id"`OauthProvider string `json:"oauth_provider"`}type FCM struct {37 unmodified linesAcademyMaterialID uint `json:"academy_material_id"`Description string `json:"description"`}type OptionCategory struct {ID uint `gorm:"primaryKey" json:"id"`OptionName string `json:"option_name"`OptionSlug string `json:"option_slug"`}type OptionValues struct {ID uint `gorm:"primaryKey" json:"id"`OptionCategoryID uint `json:"option_category_id"`OptionValue string `json:"option_value"`}type AcademyMaterialProgress struct {ID uint `gorm:"primaryKey" json:"id"`UUID uuid.UUID `gorm:"type:uuid" json:"uuid"`9 unmodified linesAcademyID uint `json:"academy_id"`}type RegionProvince struct {ID uint `json:"id"`Name string `json:"name"`Code string `json:"code"`}type RegionCity struct {ID uint `json:"id"`Type string `json:"type"`Name string `json:"name"`Code string `json:"code"`FullCode string `json:"full_code"`ProvinceID uint `json:"province_id"`}// Gorm table name settingsfunc (Account) TableName() string { return "account" }func (AccountDetails) TableName() string { return "account_details" }6 unmodified linesfunc (AcademyContent) TableName() string { return "academy_contents" }func (AcademyMaterialProgress) TableName() string { return "academy_materials_progress" }func (AcademyContentProgress) TableName() string { return "academy_contents_progress" }func (RegionProvince) TableName() string { return "region_provinces" }func (RegionCity) TableName() string { return "region_cities" }
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"`}
70 unmodified lines7172737475767770 unmodified lines}func UpdateAccountDetails(accountDetails models.AccountDetails) Repository[models.AccountDetails, models.AccountDetails] {fmt.Println("Account ID : ", accountDetails.AccountID)repo := Construct[models.AccountDetails, models.AccountDetails](models.AccountDetails{AccountID: accountDetails.AccountID},)70 unmodified lines71727374757670 unmodified lines}func UpdateAccountDetails(accountDetails models.AccountDetails) Repository[models.AccountDetails, models.AccountDetails] {repo := Construct[models.AccountDetails, models.AccountDetails](models.AccountDetails{AccountID: accountDetails.AccountID},)
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 line234567843 unmodified lines52535455565758591 unmodified lineimport ("errors""fmt""api.qobiltu.id/models""api.qobiltu.id/repositories"43 unmodified liness.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 line23456743 unmodified lines5152535455561 unmodified lineimport ("errors""api.qobiltu.id/models""api.qobiltu.id/repositories"43 unmodified liness.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!"
123456720 unmodified lines2829303132333435363738394041424344454647package servicesimport ("math/rand/v2""time""api.qobiltu.id/config"20 unmodified linestoken := uint(rand.IntN(100000))s.Constructor.UUID = uuid.NewV4()repo := repositories.CreateEmailVerification(s.Constructor.AccountID, dueTime, token)s.Error = repo.RowsErrors.Result = repo.Result}func (s *EmailVerificationService) Validate() {repo := repositories.GetEmailVerification(s.Constructor.AccountID, s.Constructor.Token)s.Error = repo.RowsErrorif repo.NoRecord {s.Exception.DataNotFound = trues.Exception.Message = "Invalid token!"return}s.Result = repo.Result}1234567891020 unmodified lines31323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182package servicesimport ("fmt""log""math/rand/v2""net/smtp""time""api.qobiltu.id/config"20 unmodified linestoken := uint(rand.IntN(100000))s.Constructor.UUID = uuid.NewV4()repo := repositories.CreateEmailVerification(s.Constructor.UUID, s.Constructor.AccountID, dueTime, token)s.Error = repo.RowsErrors.Result = repo.Result// ⬇ Kirim token ke email user menggunakan SMTPgo func(toEmail string, token uint) {from := config.SMTP_SENDER_EMAILpassword := config.SMTP_SENDER_PASSWORDsmtpHost := 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 {log.Printf("Error sending verification email: %v", err)}}(accountRepo.Result.Email, token)}func (s *EmailVerificationService) Validate() {repo := repositories.GetEmailVerification(s.Constructor.AccountID, s.Constructor.Token)s.Error = repo.RowsErrorif repo.NoRecord {s.Exception.DataNotFound = trues.Exception.Message = "Invalid token!"return}if repo.Result.ExpiredAt.Before(time.Now()) {s.Exception.Unauthorized = trues.Exception.Message = "Token has expired!"repositories.UpdateExpiredEmailVerification(s.Constructor.UUID)return}s.Result = repo.Result}
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455package services
import (
"context"
"errors"
"api.qobiltu.id/models"
"api.qobiltu.id/repositories"
uuid "github.com/satori/go.uuid"
"google.golang.org/api/idtoken"
)
type GoogleAuthService struct {
Service[models.ExternalAuth, models.AuthenticatedUser]
}
func (s *GoogleAuthService) Authenticate() {
GoogleAuth := repositories.GetExternalAccountByOauthId(s.Constructor.OauthID)
payload, errGoogleAuth := idtoken.Validate(context.Background(), s.Constructor.OauthID, "")
s.Error = errGoogleAuth
if errGoogleAuth != nil {
s.Exception.Unauthorized = true
s.Exception.Message = "Oauth Provider Failed Login (Google Authentication)"
return
}
email := payload.Claims["email"]
if GoogleAuth.NoRecord {
s.Constructor.UUID = uuid.NewV4()
s.Constructor.OauthProvider = "Google"
createGoogleAuth := repositories.CreateExternalAuth(s.Constructor)
s.Error = createGoogleAuth.RowsError
createAccount := repositories.CreateAccount(models.Account{
Email: email.(string),
IsEmailVerified: true,
})
s.Error = errors.Join(s.Error, createAccount.RowsError)
}
accountData := repositories.GetAccountById(GoogleAuth.Result.AccountID)
token, err_tok := GenerateToken(&accountData.Result)
if err_tok != nil {
s.Error = errors.Join(s.Error, err_tok)
}
accountData.Result.Password = "SECRET"
s.Result = models.AuthenticatedUser{
Account: accountData.Result,
Token: token,
}
s.Error = accountData.RowsError
}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970package services
import (
"api.qobiltu.id/models"
"api.qobiltu.id/repositories"
"github.com/gosimple/slug"
)
type OptionService struct {
Service[[]models.OptionsRequest, models.OptionsResponse]
}
type OptionValueService struct {
Service[models.OptionCategory, models.Options]
}
func (s *OptionService) Create() {
optionsResult := []models.Options{}
for _, option := range s.Constructor {
OptionCategoryRepo := repositories.CreateOptionCategory(
models.OptionCategory{
OptionName: option.OptionName,
OptionSlug: slug.Make(option.OptionName),
},
)
if OptionCategoryRepo.RowsError != nil {
OptionCategoryRepo.Transaction.Rollback()
s.Error = OptionCategoryRepo.RowsError
return
}
optionsValueResult := []models.OptionValues{}
for _, value := range option.OptionValue {
OptionValuesRepo := repositories.CreateOptionValues(
models.OptionValues{
OptionCategoryID: OptionCategoryRepo.Result.ID,
OptionValue: value,
},
)
if OptionValuesRepo.RowsError != nil {
OptionValuesRepo.Transaction.Rollback()
s.Error = OptionValuesRepo.RowsError
return
}
optionsValueResult = append(optionsValueResult, OptionValuesRepo.Result)
}
optionsResult = append(optionsResult, models.Options{OptionCategory: OptionCategoryRepo.Result, OptionValues: optionsValueResult})
}
s.Result = models.OptionsResponse{
Options: optionsResult,
}
}
func (s *OptionValueService) Retrieve() {
optionCategory := repositories.GetOptionCategoryBySlug(s.Constructor.OptionSlug)
if optionCategory.RowsError != nil {
s.Error = optionCategory.RowsError
return
}
optionValues := repositories.GetOptionValuesByCategoryId(optionCategory.Result.ID)
if optionValues.RowsError != nil {
s.Error = optionValues.RowsError
return
}
s.Result = models.Options{
OptionCategory: optionCategory.Result,
OptionValues: optionValues.Result,
}
}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990package services
import (
"encoding/json"
"log"
"os"
"path/filepath"
"runtime"
"api.qobiltu.id/models"
"api.qobiltu.id/repositories"
)
type ProvinceService struct {
Service[models.RegionProvince, []models.RegionProvince]
}
type CityService struct {
Service[models.RegionCity, []models.RegionCity]
}
func seedCity() ([]models.RegionCity, error) {
log.Println("Seed City")
_, b, _, _ := runtime.Caller(0)
basePath := filepath.Dir(b)
file, err := os.Open(filepath.Join(basePath, "..", "utils", "seeds", "city.json"))
if err != nil {
return nil, err
}
defer file.Close()
var cities []models.RegionCity
if err := json.NewDecoder(file).Decode(&cities); err != nil {
return nil, err
}
return cities, nil
}
func seedProvince() ([]models.RegionProvince, error) {
log.Println("Seed City")
_, b, _, _ := runtime.Caller(0)
basePath := filepath.Dir(b)
file, err := os.Open(filepath.Join(basePath, "..", "utils", "seeds", "province.json"))
if err != nil {
return nil, err
}
defer file.Close()
var provinces []models.RegionProvince
if err := json.NewDecoder(file).Decode(&provinces); err != nil {
return nil, err
}
return provinces, nil
}
func (s *ProvinceService) Create() {
provinces, errSeed := seedProvince()
if errSeed != nil {
s.Error = errSeed
s.Exception.InternalServerError = true
s.Exception.Message = "Failed to seed province"
return
}
createProvince := repositories.BulkCreateProvince(provinces)
s.Error = createProvince.RowsError
s.Result = createProvince.Result
}
func (s *CityService) Create() {
cities, errSeed := seedCity()
if errSeed != nil {
s.Error = errSeed
s.Exception.InternalServerError = true
s.Exception.Message = "Failed to seed province"
return
}
createCity := repositories.BulkCreateCity(cities)
s.Error = createCity.RowsError
s.Result = createCity.Result
}
func (s *ProvinceService) Retrieve() {
Province := repositories.GetListProvinces()
s.Error = Province.RowsError
s.Result = Province.Result
}
func (s *CityService) Retrieve() {
cities := repositories.GetListCitiesByProvinceId(s.Constructor.ProvinceID)
s.Error = cities.RowsError
s.Result = cities.Result
}123456785 unmodified lines141516171819202122package controllerimport ("strconv""api.qobiltu.id/controller""api.qobiltu.id/models""api.qobiltu.id/services"5 unmodified linesemailVerificationController := controller.Controller[any, models.EmailVerification, models.EmailVerification]{Service: &emailVerification.Service,}query, _ := c.GetQuery("account_id")accountId, _ := strconv.Atoi(query)emailVerificationController.Service.Constructor.AccountID = uint(accountId)emailVerification.Create()emailVerificationController.Response(c)}1234565 unmodified lines12131415161718192021package controllerimport ("api.qobiltu.id/controller""api.qobiltu.id/models""api.qobiltu.id/services"5 unmodified linesemailVerificationController := controller.Controller[any, models.EmailVerification, models.EmailVerification]{Service: &emailVerification.Service,}emailVerificationController.HeaderParse(c, func() {emailVerificationController.Service.Constructor.AccountID = uint(emailVerificationController.AccountData.UserID)emailVerification.Create()emailVerificationController.Response(c)})}
12345610 unmodified lines171819202122package userimport ("api.qobiltu.id/controller""api.qobiltu.id/models""api.qobiltu.id/services"10 unmodified linesuserUpdateProfileController.Service.Constructor = userUpdateProfileController.RequestuserUpdateProfileController.HeaderParse(c, func() {userUpdateProfileController.Service.Constructor.AccountID = uint(userUpdateProfileController.AccountData.UserID)})userProfile.Update()},1234567810 unmodified lines19202122232425package userimport ("fmt""api.qobiltu.id/controller""api.qobiltu.id/models""api.qobiltu.id/services"10 unmodified linesuserUpdateProfileController.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()},
1234567892025/03/23 11:04:52 Error Log : ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification (SQLSTATE 42P10)2025/03/23 11:06:58 Error Log : ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification (SQLSTATE 42P10)2025/03/23 11:24:49 Error Log : WHERE conditions required2025/03/23 11:58:50 Error Log : WHERE conditions required2025/03/23 12:01:28 Error Log : WHERE conditions required2025/03/24 19:52:15 Error Log : ERROR: nama tabel « account_details » ditentukan lebih dari satu kali (SQLSTATE 42712)2025/03/24 19:53:48 Error Log : ERROR: nama tabel « account_details » ditentukan lebih dari satu kali (SQLSTATE 42712)2025/03/24 19:54:14 Error Log : WHERE conditions required2025/03/24 19:55:31 Error Log : ERROR: nama tabel « account_details » ditentukan lebih dari satu kali (SQLSTATE 42712)
34 unmodified lines35363738394016 unmodified lines57585960616234 unmodified linestype EmailVerification struct {ID uint `gorm:"primaryKey" json:"id"`Token uint `json:"token"`AccountID uint `json:"account_id"`IsExpired bool `json:"is_expired"`16 unmodified linestype ForgotPassword struct {ID uint `gorm:"primaryKey" json:"id"`Token uint `json:"token"`AccountID uint `json:"account_id"`IsExpired bool `json:"is_expired"`34 unmodified lines3536373839404116 unmodified lines5859606162636434 unmodified linestype EmailVerification struct {ID uint `gorm:"primaryKey" json:"id"`UUID uuid.UUID `gorm:"type:uuid" json:"uuid" `Token uint `json:"token"`AccountID uint `json:"account_id"`IsExpired bool `json:"is_expired"`16 unmodified linestype ForgotPassword struct {ID uint `gorm:"primaryKey" json:"id"`UUID uuid.UUID `gorm:"type:uuid" json:"uuid" `Token uint `json:"token"`AccountID uint `json:"account_id"`IsExpired bool `json:"is_expired"`
31 unmodified lines3233343536373829 unmodified lines686970717273747576777831 unmodified linesrepo := Construct[models.Account, models.Account](account,)Update(repo)return *repo}29 unmodified lines}func UpdateAccountDetails(accountDetails models.AccountDetails) Repository[models.AccountDetails, models.AccountDetails] {repo := Construct[models.AccountDetails, models.AccountDetails](accountDetails,)fmt.Println(accountDetails)fmt.Println("Account ID : ", accountDetails.AccountID)Update(repo)return *repo}31 unmodified lines3233343536373839404129 unmodified lines71727374757677787980818283848531 unmodified linesrepo := Construct[models.Account, models.Account](account,)repo.Transactions(WhereGivenConstructor[models.Account, models.Account],Update[models.Account],)return *repo}29 unmodified lines}func UpdateAccountDetails(accountDetails models.AccountDetails) Repository[models.AccountDetails, models.AccountDetails] {fmt.Println("Account ID : ", accountDetails.AccountID)repo := Construct[models.AccountDetails, models.AccountDetails](models.AccountDetails{AccountID: accountDetails.AccountID},)repo.Transaction.Where("account_id = ?", accountDetails.AccountID).First(&repo.Constructor)accountDetails.ID = repo.Constructor.ID// fmt.Println(repo.Constructor)// fmt.Println(accountDetails)repo.Transaction.Updates(accountDetails)repo.Result = accountDetailsreturn *repo}
91 unmodified lines9293949596979891 unmodified lines}func Update[T1 any](repo *Repository[T1, T1]) *gorm.DB {tx := repo.Transaction.Save(&repo.Constructor)repo.RowsCount = int(tx.RowsAffected)repo.NoRecord = repo.RowsCount == 0repo.RowsError = tx.Error91 unmodified lines9293949596979891 unmodified lines}func Update[T1 any](repo *Repository[T1, T1]) *gorm.DB {tx := repo.Transaction.Updates(&repo.Constructor)repo.RowsCount = int(tx.RowsAffected)repo.NoRecord = repo.RowsCount == 0repo.RowsError = tx.Error
1234567891011121 unmodified line141516171819204 unmodified lines252627282930313233package servicesimport ("math/rand""time""api.qobiltu.id/config""api.qobiltu.id/models""api.qobiltu.id/repositories")type EmailVerificationService struct {1 unmodified line}func (s *EmailVerificationService) Create() {accountRepo := repositories.GetAccountbyId(s.Constructor.AccountID)if accountRepo.NoRecord {s.Error = accountRepo.RowsErrors.Exception.DataNotFound = true4 unmodified linesremainingTime := time.Duration(config.EMAIL_VERIFICATION_DURATION) * time.HourdueTime := CalculateDueTime(remainingTime)randomizer := rand.New(rand.NewSource(10))token := uint(randomizer.Int())repo := repositories.CreateEmailVerification(s.Constructor.AccountID, dueTime, token)s.Error = repo.RowsError123456789101112131 unmodified line151617181920214 unmodified lines2627282930313233package servicesimport ("math/rand/v2""time""api.qobiltu.id/config""api.qobiltu.id/models""api.qobiltu.id/repositories"uuid "github.com/satori/go.uuid")type EmailVerificationService struct {1 unmodified line}func (s *EmailVerificationService) Create() {accountRepo := repositories.GetAccountById(s.Constructor.AccountID)if accountRepo.NoRecord {s.Error = accountRepo.RowsErrors.Exception.DataNotFound = true4 unmodified linesremainingTime := time.Duration(config.EMAIL_VERIFICATION_DURATION) * time.HourdueTime := CalculateDueTime(remainingTime)token := uint(rand.IntN(100000))s.Constructor.UUID = uuid.NewV4()repo := repositories.CreateEmailVerification(s.Constructor.AccountID, dueTime, token)s.Error = repo.RowsError
12345624 unmodified lines313233343536package servicesimport ("api.qobiltu.id/models""api.qobiltu.id/repositories")24 unmodified lines}func (s *UserProfileService) Update() {userProfile := repositories.UpdateAccountDetails(s.Constructor)s.Error = userProfile.RowsErrorif userProfile.NoRecord {1234567824 unmodified lines33343536373839package servicesimport ("fmt""api.qobiltu.id/models""api.qobiltu.id/repositories")24 unmodified lines}func (s *UserProfileService) Update() {fmt.Println("Account ID:", s.Constructor.AccountID)userProfile := repositories.UpdateAccountDetails(s.Constructor)s.Error = userProfile.RowsErrorif userProfile.NoRecord {
123456789101112131415161718192021package user
import (
"api.qobiltu.id/controller"
"api.qobiltu.id/models"
"api.qobiltu.id/services"
"github.com/gin-gonic/gin"
)
func Profile(c *gin.Context) {
userProfile := services.UserProfileService{}
userProfileController := controller.Controller[any, models.AccountDetails, models.AccountDetails]{
Service: &userProfile.Service,
}
userProfileController.HeaderParse(c, func() {
userProfileController.Service.Constructor.AccountID = uint(userProfileController.AccountData.UserID)
userProfile.Retrieve()
userProfileController.Response(c)
},
)
}123456789101112131415161718192021222324package user
import (
"api.qobiltu.id/controller"
"api.qobiltu.id/models"
"api.qobiltu.id/services"
"github.com/gin-gonic/gin"
)
func UpdateProfile(c *gin.Context) {
userProfile := services.UserProfileService{}
userUpdateProfileController := controller.Controller[models.AccountDetails, models.AccountDetails, models.AccountDetails]{
Service: &userProfile.Service,
}
userUpdateProfileController.RequestJSON(c, func() {
userUpdateProfileController.Service.Constructor = userUpdateProfileController.Request
userUpdateProfileController.HeaderParse(c, func() {
userUpdateProfileController.Service.Constructor.AccountID = uint(userUpdateProfileController.AccountData.UserID)
})
userProfile.Update()
},
)
}10 unmodified lines111213141516171810 unmodified lines{routerGroup.POST("/login", AuthController.Login)routerGroup.POST("/register", AuthController.Register)routerGroup.GET("/me", middleware.AuthUser, AuthController.Profile)routerGroup.PUT("/me", middleware.AuthUser, AuthController.UpdateProfile)routerGroup.PUT("/change-password", middleware.AuthUser, AuthController.ChangePassword)}}10 unmodified lines11121314151610 unmodified lines{routerGroup.POST("/login", AuthController.Login)routerGroup.POST("/register", AuthController.Register)routerGroup.PUT("/change-password", middleware.AuthUser, AuthController.ChangePassword)}}
8 unmodified lines910111213148 unmodified linesfunc StartService() {router := gin.Default()router.GET("/", controller.HomeController)UserRoute(router)EmailRoute(router)router.Run(config.TCP_ADDRESS)8 unmodified lines91011121314158 unmodified linesfunc StartService() {router := gin.Default()router.GET("/", controller.HomeController)AuthRoute(router)UserRoute(router)EmailRoute(router)router.Run(config.TCP_ADDRESS)
13 unmodified lines141516171819202122232425262728293031323334353620 unmodified lines5758596061626313 unmodified linesIsEmailVerified bool `json:"is_email_verified"`IsDetailCompleted bool `json:"is_detail_completed"`CreatedAt time.Time `json:"created_at"`DeletedAt *time.Time `json:"deleted_at,omitempty" gorm:"default:null"`}type AccountDetails struct {ID uint `gorm:"primaryKey" json:"id"`AccountID uint `json:"account_id"`InitialName string `json:"initial_name"`FullName *string `json:"full_name,omitempty"`DateOfBirth *time.Time `json:"date_of_birth,omitempty"`PlaceOfBirth *string `json:"place_of_birth,omitempty"`Domicile *string `json:"domicile,omitempty"`LastJob *string `json:"last_job,omitempty"`Gender *bool `json:"gender,omitempty"`LastEducation *string `json:"last_education,omitempty"`MaritalStatus *bool `json:"marital_status,omitempty"`Avatar *string `json:"avatar,omitempty"`PhoneNumber *uint `json:"phone_number,omitempty"`}type EmailVerification struct {20 unmodified linestype ForgotPassword struct {ID uint `gorm:"primaryKey" json:"id"`UUID uint `json:"uuid"`AccountID uint `json:"account_id"`IsExpired bool `json:"is_expired"`CreatedAt time.Time `json:"created_at"`13 unmodified lines141516171819202122232425262728293031323334353620 unmodified lines5758596061626313 unmodified linesIsEmailVerified bool `json:"is_email_verified"`IsDetailCompleted bool `json:"is_detail_completed"`CreatedAt time.Time `json:"created_at"`DeletedAt *time.Time `json:"deleted_at" gorm:"default:null"`}type AccountDetails struct {ID uint `gorm:"primaryKey" json:"id"`AccountID uint `json:"account_id"`InitialName string `json:"initial_name"`FullName *string `json:"full_name"`DateOfBirth *time.Time `json:"date_of_birth"`PlaceOfBirth *string `json:"place_of_birth"`Domicile *string `json:"domicile"`LastJob *string `json:"last_job"`Gender *bool `json:"gender"`LastEducation *string `json:"last_education"`MaritalStatus *bool `json:"marital_status"`Avatar *string `json:"avatar"`PhoneNumber *uint `json:"phone_number"`}type EmailVerification struct {20 unmodified linestype ForgotPassword struct {ID uint `gorm:"primaryKey" json:"id"`Token uint `json:"token"`AccountID uint `json:"account_id"`IsExpired bool `json:"is_expired"`CreatedAt time.Time `json:"created_at"`
.gitignore+4-2
config/config.go+10
config/database_connection_config.go+4
controller/auth/auth_change_password_controller.go+1-1
controller/auth/auth_external_controller.goAdded+20
controller/auth/auth_forgot_password_controller.goAdded+1
controller/auth/auth_login_controller.go+1-1
controller/auth/auth_register_controller.go+1-1
controller/email/email_create_verification_controller.goAdded+21
controller/email/email_validate_controller.goAdded+24
controller/options/option_category_controller.goAdded+19
controller/options/option_value_controller.goAdded+19
controller/region/city/city_list_controller.goAdded+21
controller/region/city/city_seeds_controller.goAdded+17
controller/region/province/province_list_controller.goAdded+17
controller/region/province/province_seeds_controller.goAdded+17
go.mod+23-2
go.sum+46
logs/error_log.txt-9
middleware/authentication_middleware.go+3-3
models/database_orm_model.go+33-5
models/request_model.go+17-4
models/response_model.go+7
repositories/account_repository.go-1
repositories/email_verification_repository.go+15-1
repositories/external_auth_repository.goAdded+37
repositories/option_repository.goAdded+43
repositories/region_repository.goAdded+47
router/auth_route.go+1
router/email_route.go+3-3
router/options_route.goAdded+20
router/router.go+1
services/authentication_service.go-3
services/email_verification_service.go+36-1
services/external_authentication_service.goAdded+55
services/option_service.goAdded+70
services/region_service.goAdded+90
space/controller/email/email_create_verification.go+6-7
space/controller/user/user_update_profile_controller.go+3
space/logs/error_log.txt+9
space/models/database_orm_model.go+2
space/repositories/account_repository.go+12-5
space/repositories/repository.go+1-1
space/services/email_verification_service.go+5-5
space/services/user_profile_service.go+3
space/space/controller/user/auth_profile_controller.goAdded+21
space/space/controller/user/auth_update_profile_controller.goAdded+24
space/space/router/auth_route.go-2
space/space/router/router.go+1
space/space/space/models/database_orm_model.go+12-12