diff --git a/constants/datatypes.go b/constants/datatypes.go new file mode 100644 index 0000000..6d0b7a2 --- /dev/null +++ b/constants/datatypes.go @@ -0,0 +1,14 @@ +package constants + +const ( + TYPE_BOOL = "bool" + TYPE_STRING = "string" + TYPE_INTEGER = "int" + TYPE_FLOAT32 = "float32" + TYPE_FLOAT64 = "float64" + + // complex + TYPE_DATE = "date" + TYPE_PRIMITIVE_DATETIME = "primitive.DateTime" + TYPE_SOCIAL = "social" +) diff --git a/controller/profile.go b/controller/profile.go new file mode 100644 index 0000000..177e021 --- /dev/null +++ b/controller/profile.go @@ -0,0 +1,279 @@ +package controller + +import ( + "fmt" + "reflect" + "strings" + + "strconv" + + "github.com/FrosTiK-SD/auth/constants" + "github.com/FrosTiK-SD/auth/interfaces" + constantModel "github.com/FrosTiK-SD/models/constant" + studentModel "github.com/FrosTiK-SD/models/student" + "github.com/modern-go/reflect2" + "go.mongodb.org/mongo-driver/bson/primitive" +) + +var PointerToNilString *string = nil +var PointerToNilInteger *int = nil +var PointerToNilFloat64 *float64 = nil +var PointerToNilReservationCategory *studentModel.ReservationCategory = nil + +func AssignReservationCategory(category *interfaces.GenericField[string], isEWS *interfaces.GenericField[bool], isPWD *interfaces.GenericField[bool], rc **studentModel.ReservationCategory, forward bool) { + if forward { + if reflect2.IsNil(*rc) { + category.IsNull = true + isEWS.IsNull = true + isPWD.IsNull = true + } else { + category.Value = (**rc).Category + isEWS.Value = (**rc).IsEWS + isPWD.Value = (**rc).IsPWD + } + + category.DataType = constants.TYPE_STRING + isEWS.DataType = constants.TYPE_BOOL + isPWD.DataType = constants.TYPE_BOOL + + return + } + + // backward mapping + + if category.IsNull { + return + } + + *rc = new(studentModel.ReservationCategory) + (**rc).Category = category.Value + (**rc).IsEWS = isEWS.Value + (**rc).IsPWD = isPWD.Value +} + +func AssignSocialProfile(field *interfaces.GenericField[interfaces.TYPE_SOCIAL], social **studentModel.SocialProfile, forward bool) { + if forward { + field.DataType = constants.TYPE_SOCIAL + + if *social != nil { + field.IsNull = reflect2.IsNil(*social) + + if !field.IsNull { + field.Value = (**social).URL + "|" + (**social).Username + } + + return + } + + field.IsNull = true + field.Value = "" + return + } + + // backward mapping + + if field.IsNull { + return + } + + *social = new(studentModel.SocialProfile) + + val := field.Value + (**social).URL = strings.Split(val, "|")[0] + (**social).Username = strings.Split(val, "|")[1] +} + +func AssignNilPossibleValue[V int | float64 | string | constantModel.Course | constantModel.Gender | primitive.DateTime](field *interfaces.GenericField[V], value **V, forward bool) { + if forward { + field.IsNull = reflect2.IsNil(*value) + if !field.IsNull { + field.Value = **value + } + field.DataType = fmt.Sprintf("%v", reflect.TypeOf(*value)) + return + } + + // backward mapping + + if field.IsNull { + return + } + + *value = new(V) + **value = field.Value +} + +func AssignNotNilValue[V int | float64 | string | constantModel.Course](field *interfaces.GenericField[V], value *V, forward bool) { + if forward { + field.Value = *value + field.DataType = fmt.Sprintf("%v", reflect.TypeOf(*value)) + return + } + + // backward mapping + + *value = field.Value +} + +func AssignPastAcademics(field *interfaces.ProfilePastEducation, education **studentModel.EducationDetails, forward bool) { + if forward { + if *education != nil { + AssignNotNilValue(&field.Certification, &(*education).Certification, forward) + AssignNotNilValue(&field.Institute, &(*education).Institute, forward) + AssignNotNilValue(&field.Year, &(*education).Year, forward) + AssignNotNilValue(&field.Score, &(*education).Score, forward) + return + } + + AssignNilPossibleValue(&field.Certification, &PointerToNilString, forward) + AssignNilPossibleValue(&field.Institute, &PointerToNilString, forward) + AssignNilPossibleValue(&field.Year, &PointerToNilInteger, forward) + AssignNilPossibleValue(&field.Score, &PointerToNilFloat64, forward) + return + } + + // backward + + if field.Certification.IsNull || field.Institute.IsNull { + return + } + + *education = new(studentModel.EducationDetails) + AssignNotNilValue(&field.Certification, &(*education).Certification, forward) + AssignNotNilValue(&field.Institute, &(*education).Institute, forward) + AssignNotNilValue(&field.Year, &(*education).Year, forward) + AssignNotNilValue(&field.Score, &(*education).Score, forward) + +} + +func AssignRankValue(field *interfaces.GenericRank, rankDetails **studentModel.RankDetails, forward bool) { + if forward { + if *rankDetails != nil { + AssignNotNilValue(&field.Rank, &(**rankDetails).Rank, forward) + AssignReservationCategory(&field.Category, &field.IsEWS, &field.IsPWD, &(**rankDetails).RankCategory, forward) + return + } + + AssignNilPossibleValue(&field.Rank, &PointerToNilInteger, forward) + AssignReservationCategory(&field.Category, &field.IsEWS, &field.IsPWD, &PointerToNilReservationCategory, forward) + return + } + + // backward mapping + + if field.Rank.IsNull { + return + } + + *rankDetails = new(studentModel.RankDetails) + AssignNotNilValue(&field.Rank, &(*rankDetails).Rank, forward) + AssignReservationCategory(&field.Category, &field.IsEWS, &field.IsPWD, &(*rankDetails).RankCategory, forward) +} + +func MapProfilePersonal(profile *interfaces.ProfilePersonal, student *studentModel.Student, forward bool) { + AssignNotNilValue(&profile.FirstName, &student.FirstName, forward) + AssignNilPossibleValue(&profile.MiddleName, &student.MiddleName, forward) + AssignNilPossibleValue(&profile.LastName, &student.LastName, forward) + + AssignNilPossibleValue(&profile.Gender, &student.Gender, forward) + AssignNilPossibleValue(&profile.DOB, &student.DOB, forward) + AssignNotNilValue(&profile.PermanentAddress, &student.PermanentAddress, forward) + AssignNotNilValue(&profile.PresentAddress, &student.PresentAddress, forward) + AssignNotNilValue(&profile.PersonalEmail, &student.PersonalEmail, forward) + AssignNotNilValue(&profile.Mobile, &student.Mobile, forward) + AssignReservationCategory(&profile.Category, &profile.IsEWS, &profile.IsPWD, &student.Category, forward) + AssignNotNilValue(&profile.MotherTongue, &student.MotherTongue, forward) + AssignNotNilValue(&profile.FatherName, &student.ParentsDetails.FatherName, forward) + AssignNotNilValue(&profile.MotherName, &student.ParentsDetails.MotherName, forward) + AssignNotNilValue(&profile.FatherOccupation, &student.ParentsDetails.FatherOccupation, forward) + AssignNotNilValue(&profile.MotherOccupation, &student.ParentsDetails.MotherOccupation, forward) + + // required + profile.FirstName.IsRequired = true + profile.DOB.IsRequired = true + profile.PermanentAddress.IsRequired = true + profile.PersonalEmail.IsRequired = true + profile.Mobile.IsRequired = true +} + +func MapProfileCurrentAcademics(profile *interfaces.ProfileCurrentAcademics, academics *studentModel.Academics, forward bool) { + AssignNilPossibleValue(&profile.SemesterSPI.One, &academics.SemesterSPI.One, forward) + AssignNilPossibleValue(&profile.SemesterSPI.Two, &academics.SemesterSPI.Two, forward) + AssignNilPossibleValue(&profile.SemesterSPI.Three, &academics.SemesterSPI.Three, forward) + AssignNilPossibleValue(&profile.SemesterSPI.Four, &academics.SemesterSPI.Four, forward) + AssignNilPossibleValue(&profile.SemesterSPI.Five, &academics.SemesterSPI.Five, forward) + AssignNilPossibleValue(&profile.SemesterSPI.Six, &academics.SemesterSPI.Six, forward) + AssignNilPossibleValue(&profile.SemesterSPI.Seven, &academics.SemesterSPI.Seven, forward) + AssignNilPossibleValue(&profile.SemesterSPI.Eight, &academics.SemesterSPI.Eight, forward) + + AssignNilPossibleValue(&profile.SummerTermSPI.One, &academics.SummerTermSPI.One, forward) + AssignNilPossibleValue(&profile.SummerTermSPI.Two, &academics.SummerTermSPI.Two, forward) + AssignNilPossibleValue(&profile.SummerTermSPI.Three, &academics.SummerTermSPI.Three, forward) + AssignNilPossibleValue(&profile.SummerTermSPI.Four, &academics.SummerTermSPI.Four, forward) + AssignNilPossibleValue(&profile.SummerTermSPI.Five, &academics.SummerTermSPI.Five, forward) + + AssignNilPossibleValue(&profile.Misc.CurrentCGPA, &academics.CurrentCGPA, forward) + AssignNilPossibleValue(&profile.Misc.ActiveBacklogs, &academics.ActiveBacklogs, forward) + AssignNilPossibleValue(&profile.Misc.TotalBacklogs, &academics.TotalBacklogs, forward) +} + +func AssignBatch(profile *interfaces.GenericField[string], institute *studentModel.Student, forward bool) { + profile.IsNull = reflect2.IsNil(institute.Batch) + profile.DataType = constants.TYPE_STRING + if !profile.IsNull { + profile.Value = strconv.Itoa(institute.Batch.StartYear) + "-" + strconv.Itoa(institute.Batch.EndYear) + } +} + +func MapProfileSocials(profile *interfaces.ProfileSocials, socials *studentModel.SocialProfiles, forward bool) { + AssignSocialProfile(&profile.LinkedIn, &socials.LinkedIn, forward) + AssignSocialProfile(&profile.Github, &socials.Github, forward) + AssignSocialProfile(&profile.CodeChef, &socials.CodeChef, forward) + AssignSocialProfile(&profile.Codeforces, &socials.Codeforces, forward) + AssignSocialProfile(&profile.Leetcode, &socials.LeetCode, forward) + AssignSocialProfile(&profile.GoogleScholar, &socials.GoogleScholar, forward) + AssignSocialProfile(&profile.MicrosoftTeams, &socials.MicrosoftTeams, forward) + AssignSocialProfile(&profile.Kaggle, &socials.Kaggle, forward) + AssignSocialProfile(&profile.Skype, &socials.Skype, forward) +} + +func MapProfileInstitute(profile *interfaces.ProfileInstitute, institute *studentModel.Student, forward bool) { + AssignBatch(&profile.Batch, institute, forward) + AssignNotNilValue(&profile.RollNumber, &institute.RollNo, forward) + AssignNotNilValue(&profile.InstituteEmail, &institute.InstituteEmail, forward) + AssignNotNilValue(&profile.Department, &institute.Department, forward) + AssignNilPossibleValue(&profile.EducationGap, &institute.Academics.EducationGap, forward) + AssignNilPossibleValue(&profile.Course, &institute.Course, forward) + AssignNilPossibleValue(&profile.Specialisation, &institute.Specialisation, forward) + AssignNilPossibleValue(&profile.Honours, &institute.Academics.Honours, forward) + AssignNilPossibleValue(&profile.ThesisEndDate, &institute.Academics.ThesisEndDate, forward) +} + +func MapPastAcademics(profile *interfaces.ProfilePastAcademics, institute *studentModel.Academics, forward bool) { + AssignPastAcademics(&profile.ClassX, &institute.XthClass, forward) + AssignPastAcademics(&profile.ClassXII, &institute.XIIthClass, forward) + AssignPastAcademics(&profile.Undergraduate, &institute.UnderGraduate, forward) + AssignPastAcademics(&profile.Postgraduate, &institute.PostGraduate, forward) +} + +func MapRanks(profile *interfaces.ProfilePastAcademics, rank *studentModel.Academics, forward bool) { + AssignRankValue(&profile.JeeRank, &rank.JEERank, forward) + AssignRankValue(&profile.GateRank, &rank.GATERank, forward) +} + +// 'forward' defines the mapping direction +// if true, then maps model to profile +// if false, then maps profile to model +func MapStudentToStudentProfile(profile *interfaces.StudentProfile, student *studentModel.Student, forward bool) { + // Profile + MapProfilePersonal(&profile.Profile.PersonalProfile, student, forward) + MapProfileSocials(&profile.Profile.SocialProfile, &student.SocialProfiles, forward) + MapProfileInstitute(&profile.Profile.InstituteProfile, student, forward) + + // Past Academics + MapPastAcademics(&profile.PastAcademics, &student.Academics, forward) + MapRanks(&profile.PastAcademics, &student.Academics, forward) + + // Current Academics + MapProfileCurrentAcademics(&profile.CurrentAcademics, &student.Academics, forward) +} diff --git a/go.mod b/go.mod index f9f356a..8d00ae1 100644 --- a/go.mod +++ b/go.mod @@ -1,71 +1,78 @@ module github.com/FrosTiK-SD/auth -go 1.21.6 +go 1.22 + +toolchain go1.22.3 require ( - github.com/FrosTiK-SD/models v0.4.12 - github.com/FrosTiK-SD/mongik v0.1.18 + github.com/FrosTiK-SD/models v0.5.2 + github.com/FrosTiK-SD/mongik v0.1.20 github.com/allegro/bigcache/v3 v3.1.0 - github.com/gin-gonic/gin v1.9.0 + github.com/gin-gonic/gin v1.10.0 + github.com/gofiber/fiber/v2 v2.52.4 github.com/joho/godotenv v1.5.1 - github.com/lestrrat-go/jwx/v2 v2.0.16 - go.mongodb.org/mongo-driver v1.13.1 + github.com/lestrrat-go/jwx/v2 v2.0.21 + go.mongodb.org/mongo-driver v1.15.0 ) require ( - github.com/andybalholm/brotli v1.0.5 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect + github.com/andybalholm/brotli v1.1.0 // indirect + github.com/bytedance/sonic/loader v0.1.1 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/cloudwego/base64x v0.1.4 // indirect + github.com/cloudwego/iasm v0.2.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect - github.com/gofiber/fiber/v2 v2.52.0 // indirect - github.com/golang/snappy v0.0.3 // indirect - github.com/google/uuid v1.5.0 // indirect - github.com/klauspost/compress v1.17.0 // indirect + github.com/gabriel-vasile/mimetype v1.4.3 // indirect + github.com/golang/snappy v0.0.4 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/klauspost/compress v1.17.8 // indirect + github.com/knz/go-libedit v1.10.1 // indirect github.com/lestrrat-go/blackmagic v1.0.2 // indirect github.com/lestrrat-go/httpcc v1.0.1 // indirect - github.com/lestrrat-go/httprc v1.0.4 // indirect + github.com/lestrrat-go/httprc v1.0.5 // indirect github.com/lestrrat-go/iter v1.0.2 // indirect github.com/lestrrat-go/option v1.0.1 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect - github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect - github.com/redis/go-redis/v9 v9.4.0 // indirect - github.com/rivo/uniseg v0.2.0 // indirect + github.com/montanaflynn/stats v0.7.1 // indirect + github.com/redis/go-redis/v9 v9.5.1 // indirect + github.com/rivo/uniseg v0.4.7 // indirect github.com/segmentio/asm v1.2.0 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect - github.com/valyala/fasthttp v1.51.0 // indirect + github.com/valyala/fasthttp v1.53.0 // indirect github.com/valyala/tcplisten v1.0.0 // indirect github.com/xdg-go/pbkdf2 v1.0.0 // indirect github.com/xdg-go/scram v1.1.2 // indirect github.com/xdg-go/stringprep v1.0.4 // indirect - github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect - golang.org/x/sync v0.1.0 // indirect + github.com/youmark/pkcs8 v0.0.0-20240424034433-3c2c7870ae76 // indirect + golang.org/x/sync v0.7.0 // indirect ) require ( - github.com/bytedance/sonic v1.8.2 // indirect - github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect - github.com/gin-contrib/cors v1.4.0 + github.com/bytedance/sonic v1.11.6 // indirect + github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect + github.com/gin-contrib/cors v1.7.2 github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect - github.com/go-playground/validator/v10 v10.11.2 // indirect + github.com/go-playground/validator/v10 v10.20.0 // indirect github.com/goccy/go-json v0.10.2 // indirect - github.com/google/go-cmp v0.6.0 // indirect + github.com/google/go-cmp v0.6.0 github.com/json-iterator/go v1.1.12 - github.com/klauspost/cpuid/v2 v2.2.4 // indirect - github.com/leodido/go-urn v1.2.2 // indirect + github.com/klauspost/cpuid/v2 v2.2.7 // indirect + github.com/leodido/go-urn v1.4.0 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/pelletier/go-toml/v2 v2.0.6 // indirect + github.com/modern-go/reflect2 v1.0.2 + github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect - github.com/ugorji/go/codec v1.2.10 // indirect - golang.org/x/arch v0.2.0 // indirect - golang.org/x/crypto v0.14.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect - golang.org/x/text v0.13.0 // indirect - google.golang.org/protobuf v1.28.1 // indirect + github.com/ugorji/go/codec v1.2.12 // indirect + golang.org/x/arch v0.8.0 // indirect + golang.org/x/crypto v0.23.0 // indirect + golang.org/x/net v0.25.0 // indirect + golang.org/x/sys v0.20.0 // indirect + golang.org/x/text v0.15.0 // indirect + google.golang.org/protobuf v1.34.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 8114f3f..34f2483 100644 --- a/go.sum +++ b/go.sum @@ -2,12 +2,22 @@ github.com/FrosTiK-SD/models v0.4.0 h1:nt4mzQttVJC/dPpqLsLqvFDSY3PoMtMa7iGrOYj0y github.com/FrosTiK-SD/models v0.4.0/go.mod h1:F/IJox0VzLbPKYni9jC/n+jlKh7Ie5EjaY2YfyUDQzg= github.com/FrosTiK-SD/models v0.4.12 h1:tdIJcwfTJKcF2//hPDg1KanaLj4PvHWtDeQ4usG/KiU= github.com/FrosTiK-SD/models v0.4.12/go.mod h1:F/IJox0VzLbPKYni9jC/n+jlKh7Ie5EjaY2YfyUDQzg= +github.com/FrosTiK-SD/models v0.4.26 h1:5IZ9qLunZM/TerYWr76OSCWDifKITU+jumQHvXeIAeg= +github.com/FrosTiK-SD/models v0.4.26/go.mod h1:F/IJox0VzLbPKYni9jC/n+jlKh7Ie5EjaY2YfyUDQzg= +github.com/FrosTiK-SD/models v0.5.1 h1:hT0NWOUyJWXV7efbC2SktJqTkoYqnpiDsqVM1ezgmpo= +github.com/FrosTiK-SD/models v0.5.1/go.mod h1:F/IJox0VzLbPKYni9jC/n+jlKh7Ie5EjaY2YfyUDQzg= +github.com/FrosTiK-SD/models v0.5.2 h1:bK6RxZXcYf6MTf+j7KGlHiybR1ru2Ut3ImL+ydSAmDg= +github.com/FrosTiK-SD/models v0.5.2/go.mod h1:F/IJox0VzLbPKYni9jC/n+jlKh7Ie5EjaY2YfyUDQzg= github.com/FrosTiK-SD/mongik v0.1.18 h1:kDhGDEhgDyfEG4lEkVRfe2mVrtDB9QDsY9g2HOASjCw= github.com/FrosTiK-SD/mongik v0.1.18/go.mod h1:AjFFmUGUAix1sf24uxh0Wxq5fNIpykx4EEd44AMYhfw= +github.com/FrosTiK-SD/mongik v0.1.20 h1:ve/aYItLdXsyTPT73jZAYvk/VKHNgMUDVjOEjTYMDIA= +github.com/FrosTiK-SD/mongik v0.1.20/go.mod h1:FCilMEa9+W/1NXzqwCsLSzIjMWqAiut+M36kTem0wHI= github.com/allegro/bigcache/v3 v3.1.0 h1:H2Vp8VOvxcrB91o86fUSVJFqeuz8kpyyB02eH3bSzwk= github.com/allegro/bigcache/v3 v3.1.0/go.mod h1:aPyh7jEvrog9zAwx5N7+JUQX5dZTSGpxF1LAR4dr35I= github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= +github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= +github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= @@ -15,11 +25,25 @@ github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0 github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= github.com/bytedance/sonic v1.8.2 h1:Eq1oE3xWIBE3tj2ZtJFK1rDAx7+uA4bRytozVhXMHKY= github.com/bytedance/sonic v1.8.2/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U= +github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM= +github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0= +github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4= +github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM= +github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams= github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= +github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d h1:77cEq6EriyTZ0g/qfRdp61a3Uu/AWrgIq2s0ClJV1g0= +github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d/go.mod h1:8EPpVsBuRksnlj1mLy4AWzRNQYxauNi62uWcE3to6eA= +github.com/chenzhuoyu/iasm v0.9.0/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog= +github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= +github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= +github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= +github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.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= @@ -27,15 +51,23 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= +github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= +github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= github.com/gin-contrib/cors v1.4.0 h1:oJ6gwtUl3lqV0WEIwM/LxPF1QZ5qe2lGWdY2+bz7y0g= github.com/gin-contrib/cors v1.4.0/go.mod h1:bs9pNM0x/UsmHPBWT2xZz9ROh8xYjYkiURUfmBoMlcs= +github.com/gin-contrib/cors v1.7.2 h1:oLDHxdg8W/XDoN/8zamqk/Drgt4oVZDvaV0YmvVICQw= +github.com/gin-contrib/cors v1.7.2/go.mod h1:SUJVARKgQ40dmrzgXEVxj2m7Ig1v1qIboQkPDTQ9t2E= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= github.com/gin-gonic/gin v1.9.0 h1:OjyFBKICoexlu99ctXNR2gg+c5pKrKMuyjgARg9qeY8= github.com/gin-gonic/gin v1.9.0/go.mod h1:W1Me9+hsUSyj3CePGrd1/QrKJMSJ1Tu/0hFEH89961k= +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.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= 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= @@ -48,15 +80,21 @@ github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91 github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= github.com/go-playground/validator/v10 v10.11.2 h1:q3SHpufmypg+erIExEKUmsgmhDTyhcJ38oeKGACXohU= github.com/go-playground/validator/v10 v10.11.2/go.mod h1:NieE624vt4SCTJtD87arVLvdmjPAeV8BQlHtMnw9D7s= +github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8= +github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/gofiber/fiber/v2 v2.52.0 h1:S+qXi7y+/Pgvqq4DrSmREGiFwtB7Bu6+QFLuIHYw/UE= github.com/gofiber/fiber/v2 v2.52.0/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ= +github.com/gofiber/fiber/v2 v2.52.4 h1:P+T+4iK7VaqUsq2PALYEfBBo6bJZ4q3FP8cZ84EggTM= +github.com/gofiber/fiber/v2 v2.52.4/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= @@ -66,6 +104,8 @@ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= @@ -73,9 +113,15 @@ github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHm github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= +github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= +github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= +github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/knz/go-libedit v1.10.1 h1:0pHpWtx9vcvC0xGZqEQlQdfSQs7WRlAjuPvk3fOZDCo= +github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= @@ -87,16 +133,22 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/leodido/go-urn v1.2.2 h1:7z68G0FCGvDk646jz1AelTYNYWrTNm0bEcFAo147wt4= github.com/leodido/go-urn v1.2.2/go.mod h1:kUaIbLZWttglzwNuG0pgsh5vuV6u2YcGBYz1hIPjtOQ= +github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= +github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/lestrrat-go/blackmagic v1.0.2 h1:Cg2gVSc9h7sz9NOByczrbUvLopQmXrfFx//N+AkAr5k= github.com/lestrrat-go/blackmagic v1.0.2/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU= github.com/lestrrat-go/httpcc v1.0.1 h1:ydWCStUeJLkpYyjLDHihupbn2tYmZ7m22BGkcvZZrIE= github.com/lestrrat-go/httpcc v1.0.1/go.mod h1:qiltp3Mt56+55GPVCbTdM9MlqhvzyuL6W/NMDA8vA5E= github.com/lestrrat-go/httprc v1.0.4 h1:bAZymwoZQb+Oq8MEbyipag7iSq6YIga8Wj6GOiJGdI8= github.com/lestrrat-go/httprc v1.0.4/go.mod h1:mwwz3JMTPBjHUkkDv/IGJ39aALInZLrhBp0X7KGUZlo= +github.com/lestrrat-go/httprc v1.0.5 h1:bsTfiH8xaKOJPrg1R+E3iE/AWZr/x0Phj9PBTG/OLUk= +github.com/lestrrat-go/httprc v1.0.5/go.mod h1:mwwz3JMTPBjHUkkDv/IGJ39aALInZLrhBp0X7KGUZlo= github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI= github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4= github.com/lestrrat-go/jwx/v2 v2.0.16 h1:TuH3dBkYTy2giQg/9D8f20znS3JtMRuQJ372boS3lWk= github.com/lestrrat-go/jwx/v2 v2.0.16/go.mod h1:jBHyESp4e7QxfERM0UKkQ80/94paqNIEcdEfiUYz5zE= +github.com/lestrrat-go/jwx/v2 v2.0.21 h1:jAPKupy4uHgrHFEdjVjNkUgoBKtVDgrQPB/h55FHrR0= +github.com/lestrrat-go/jwx/v2 v2.0.21/go.mod h1:09mLW8zto6bWL9GbwnqAli+ArLf+5M33QLQPDggkUWM= github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU= github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= @@ -115,16 +167,24 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe h1:iruDEfMl2E6fbMZ9s0scYfZQ84/6SPL6zC8ACM2oIL0= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8eaE= +github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU= github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/redis/go-redis/v9 v9.4.0 h1:Yzoz33UZw9I/mFhx4MNrB6Fk+XHO1VukNcCa1+lwyKk= github.com/redis/go-redis/v9 v9.4.0/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M= +github.com/redis/go-redis/v9 v9.5.1 h1:H1X4D3yHPaYrkL5X06Wh6xNVM/pX0Ft4RV0vMGvLBh8= +github.com/redis/go-redis/v9 v9.5.1/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= +github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= @@ -134,6 +194,7 @@ github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -143,16 +204,22 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= github.com/ugorji/go/codec v1.2.10 h1:eimT6Lsr+2lzmSZxPhLFoOWFmQqwk0fllJJ5hEbTXtQ= github.com/ugorji/go/codec v1.2.10/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= +github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA= github.com/valyala/fasthttp v1.51.0/go.mod h1:oI2XroL+lI7vdXyYoQk03bXBThfFl2cVdIA3Xl7cH8g= +github.com/valyala/fasthttp v1.53.0 h1:lW/+SUkOxCx2vlIu0iaImv4JLrVRnbbkpCoaawvA4zc= +github.com/valyala/fasthttp v1.53.0/go.mod h1:6dt4/8olwq9QARP/TDuPmWyWcl4byhpvTJ4AAtcz+QM= github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8= github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= @@ -163,18 +230,26 @@ github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6 github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= +github.com/youmark/pkcs8 v0.0.0-20240424034433-3c2c7870ae76 h1:tBiBTKHnIjovYoLX/TPkcf+OjqqKGQrPtGT3Foz+Pgo= +github.com/youmark/pkcs8 v0.0.0-20240424034433-3c2c7870ae76/go.mod h1:SQliXeA7Dhkt//vS29v3zpbEwoa+zb2Cn5xj5uO4K5U= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.mongodb.org/mongo-driver v1.13.1 h1:YIc7HTYsKndGK4RFzJ3covLz1byri52x0IoMB0Pt/vk= go.mongodb.org/mongo-driver v1.13.1/go.mod h1:wcDf1JBCXy2mOW0bWHwO/IOYqdca1MPCwDtFu/Z9+eo= +go.mongodb.org/mongo-driver v1.15.0 h1:rJCKC8eEliewXjZGf0ddURtl7tTVy1TK3bfl0gkUSLc= +go.mongodb.org/mongo-driver v1.15.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c= golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/arch v0.2.0 h1:W1sUEHXiJTfjaFJ5SLo0N6lZn+0eO5gWD1MFeTGqQEY= golang.org/x/arch v0.2.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= +golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc= +golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -185,10 +260,14 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -206,6 +285,8 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -220,6 +301,8 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= @@ -230,6 +313,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= +google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= @@ -240,4 +325,5 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/handler/student.go b/handler/student.go index 3d6dd33..35d38fe 100644 --- a/handler/student.go +++ b/handler/student.go @@ -183,3 +183,52 @@ func (h *Handler) HandlerRegisterStudentDetails(ctx *gin.Context) { return } } + +func (h *Handler) HandlerGetStudentProfile(ctx *gin.Context) { + student, exists := ctx.Get(constants.SESSION) + if !exists { + ctx.AbortWithStatusJSON(401, gin.H{"error": "Cannot get student"}) + return + } + + studentPopulated := student.(*model.StudentPopulated) + studentProfile := interfaces.StudentProfile{} + controller.MapStudentToStudentProfile(&studentProfile, &studentPopulated.Student, true) + + ctx.JSON(200, gin.H{"profile": studentProfile}) +} + +func (h *Handler) HandlerUpdateStudentProfile(ctx *gin.Context) { + _, exists := ctx.Get(constants.SESSION) + if !exists { + ctx.AbortWithStatusJSON(401, gin.H{"error": "Cannot get student"}) + return + } + + updatedStudent := studentModel.Student{} + studentProfile := interfaces.StudentProfile{} + + ctx.BindJSON(&studentProfile) + controller.MapStudentToStudentProfile(&studentProfile, &updatedStudent, false) + + filter := bson.M{"email": updatedStudent.InstituteEmail} + + var currentStudent studentModel.Student + studentCollection := h.MongikClient.MongoClient.Database(constants.DB).Collection(constants.COLLECTION_STUDENT) + if errFind := studentCollection.FindOne(ctx, filter).Decode(¤tStudent); errFind != nil { + ctx.AbortWithStatusJSON(401, gin.H{"error": errFind.Error()}) + return + } + + controller.AssignUnVerifiedFields(&updatedStudent, ¤tStudent) + controller.InvalidateVerifiedFieldsOnChange(&updatedStudent, ¤tStudent) + + if updateResult, errUpdate := db.ReplaceOne(h.MongikClient, constants.DB, constants.COLLECTION_STUDENT, filter, ¤tStudent); errUpdate != nil { + ctx.AbortWithStatusJSON(400, gin.H{"error": errUpdate.Error()}) + return + } else { + ctx.JSON(200, gin.H{"student": updateResult}) + } + + ctx.JSON(200, gin.H{"student": currentStudent}) +} diff --git a/interfaces/profile.go b/interfaces/profile.go new file mode 100644 index 0000000..c949f31 --- /dev/null +++ b/interfaces/profile.go @@ -0,0 +1,131 @@ +package interfaces + +import ( + constantModel "github.com/FrosTiK-SD/models/constant" + "go.mongodb.org/mongo-driver/bson/primitive" +) + +type TYPE_SOCIAL = string + +type GenericField[T bool | string | int | float64 | primitive.DateTime | constantModel.Branch | constantModel.Course | constantModel.Gender] struct { + DataType string `json:"dataType"` + DataChoices *[]T `json:"dataChoices,omitempty"` + IsVerified *bool `json:"isVerified,omitempty"` + Value T `json:"value"` + IsLocked bool `json:"isLocked"` + IsRequired bool `json:"isRequired"` + IsNull bool `json:"isNull"` + IsHidden bool `json:"isHidden"` +} + +type ProfilePersonal struct { + FirstName GenericField[string] `json:"firstName,omitempty"` + MiddleName GenericField[string] `json:"middleName,omitempty"` + LastName GenericField[string] `json:"lastName,omitempty"` + Gender GenericField[constantModel.Gender] `json:"gender,omitempty"` + DOB GenericField[primitive.DateTime] `json:"dob,omitempty"` + PermanentAddress GenericField[string] `json:"permanentAddress,omitempty"` + PresentAddress GenericField[string] `json:"presentAddress,omitempty"` + PersonalEmail GenericField[string] `json:"personalEmail,omitempty"` + Mobile GenericField[string] `json:"mobile,omitempty"` + Category GenericField[string] `json:"category,omitempty"` + IsPWD GenericField[bool] `json:"isPWD,omitempty"` + IsEWS GenericField[bool] `json:"isEWS,omitempty"` + FatherName GenericField[string] `json:"fatherName,omitempty"` + FatherOccupation GenericField[string] `json:"fatherOccupation,omitempty"` + MotherName GenericField[string] `json:"motherName,omitempty"` + MotherOccupation GenericField[string] `json:"motherOccupation,omitempty"` + MotherTongue GenericField[string] `json:"motherTongue,omitempty"` +} + +type ProfileSocials struct { + LinkedIn GenericField[TYPE_SOCIAL] `json:"linkedIn,omitempty"` + Github GenericField[TYPE_SOCIAL] `json:"github,omitempty"` + Kaggle GenericField[TYPE_SOCIAL] `json:"kaggle,omitempty"` + MicrosoftTeams GenericField[TYPE_SOCIAL] `json:"microsoftTeams,omitempty"` + Skype GenericField[TYPE_SOCIAL] `json:"skype,omitempty"` + GoogleScholar GenericField[TYPE_SOCIAL] `json:"googleScholar,omitempty"` + Codeforces GenericField[TYPE_SOCIAL] `json:"codeforces,omitempty"` + CodeChef GenericField[TYPE_SOCIAL] `json:"codechef,omitempty"` + Leetcode GenericField[TYPE_SOCIAL] `json:"leetcode,omitempty"` +} + +type GenericRank struct { + Rank GenericField[int] `json:"rank,omitempty"` + Category GenericField[string] `json:"category,omitempty"` + IsEWS GenericField[bool] `json:"isEWS,omitempty"` + IsPWD GenericField[bool] `json:"isPWD,omitempty"` +} + +type ProfileInstitute struct { + RollNumber GenericField[int] `json:"rollNo,omitempty"` + InstituteEmail GenericField[string] `json:"email,omitempty"` + Batch GenericField[string] `json:"batch,omitempty"` + Department GenericField[string] `json:"department,omitempty"` + Course GenericField[constantModel.Course] `json:"course,omitempty"` + Specialisation GenericField[string] `json:"specialisation,omitempty"` + Honours GenericField[string] `json:"honours,omitempty"` + ThesisEndDate GenericField[primitive.DateTime] `json:"thesisEndDate,omitempty"` + EducationGap GenericField[int] `json:"educationGap,omitempty"` +} + +type ProfileDetails struct { + PersonalProfile ProfilePersonal `json:"personal_profile,omitempty"` + SocialProfile ProfileSocials `json:"social_profile,omitempty"` + InstituteProfile ProfileInstitute `json:"institute_profile,omitempty"` +} + +type ProfilePastEducation struct { + Certification GenericField[string] `json:"certification,omitempty"` + Institute GenericField[string] `json:"institute,omitempty"` + Year GenericField[int] `json:"year,omitempty"` + Score GenericField[float64] `json:"score,omitempty"` +} + +type ProfilePastAcademics struct { + ClassX ProfilePastEducation `json:"class_x,omitempty"` + ClassXII ProfilePastEducation `json:"class_xii,omitempty"` + Undergraduate ProfilePastEducation `json:"undergraduate,omitempty"` + Postgraduate ProfilePastEducation `json:"postgraduate,omitempty"` + JeeRank GenericRank `json:"jeeRank,omitempty"` + GateRank GenericRank `json:"gateRank,omitempty"` +} + +type ProfileCurrentAcademicsMisc struct { + CurrentCGPA GenericField[float64] `json:"current_cgpa,omitempty"` + ActiveBacklogs GenericField[int] `json:"active_backlogs,omitempty"` + TotalBacklogs GenericField[int] `json:"total_backlogs,omitempty"` +} + +type ProfileSemesterSPI struct { + One GenericField[float64] `json:"one,omitempty"` + Two GenericField[float64] `json:"two,omitempty"` + Three GenericField[float64] `json:"three,omitempty"` + Four GenericField[float64] `json:"four,omitempty"` + Five GenericField[float64] `json:"five,omitempty"` + Six GenericField[float64] `json:"six,omitempty"` + Seven GenericField[float64] `json:"seven,omitempty"` + Eight GenericField[float64] `json:"eight,omitempty"` + Nine GenericField[float64] `json:"nine,omitempty"` + Ten GenericField[float64] `json:"ten,omitempty"` +} + +type ProfileSummerTermSPI struct { + One GenericField[float64] `json:"one,omitempty"` + Two GenericField[float64] `json:"two,omitempty"` + Three GenericField[float64] `json:"three,omitempty"` + Four GenericField[float64] `json:"four,omitempty"` + Five GenericField[float64] `json:"five,omitempty"` +} + +type ProfileCurrentAcademics struct { + Misc ProfileCurrentAcademicsMisc `json:"misc,omitempty"` + SemesterSPI ProfileSemesterSPI `json:"semester_spi,omitempty"` + SummerTermSPI ProfileSummerTermSPI `json:"summer_term_spi,omitempty"` +} + +type StudentProfile struct { + Profile ProfileDetails `json:"profile,omitempty"` + PastAcademics ProfilePastAcademics `json:"past_academics,omitempty"` + CurrentAcademics ProfileCurrentAcademics `json:"current_academics,omitempty"` +} diff --git a/interfaces/student.go b/interfaces/student.go index f674e01..39c280a 100644 --- a/interfaces/student.go +++ b/interfaces/student.go @@ -17,7 +17,7 @@ type StudentRegistration struct { Course string `json:"course" bson:"course"` Specialisation *string `json:"specialisation" bson:"specialisation"` - Mobile *string `json:"mobile" bson:"mobile"` + Mobile string `json:"mobile" bson:"mobile"` PersonalEmail string `json:"personalEmail" bson:"personalEmail"` Gender *Constant.Gender `json:"gender" bson:"gender"` diff --git a/main.go b/main.go index 7ffa699..f9140d2 100644 --- a/main.go +++ b/main.go @@ -28,6 +28,7 @@ func main() { Password: os.Getenv(constants.REDIS_PASSWORD), Username: os.Getenv(constants.REDIS_USERNAME), }, + FallbackToDefault: true, }) // Initialie default JWKs @@ -61,6 +62,9 @@ func main() { student.GET("/tpr/all", handler.GinVerifyStudent, handler.GetRoleCheckHandlerForStudent(constants.ROLE_ADMIN), handler.GetAllTprs) student.GET("/tprLogin", handler.GinVerifyStudent, handler.GetRoleCheckHandlerForStudent(constants.ROLE_TPR), handler.HandlerTprLogin) student.PUT("/update", handler.GinVerifyStudent, handler.HandlerUpdateStudentDetails) + + student.GET("/profile", handler.GinVerifyStudent, handler.HandlerGetStudentProfile) + student.PUT("/profile", handler.GinVerifyStudent, handler.HandlerUpdateStudentProfile) student.POST("/register", handler.HandlerRegisterStudentDetails) }