Skip to content

Commit

Permalink
feat: fixes main.go script errors; adds route to fetch a user's awards
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrltrent committed Dec 19, 2023
1 parent fb0875c commit dceb4a4
Show file tree
Hide file tree
Showing 23 changed files with 289 additions and 144 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ go run ./scripts/main.go --seed-report-types # Seed report types
go run ./scripts/main.go --seed-post-categories # Seed post categories
go run ./scripts/main.go --seed-faculties # Seed faculties
go run ./scripts/main.go --seed-years-of-study # Seed years of study
go run ./scripts/main.go --seed-award-types # Seed award types (THIS ORDER MATTERS!!)

```

Expand Down
5 changes: 3 additions & 2 deletions db/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ type Chat struct {
}

type AwardType struct {
ID EncryptedID `gorm:"primaryKey;column:id" json:"id"`
ID EncryptedID `gorm:"primaryKey;column:id" json:"-"`
Name string `gorm:"column:name" json:"name"`
Description string `gorm:"column:description" json:"description"`
Icon string `gorm:"column:icon" json:"icon"`
Expand All @@ -524,7 +524,8 @@ func (AwardType) TableName() string {
type AwardsTotal struct {
ID EncryptedID `gorm:"primaryKey;column:id" json:"id"`
UserID string `gorm:"column:user_id" json:"-"`
AwardTypeID EncryptedID `gorm:"column:award_type_id" json:"award_type_id"`
AwardTypeID EncryptedID `gorm:"column:award_type_id" json:"-"`
AwardType AwardType `gorm:"foreignKey:AwardTypeID" json:"award_type,omitempty"`
Total uint `gorm:"column:total" json:"total"`
}

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ require (
github.com/jackc/pgtype v1.14.0
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/joho/godotenv v1.5.1
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
Expand Down
32 changes: 16 additions & 16 deletions handlers/admin/requests.http

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions handlers/auth/requests.http
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Content-Type: application/json
PATCH http://127.0.0.1:8080/api/v1/auth/update-email
Content-Type: application/json
X-AppCheck-Token: kXfeSRgYTnoUztu6MO8FndqiRayoBaJqyDKQmoqvX3V9sZVlep/cm7cP!mgd-B9H
Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImJlNzgyM2VmMDFiZDRkMmI5NjI3NDE2NThkMjA4MDdlZmVlNmRlNWMiLCJ0eXAiOiJKV1QifQ.ey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cnZlci1kZXYiLCJhdWQiOiJjb25mZXNpLXNlcnZlci1kZXYiLCJhdXRoX3RpbWUiOjE3MDI5ODY3MTksInVzZXJfaWQiOiJzQWxoN1p5bkVmYzd6ZUhHU3Y4TWVYamVLWVQyIiwic3ViIjoic0FsaDdaeW5FZmM3emVIR1N2OE1lWGplS1lUMiIsImlhdCI6MTcwMjk4NjcxOSwiZXhwIjoxNzAyOTkwMzE5LCJlbWFpbCI6Im1hdHRoZXcucmwudHJlbnRAZ21haWwuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsImZpcmViYXNlIjp7ImlkZW50aXRpZXMiOnsiZW1haWwiOlsibWF0dGhldy5ybC50cmVudEBnbWFpbC5jb20iXX0sInNpZ25faW5fcHJvdmlkZXIiOiJwYXNzd29yZCJ9fQ.OD2gHsh0AVEOMuhGK-GyyaHO2BR9xWRmAu40KzzF5n7AMW3taSVrtwSyFWT3kxnebM2V1g0R2wbFcziixJZ6YLZgF1d9SeJFa2w3M4K2F3C1YwL16sCNAPzrw5uXeoYusrCMZA1LSRrapKzB0K7dMKtKZDostkNMrDePDS0rE3TZtM1L7-mR1SkMRoq-BnSjiXDIpXcLzmzI9NbRgtcxer6NdcqSSLQBwGZWVkPmbTV1_h2aVDFz21r561TE5ROh29YMZ3fgdCxFJoSnJk-oUcsh07H53D4o49r0oeNaFlZJbl_7crkDsgW3RsOwFyGcVMuArnQVPGJzIaqAPvOVwg

{
"email": "[email protected]"
Expand All @@ -25,15 +25,15 @@ Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImJlNzgyM2VmMDFiZDRkMmI5NjI3ND

POST http://127.0.0.1:8080/api/v1/auth/resend-verification-email
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImJlNzgyM2VmMDFiZDRkMmI5NjI3NDE2NThkMjA4MDdlZmVlNmRlNWMiLCJ0eXAiOiJKV1QifQ.eyJyb2xlcyI6W10sInN5bmMiOnRydWUsImlzcyI6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cnZlci1kZXYiLCJhdXRoX3RpbWUiOjE3MDI5ODY3MTksInVzZXJfaWQiOiJzQWxoN1p5bkVmYzd6ZUhHU3Y4TWVYamVLWVQyIiwic3ViIjoic0FsaDdaeW5FZmM3emVIR1N2OE1lWGplS1lUMiIsImlhdCI6MTcwMjk4NjcxOSwiZXhwIjoxNzAyOTkwMzE5LCJlbWFpbCI6Im1hdHRoZXcucmwudHJlbnRAZ21haWwuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsImZpcmViYXNlIjp7ImlkZW50aXRpZXMiOnsiZW1haWwiOlsibWF0dGhldy5ybC50cmVudEBnbWFpbC5jb20iXX0sInNpZ25faW5fcHJvdmlkZXIiOiJwYXNzd29yZCJ9fQ.OD2gHsh0AVEOMuhGK-GyyaHO2BR9xWRmAu40KzzF5n7AMW3taSVrtwSyFWT3kxnebM2V1g0R2wbFcziixJZ6YLZgF1d9SeJFa2w3M4K2F3C1YwL16sCNAPzrw5uXeoYusrCMZA1LSRrapKzB0K7dMKtKZDostkNMrDePDS0rE3TZtM1L7-mR1SkMRoq-BnSjiXDIpXcLzmzI9NbRgtcxer6NdcqSSLQBwGZWVkPmbTV1_h2aVDFz21r561TE5ROh29YMZ3fgdCxFJoSnJk-oUcsh07H53D4o49r0oeNaFlZJbl_7crkDsgW3RsOwFyGcVMuArnQVPGJzIaqAPvOVwg

{}

### Send password reset email

POST http://127.0.0.1:8080/api/v1/auth/send-password-reset-email
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImJlNzgyM2VmMDFiZDRkMmI5NjI3NDE2NThkMjA4MDdlZmVlNmRlNWMiLCJ0eXAiOiJKV1QifQ.eyJyb2xlcyI6W10sInN5bmMiOnRydWUsImlzcyI6Imh0dHBzOi8vc2VjdXJldG9rZW4uZ29vZ2xlLmNvbS9jb25mZXNpLXNlcnZlci1kZXYiLCJhdWQiOiJjb25mZXNpLXNlcnZlci1kZXYiLCJhdXRoX3RpbWUiOjE3M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VIR1N2OE1lWGplS1lUMiIsImlhdCI6MTcwMjk4NjcxOSwiZXhwIjoxNzAyOTkwMzE5LCJlbWFpbCI6Im1hdHRoZXcucmwudHJlbnRAZ21haWwuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsImZpcmViYXNlIjp7ImlkZW50aXRpZXMiOnsiZW1haWwiOlsibWF0dGhldy5ybC50cmVudEBnbWFpbC5jb20iXX0sInNpZ25faW5fcHJvdmlkZXIiOiJwYXNzd29yZCJ9fQ.OD2gHsh0AVEOMuhGK-GyyaHO2BR9xWRmAu40KzzF5n7AMW3taSVrtwSyFWT3kxnebM2V1g0R2wbFcziixJZ6YLZgF1d9SeJFa2w3M4K2F3C1YwL16sCNAPzrw5uXeoYusrCMZA1LSRrapKzB0K7dMKtKZDostkNMrDePDS0rE3TZtM1L7-mR1SkMRoq-BnSjiXDIpXcLzmzI9NbRgtcxer6NdcqSSLQBwGZWVkPmbTV1_h2aVDFz21r561TE5ROh29YMZ3fgdCxFJoSnJk-oUcsh07H53D4o49r0oeNaFlZJbl_7crkDsgW3RsOwFyGcVMuArnQVPGJzIaqAPvOVwg

{
"email": "[email protected]"
Expand Down
Loading

0 comments on commit dceb4a4

Please sign in to comment.