From 86351412d8d80840adafe047aee103295c2000f8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 13:06:18 -0400 Subject: [PATCH 01/16] Chore(deps): Bump github.com/aws/aws-sdk-go from 1.50.5 to 1.51.21 in /backend (#531) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- backend/go.mod | 2 +- backend/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/go.mod b/backend/go.mod index 21f721d1c..f867c3506 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -4,7 +4,7 @@ go 1.22.2 require ( github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 - github.com/aws/aws-sdk-go v1.50.5 + github.com/aws/aws-sdk-go v1.51.21 github.com/garrettladley/mattress v0.4.0 github.com/go-playground/validator/v10 v10.19.0 github.com/goccy/go-json v0.10.2 diff --git a/backend/go.sum b/backend/go.sum index a7976b02e..cdbd3120f 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -8,8 +8,8 @@ github.com/awnumar/memcall v0.2.0 h1:sRaogqExTOOkkNwO9pzJsL8jrOV29UuUW7teRMfbqtI github.com/awnumar/memcall v0.2.0/go.mod h1:S911igBPR9CThzd/hYQQmTc9SWNu3ZHIlCGaWsWsoJo= github.com/awnumar/memguard v0.22.5 h1:PH7sbUVERS5DdXh3+mLo8FDcl1eIeVjJVYMnyuYpvuI= github.com/awnumar/memguard v0.22.5/go.mod h1:+APmZGThMBWjnMlKiSM1X7MVpbIVewen2MTkqWkA/zE= -github.com/aws/aws-sdk-go v1.50.5 h1:H2Aadcgwr7a2aqS6ZwcE+l1mA6ZrTseYCvjw2QLmxIA= -github.com/aws/aws-sdk-go v1.50.5/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go v1.51.21 h1:UrT6JC9R9PkYYXDZBV0qDKTualMr+bfK2eboTknMgbs= +github.com/aws/aws-sdk-go v1.51.21/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= From 1cf12ac800d5ceb70a444f32db6e977f0d21a49e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 13:06:52 -0400 Subject: [PATCH 02/16] Chore(deps-dev): Bump @types/node from 20.12.5 to 20.12.7 in /frontend/sac-web (#532) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Garrett Ladley <92384606+garrettladley@users.noreply.github.com> --- frontend/sac-web/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/sac-web/yarn.lock b/frontend/sac-web/yarn.lock index 01e195661..2a944db38 100644 --- a/frontend/sac-web/yarn.lock +++ b/frontend/sac-web/yarn.lock @@ -796,9 +796,9 @@ integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== "@types/node@*", "@types/node@^20": - version "20.12.5" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.5.tgz#74c4f31ab17955d0b5808cdc8fd2839526ad00b3" - integrity sha512-BD+BjQ9LS/D8ST9p5uqBxghlN+S42iuNxjsUGjeZobe/ciXzk2qb1B6IXc6AnRLS+yFJRpN2IPEHMzwspfDJNw== + version "20.12.7" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.7.tgz#04080362fa3dd6c5822061aa3124f5c152cff384" + integrity sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg== dependencies: undici-types "~5.26.4" From 4e6d04ea908dd0672cf852a181f974eaeada91d2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 13:07:27 -0400 Subject: [PATCH 03/16] Chore(deps-dev): Bump @types/react from 18.2.74 to 18.2.78 in /frontend/sac-web (#533) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Garrett Ladley <92384606+garrettladley@users.noreply.github.com> --- frontend/sac-web/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/sac-web/yarn.lock b/frontend/sac-web/yarn.lock index 2a944db38..4f35afaa4 100644 --- a/frontend/sac-web/yarn.lock +++ b/frontend/sac-web/yarn.lock @@ -815,9 +815,9 @@ "@types/react" "*" "@types/react@*", "@types/react@^18": - version "18.2.74" - resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.74.tgz#2d52eb80e4e7c4ea8812c89181d6d590b53f958c" - integrity sha512-9AEqNZZyBx8OdZpxzQlaFEVCSFUM2YXJH46yPOiOpm078k6ZLOCcuAzGum/zK8YBwY+dbahVNbHrbgrAwIRlqw== + version "18.2.78" + resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.78.tgz#94aec453d0ccca909998a2b4b2fd78af15a7d2fe" + integrity sha512-qOwdPnnitQY4xKlKayt42q5W5UQrSHjgoXNVEtxeqdITJ99k4VXJOP3vt8Rkm9HmgJpH50UNU+rlqfkfWOqp0A== dependencies: "@types/prop-types" "*" csstype "^3.0.2" From 8ff877ef00cb20a1305d24cd865f0193feb0a6c8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 13:07:59 -0400 Subject: [PATCH 04/16] Chore(deps): Bump react-native-maps from 1.10.0 to 1.14.0 in /frontend/sac-mobile (#541) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Garrett Ladley <92384606+garrettladley@users.noreply.github.com> --- frontend/sac-mobile/package.json | 2 +- frontend/sac-mobile/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/sac-mobile/package.json b/frontend/sac-mobile/package.json index aa6dec37e..09ec2cc19 100644 --- a/frontend/sac-mobile/package.json +++ b/frontend/sac-mobile/package.json @@ -48,7 +48,7 @@ "react-native-element-dropdown": "^2.10.4", "react-native-gesture-handler": "~2.14.0", "react-native-loading-spinner-overlay": "^3.0.1", - "react-native-maps": "1.10.0", + "react-native-maps": "1.14.0", "react-native-open-maps": "^0.4.3", "react-native-reanimated": "~3.6.2", "react-native-safe-area-context": "4.9.0", diff --git a/frontend/sac-mobile/yarn.lock b/frontend/sac-mobile/yarn.lock index 335e266b8..fc631810c 100644 --- a/frontend/sac-mobile/yarn.lock +++ b/frontend/sac-mobile/yarn.lock @@ -8647,10 +8647,10 @@ react-native-loading-spinner-overlay@^3.0.1: resolved "https://registry.yarnpkg.com/react-native-loading-spinner-overlay/-/react-native-loading-spinner-overlay-3.0.1.tgz#092481b8cce157d3af5ef942f845ad981f96bd36" integrity sha512-4GdR54HQnKg2HPSSisVizfTLuyhSh4splY9eb8mKiYF1Ihjn/5EmdNo5bN3S7uKPFRC3WLzIZIouX6G6fXfnjw== -react-native-maps@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/react-native-maps/-/react-native-maps-1.10.0.tgz#1b78270473f4caadc5ff8e8400285b6db9f14e12" - integrity sha512-Zs6lHZucEijTwkRVFyInMbPVkJ2UudDEI2fJPc8ArdzdnwDFAdL6OagqTjNRZyI1DBPHRihazfIWpy2+X1VwLg== +react-native-maps@1.14.0: + version "1.14.0" + resolved "https://registry.yarnpkg.com/react-native-maps/-/react-native-maps-1.14.0.tgz#1e5cac8e88d80002c512dd4763a205493a1ae58d" + integrity sha512-ai7h4UdRLGPFCguz1fI8n4sKLEh35nZXHAH4nSWyAeHGrN8K9GjICu9Xd4Q5Ok4h+WwrM6Xz5pGbF3Qm1tO6iQ== dependencies: "@types/geojson" "^7946.0.13" From 9128ffe0d1b60aa757f59798f9f5bfc7964f579b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 13:08:32 -0400 Subject: [PATCH 05/16] Chore(deps-dev): Bump @types/react from 18.2.74 to 18.2.78 in /frontend/sac-mobile (#540) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Garrett Ladley <92384606+garrettladley@users.noreply.github.com> --- frontend/sac-mobile/package.json | 2 +- frontend/sac-mobile/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/sac-mobile/package.json b/frontend/sac-mobile/package.json index 09ec2cc19..8c72c8fdb 100644 --- a/frontend/sac-mobile/package.json +++ b/frontend/sac-mobile/package.json @@ -63,7 +63,7 @@ "@babel/core": "^7.24.4", "@react-native-community/eslint-config": "^3.2.0", "@trivago/prettier-plugin-sort-imports": "^4.3.0", - "@types/react": "~18.2.74", + "@types/react": "~18.2.78", "eslint": "^8.56.0", "eslint-plugin-prettier": "^5.1.3", "jest": "^29.2.1", diff --git a/frontend/sac-mobile/yarn.lock b/frontend/sac-mobile/yarn.lock index fc631810c..b7a2b4583 100644 --- a/frontend/sac-mobile/yarn.lock +++ b/frontend/sac-mobile/yarn.lock @@ -2927,10 +2927,10 @@ resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.11.tgz#2596fb352ee96a1379c657734d4b913a613ad563" integrity sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng== -"@types/react@~18.2.74": - version "18.2.74" - resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.74.tgz#2d52eb80e4e7c4ea8812c89181d6d590b53f958c" - integrity sha512-9AEqNZZyBx8OdZpxzQlaFEVCSFUM2YXJH46yPOiOpm078k6ZLOCcuAzGum/zK8YBwY+dbahVNbHrbgrAwIRlqw== +"@types/react@~18.2.78": + version "18.2.78" + resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.78.tgz#94aec453d0ccca909998a2b4b2fd78af15a7d2fe" + integrity sha512-qOwdPnnitQY4xKlKayt42q5W5UQrSHjgoXNVEtxeqdITJ99k4VXJOP3vt8Rkm9HmgJpH50UNU+rlqfkfWOqp0A== dependencies: "@types/prop-types" "*" csstype "^3.0.2" From e9b10169af75ebef8e7c567ebf4ceea64f4d7f47 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 13:09:06 -0400 Subject: [PATCH 06/16] Chore(deps): Bump react-native-gesture-handler from 2.14.1 to 2.16.0 in /frontend/sac-mobile (#539) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Garrett Ladley <92384606+garrettladley@users.noreply.github.com> --- frontend/sac-mobile/package.json | 2 +- frontend/sac-mobile/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/sac-mobile/package.json b/frontend/sac-mobile/package.json index 8c72c8fdb..1a64bf015 100644 --- a/frontend/sac-mobile/package.json +++ b/frontend/sac-mobile/package.json @@ -46,7 +46,7 @@ "react-native": "0.73.6", "react-native-cookies": "^3.3.0", "react-native-element-dropdown": "^2.10.4", - "react-native-gesture-handler": "~2.14.0", + "react-native-gesture-handler": "~2.16.0", "react-native-loading-spinner-overlay": "^3.0.1", "react-native-maps": "1.14.0", "react-native-open-maps": "^0.4.3", diff --git a/frontend/sac-mobile/yarn.lock b/frontend/sac-mobile/yarn.lock index b7a2b4583..e9948f389 100644 --- a/frontend/sac-mobile/yarn.lock +++ b/frontend/sac-mobile/yarn.lock @@ -8631,10 +8631,10 @@ react-native-element-dropdown@^2.10.4: dependencies: lodash "^4.17.21" -react-native-gesture-handler@~2.14.0: - version "2.14.1" - resolved "https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-2.14.1.tgz#930640231024b7921435ab476aa501dd4a6b2e01" - integrity sha512-YiM1BApV4aKeuwsM6O4C2ufwewYEKk6VMXOt0YqEZFMwABBFWhXLySFZYjBSNRU2USGppJbfHP1q1DfFQpKhdA== +react-native-gesture-handler@~2.16.0: + version "2.16.0" + resolved "https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-2.16.0.tgz#45a00b5988e74ebc58f130c8d1443319c8e678db" + integrity sha512-1hFkx7RIfeJSyTQQ0Nkv4icFVZ5+XjQkd47OgZMBFzoB7ecL+nFSz8KLi3OCWOhq+nbHpSPlSG5VF3CQNCJpWA== dependencies: "@egjs/hammerjs" "^2.0.17" hoist-non-react-statics "^3.3.0" From c7aa1719398ac8f49797bf8c268d5f97589b9375 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 13:09:40 -0400 Subject: [PATCH 07/16] Chore(deps-dev): Bump typescript from 5.4.4 to 5.4.5 in /frontend/sac-mobile (#538) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Garrett Ladley <92384606+garrettladley@users.noreply.github.com> --- frontend/sac-mobile/package.json | 2 +- frontend/sac-mobile/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/sac-mobile/package.json b/frontend/sac-mobile/package.json index 1a64bf015..c83154565 100644 --- a/frontend/sac-mobile/package.json +++ b/frontend/sac-mobile/package.json @@ -72,7 +72,7 @@ "react-native-svg-transformer": "^1.3.0", "react-test-renderer": "18.2.0", "tailwindcss": "3.3.2", - "typescript": "^5.4.4" + "typescript": "^5.4.5" }, "private": true } diff --git a/frontend/sac-mobile/yarn.lock b/frontend/sac-mobile/yarn.lock index e9948f389..da13023e4 100644 --- a/frontend/sac-mobile/yarn.lock +++ b/frontend/sac-mobile/yarn.lock @@ -10072,10 +10072,10 @@ typed-array-length@^1.0.5: is-typed-array "^1.1.13" possible-typed-array-names "^1.0.0" -typescript@^5.4.4: - version "5.4.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.4.tgz#eb2471e7b0a5f1377523700a21669dce30c2d952" - integrity sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw== +typescript@^5.4.5: + version "5.4.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611" + integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ== ua-parser-js@^1.0.35: version "1.0.37" From 601a1106e04e312b92982c4c1f880309c04461e2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 13:10:31 -0400 Subject: [PATCH 08/16] Chore(deps-dev): Bump typescript from 5.4.4 to 5.4.5 in /frontend/sac-web (#534) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Garrett Ladley <92384606+garrettladley@users.noreply.github.com> --- frontend/sac-web/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/sac-web/yarn.lock b/frontend/sac-web/yarn.lock index 4f35afaa4..9153a027b 100644 --- a/frontend/sac-web/yarn.lock +++ b/frontend/sac-web/yarn.lock @@ -4272,9 +4272,9 @@ typed-array-length@^1.0.5: possible-typed-array-names "^1.0.0" typescript@^5: - version "5.4.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.4.tgz#eb2471e7b0a5f1377523700a21669dce30c2d952" - integrity sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw== + version "5.4.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611" + integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ== unbox-primitive@^1.0.2: version "1.0.2" From 67a62030372097d92691fd1838f7f55c281e9641 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 13:11:12 -0400 Subject: [PATCH 09/16] Chore(deps): Bump next from 14.1.4 to 14.2.1 in /frontend/sac-web (#535) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Garrett Ladley <92384606+garrettladley@users.noreply.github.com> --- frontend/sac-web/package.json | 2 +- frontend/sac-web/yarn.lock | 140 ++++++++++++++++++---------------- 2 files changed, 74 insertions(+), 68 deletions(-) diff --git a/frontend/sac-web/package.json b/frontend/sac-web/package.json index 8772217c3..d1cc7ff0c 100644 --- a/frontend/sac-web/package.json +++ b/frontend/sac-web/package.json @@ -11,7 +11,7 @@ "format": "prettier --write ." }, "dependencies": { - "next": "14.1.4", + "next": "14.2.1", "react": "^18", "react-dom": "^18", "semver": "7.6.0" diff --git a/frontend/sac-web/yarn.lock b/frontend/sac-web/yarn.lock index 9153a027b..976a27793 100644 --- a/frontend/sac-web/yarn.lock +++ b/frontend/sac-web/yarn.lock @@ -617,10 +617,10 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" -"@next/env@14.1.4": - version "14.1.4" - resolved "https://registry.yarnpkg.com/@next/env/-/env-14.1.4.tgz#432e80651733fbd67230bf262aee28be65252674" - integrity sha512-e7X7bbn3Z6DWnDi75UWn+REgAbLEqxI8Tq2pkFOFAMpWAWApz/YCUhtWMWn410h8Q2fYiYL7Yg5OlxMOCfFjJQ== +"@next/env@14.2.1": + version "14.2.1" + resolved "https://registry.yarnpkg.com/@next/env/-/env-14.2.1.tgz#18b4fb5fd76bdda65369ad4ea5f33199ae708d2f" + integrity sha512-qsHJle3GU3CmVx7pUoXcghX4sRN+vINkbLdH611T8ZlsP//grzqVW87BSUgOZeSAD4q7ZdZicdwNe/20U2janA== "@next/eslint-plugin-next@14.1.4": version "14.1.4" @@ -629,50 +629,50 @@ dependencies: glob "10.3.10" -"@next/swc-darwin-arm64@14.1.4": - version "14.1.4" - resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.1.4.tgz#a3bca0dc4393ac4cf3169bbf24df63441de66bb7" - integrity sha512-ubmUkbmW65nIAOmoxT1IROZdmmJMmdYvXIe8211send9ZYJu+SqxSnJM4TrPj9wmL6g9Atvj0S/2cFmMSS99jg== - -"@next/swc-darwin-x64@14.1.4": - version "14.1.4" - resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-14.1.4.tgz#ba3683d4e2d30099f3f2864dd7349a4d9f440140" - integrity sha512-b0Xo1ELj3u7IkZWAKcJPJEhBop117U78l70nfoQGo4xUSvv0PJSTaV4U9xQBLvZlnjsYkc8RwQN1HoH/oQmLlQ== - -"@next/swc-linux-arm64-gnu@14.1.4": - version "14.1.4" - resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.1.4.tgz#3519969293f16379954b7e196deb0c1eecbb2f8b" - integrity sha512-457G0hcLrdYA/u1O2XkRMsDKId5VKe3uKPvrKVOyuARa6nXrdhJOOYU9hkKKyQTMru1B8qEP78IAhf/1XnVqKA== - -"@next/swc-linux-arm64-musl@14.1.4": - version "14.1.4" - resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.1.4.tgz#4bb3196bd402b3f84cf5373ff1021f547264d62f" - integrity sha512-l/kMG+z6MB+fKA9KdtyprkTQ1ihlJcBh66cf0HvqGP+rXBbOXX0dpJatjZbHeunvEHoBBS69GYQG5ry78JMy3g== - -"@next/swc-linux-x64-gnu@14.1.4": - version "14.1.4" - resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.1.4.tgz#1b3372c98c83dcdab946cdb4ee06e068b8139ba3" - integrity sha512-BapIFZ3ZRnvQ1uWbmqEGJuPT9cgLwvKtxhK/L2t4QYO7l+/DxXuIGjvp1x8rvfa/x1FFSsipERZK70pewbtJtw== - -"@next/swc-linux-x64-musl@14.1.4": - version "14.1.4" - resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.1.4.tgz#8459088bdc872648ff78f121db596f2533df5808" - integrity sha512-mqVxTwk4XuBl49qn2A5UmzFImoL1iLm0KQQwtdRJRKl21ylQwwGCxJtIYo2rbfkZHoSKlh/YgztY0qH3wG1xIg== - -"@next/swc-win32-arm64-msvc@14.1.4": - version "14.1.4" - resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.1.4.tgz#84280a08c00cc3be24ddd3a12f4617b108e6dea6" - integrity sha512-xzxF4ErcumXjO2Pvg/wVGrtr9QQJLk3IyQX1ddAC/fi6/5jZCZ9xpuL9Tzc4KPWMFq8GGWFVDMshZOdHGdkvag== - -"@next/swc-win32-ia32-msvc@14.1.4": - version "14.1.4" - resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.1.4.tgz#23ff7f4bd0a27177428669ef6fa5c3923c738031" - integrity sha512-WZiz8OdbkpRw6/IU/lredZWKKZopUMhcI2F+XiMAcPja0uZYdMTZQRoQ0WZcvinn9xZAidimE7tN9W5v9Yyfyw== - -"@next/swc-win32-x64-msvc@14.1.4": - version "14.1.4" - resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.1.4.tgz#bccf5beccfde66d6c66fa4e2509118c796385eda" - integrity sha512-4Rto21sPfw555sZ/XNLqfxDUNeLhNYGO2dlPqsnuCg8N8a2a9u1ltqBOPQ4vj1Gf7eJC0W2hHG2eYUHuiXgY2w== +"@next/swc-darwin-arm64@14.2.1": + version "14.2.1" + resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.1.tgz#44ca580ccac1396fa45e2bcc6584238098491e71" + integrity sha512-kGjnjcIJehEcd3rT/3NAATJQndAEELk0J9GmGMXHSC75TMnvpOhONcjNHbjtcWE5HUQnIHy5JVkatrnYm1QhVw== + +"@next/swc-darwin-x64@14.2.1": + version "14.2.1" + resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.1.tgz#1747091f40fd3b0d8e072ba62203ec998619525f" + integrity sha512-dAdWndgdQi7BK2WSXrx4lae7mYcOYjbHJUhvOUnJjMNYrmYhxbbvJ2xElZpxNxdfA6zkqagIB9He2tQk+l16ew== + +"@next/swc-linux-arm64-gnu@14.2.1": + version "14.2.1" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.1.tgz#ede705718c316e65e3dd9ab31962824b8befb0cb" + integrity sha512-2ZctfnyFOGvTkoD6L+DtQtO3BfFz4CapoHnyLTXkOxbZkVRgg3TQBUjTD/xKrO1QWeydeo8AWfZRg8539qNKrg== + +"@next/swc-linux-arm64-musl@14.2.1": + version "14.2.1" + resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.1.tgz#ce50a5d94a7ba1f8e34a941f4ca076d8beebc79c" + integrity sha512-jazZXctiaanemy4r+TPIpFP36t1mMwWCKMsmrTRVChRqE6putyAxZA4PDujx0SnfvZHosjdkx9xIq9BzBB5tWg== + +"@next/swc-linux-x64-gnu@14.2.1": + version "14.2.1" + resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.1.tgz#ac3e8fa4d028fe7a9d9b7c33db3ab65679ae5fe2" + integrity sha512-VjCHWCjsAzQAAo8lkBOLEIkBZFdfW+Z18qcQ056kL4KpUYc8o59JhLDCBlhg+hINQRgzQ2UPGma2AURGOH0+Qg== + +"@next/swc-linux-x64-musl@14.2.1": + version "14.2.1" + resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.1.tgz#2beb7bee80dfb54a36d81392f21c599014018177" + integrity sha512-7HZKYKvAp4nAHiHIbY04finRqjeYvkITOGOurP1aLMexIFG/1+oCnqhGogBdc4lao/lkMW1c+AkwWSzSlLasqw== + +"@next/swc-win32-arm64-msvc@14.2.1": + version "14.2.1" + resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.1.tgz#b25df35a6ed99eb73bfed07822dd28a37aaab9f9" + integrity sha512-YGHklaJ/Cj/F0Xd8jxgj2p8po4JTCi6H7Z3Yics3xJhm9CPIqtl8erlpK1CLv+HInDqEWfXilqatF8YsLxxA2Q== + +"@next/swc-win32-ia32-msvc@14.2.1": + version "14.2.1" + resolved "https://registry.yarnpkg.com/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.1.tgz#2cc67b93f0a71a8f3c1dd735676f4c9ddd4240ff" + integrity sha512-o+ISKOlvU/L43ZhtAAfCjwIfcwuZstiHVXq/BDsZwGqQE0h/81td95MPHliWCnFoikzWcYqh+hz54ZB2FIT8RA== + +"@next/swc-win32-x64-msvc@14.2.1": + version "14.2.1" + resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.1.tgz#e5f4003930de4a150a8c2e7cf5c133cd99a686bd" + integrity sha512-GmRoTiLcvCLifujlisknv4zu9/C4i9r0ktsA8E51EMqJL4bD4CpO7lDYr7SrUxCR0tS4RVcrqKmCak24T0ohaw== "@nodelib/fs.scandir@2.1.5": version "2.1.5" @@ -724,11 +724,17 @@ dependencies: "@sinonjs/commons" "^3.0.0" -"@swc/helpers@0.5.2": - version "0.5.2" - resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.5.2.tgz#85ea0c76450b61ad7d10a37050289eded783c27d" - integrity sha512-E4KcWTpoLHqwPHLxidpOqQbcrZVgi0rsmmZXUle1jXmJfuIf/UWpczUJ7MZZ5tlxytgJXyp0w4PGkkeLiuIdZw== +"@swc/counter@^0.1.3": + version "0.1.3" + resolved "https://registry.yarnpkg.com/@swc/counter/-/counter-0.1.3.tgz#cc7463bd02949611c6329596fccd2b0ec782b0e9" + integrity sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ== + +"@swc/helpers@0.5.5": + version "0.5.5" + resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.5.5.tgz#12689df71bfc9b21c4f4ca00ae55f2f16c8b77c0" + integrity sha512-KGYxvIOXcceOAbEk4bi/dVLEK9z8sZ0uBB3Il5b1rhfClSpcX0yfRO0KmTkqR2cnQDymwLB+25ZyMzICg/cm/A== dependencies: + "@swc/counter" "^0.1.3" tslib "^2.4.0" "@types/babel__core@^7.1.14": @@ -3299,28 +3305,28 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== -next@14.1.4: - version "14.1.4" - resolved "https://registry.yarnpkg.com/next/-/next-14.1.4.tgz#203310f7310578563fd5c961f0db4729ce7a502d" - integrity sha512-1WTaXeSrUwlz/XcnhGTY7+8eiaFvdet5z9u3V2jb+Ek1vFo0VhHKSAIJvDWfQpttWjnyw14kBeq28TPq7bTeEQ== +next@14.2.1: + version "14.2.1" + resolved "https://registry.yarnpkg.com/next/-/next-14.2.1.tgz#081509478156407e4c181ad4791fea0a43c6347d" + integrity sha512-SF3TJnKdH43PMkCcErLPv+x/DY1YCklslk3ZmwaVoyUfDgHKexuKlf9sEfBQ69w+ue8jQ3msLb+hSj1T19hGag== dependencies: - "@next/env" "14.1.4" - "@swc/helpers" "0.5.2" + "@next/env" "14.2.1" + "@swc/helpers" "0.5.5" busboy "1.6.0" caniuse-lite "^1.0.30001579" graceful-fs "^4.2.11" postcss "8.4.31" styled-jsx "5.1.1" optionalDependencies: - "@next/swc-darwin-arm64" "14.1.4" - "@next/swc-darwin-x64" "14.1.4" - "@next/swc-linux-arm64-gnu" "14.1.4" - "@next/swc-linux-arm64-musl" "14.1.4" - "@next/swc-linux-x64-gnu" "14.1.4" - "@next/swc-linux-x64-musl" "14.1.4" - "@next/swc-win32-arm64-msvc" "14.1.4" - "@next/swc-win32-ia32-msvc" "14.1.4" - "@next/swc-win32-x64-msvc" "14.1.4" + "@next/swc-darwin-arm64" "14.2.1" + "@next/swc-darwin-x64" "14.2.1" + "@next/swc-linux-arm64-gnu" "14.2.1" + "@next/swc-linux-arm64-musl" "14.2.1" + "@next/swc-linux-x64-gnu" "14.2.1" + "@next/swc-linux-x64-musl" "14.2.1" + "@next/swc-win32-arm64-msvc" "14.2.1" + "@next/swc-win32-ia32-msvc" "14.2.1" + "@next/swc-win32-x64-msvc" "14.2.1" node-int64@^0.4.0: version "0.4.0" From 11c866ae1e1f133f942821210822f843657373f8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 13:11:53 -0400 Subject: [PATCH 10/16] Chore(deps-dev): Bump eslint-config-next from 14.1.4 to 14.2.1 in /frontend/sac-web (#536) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Garrett Ladley <92384606+garrettladley@users.noreply.github.com> --- frontend/sac-web/package.json | 2 +- frontend/sac-web/yarn.lock | 78 +++++++++++++++++------------------ 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/frontend/sac-web/package.json b/frontend/sac-web/package.json index d1cc7ff0c..ac72a0d41 100644 --- a/frontend/sac-web/package.json +++ b/frontend/sac-web/package.json @@ -22,7 +22,7 @@ "@types/react-dom": "^18", "autoprefixer": "^10.4.19", "eslint": "^8", - "eslint-config-next": "14.1.4", + "eslint-config-next": "14.2.1", "jest": "^29.2.1", "postcss": "^8", "prettier": "^3.2.4", diff --git a/frontend/sac-web/yarn.lock b/frontend/sac-web/yarn.lock index 976a27793..4a54eeeaa 100644 --- a/frontend/sac-web/yarn.lock +++ b/frontend/sac-web/yarn.lock @@ -622,10 +622,10 @@ resolved "https://registry.yarnpkg.com/@next/env/-/env-14.2.1.tgz#18b4fb5fd76bdda65369ad4ea5f33199ae708d2f" integrity sha512-qsHJle3GU3CmVx7pUoXcghX4sRN+vINkbLdH611T8ZlsP//grzqVW87BSUgOZeSAD4q7ZdZicdwNe/20U2janA== -"@next/eslint-plugin-next@14.1.4": - version "14.1.4" - resolved "https://registry.yarnpkg.com/@next/eslint-plugin-next/-/eslint-plugin-next-14.1.4.tgz#d7372b5ffede0e466af8af2ff534386418827fc8" - integrity sha512-n4zYNLSyCo0Ln5b7qxqQeQ34OZKXwgbdcx6kmkQbywr+0k6M3Vinft0T72R6CDAcDrne2IAgSud4uWCzFgc5HA== +"@next/eslint-plugin-next@14.2.1": + version "14.2.1" + resolved "https://registry.yarnpkg.com/@next/eslint-plugin-next/-/eslint-plugin-next-14.2.1.tgz#909952d05dd22bb3f6db2a308ac148be2d05c775" + integrity sha512-Fp+mthEBjkn8r9qd6o4JgxKp0IDEzW0VYHD8ZC05xS5/lFNwHKuOdr2kVhWG7BQCO9L6eeepshM1Wbs2T+LgSg== dependencies: glob "10.3.10" @@ -845,37 +845,37 @@ dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/parser@^5.4.2 || ^6.0.0": - version "6.21.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.21.0.tgz#af8fcf66feee2edc86bc5d1cf45e33b0630bf35b" - integrity sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ== +"@typescript-eslint/parser@^5.4.2 || ^6.0.0 || 7.0.0 - 7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-7.2.0.tgz#44356312aea8852a3a82deebdacd52ba614ec07a" + integrity sha512-5FKsVcHTk6TafQKQbuIVkXq58Fnbkd2wDL4LB7AURN7RUOu1utVP+G8+6u3ZhEroW3DF6hyo3ZEXxgKgp4KeCg== dependencies: - "@typescript-eslint/scope-manager" "6.21.0" - "@typescript-eslint/types" "6.21.0" - "@typescript-eslint/typescript-estree" "6.21.0" - "@typescript-eslint/visitor-keys" "6.21.0" + "@typescript-eslint/scope-manager" "7.2.0" + "@typescript-eslint/types" "7.2.0" + "@typescript-eslint/typescript-estree" "7.2.0" + "@typescript-eslint/visitor-keys" "7.2.0" debug "^4.3.4" -"@typescript-eslint/scope-manager@6.21.0": - version "6.21.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz#ea8a9bfc8f1504a6ac5d59a6df308d3a0630a2b1" - integrity sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg== +"@typescript-eslint/scope-manager@7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-7.2.0.tgz#cfb437b09a84f95a0930a76b066e89e35d94e3da" + integrity sha512-Qh976RbQM/fYtjx9hs4XkayYujB/aPwglw2choHmf3zBjB4qOywWSdt9+KLRdHubGcoSwBnXUH2sR3hkyaERRg== dependencies: - "@typescript-eslint/types" "6.21.0" - "@typescript-eslint/visitor-keys" "6.21.0" + "@typescript-eslint/types" "7.2.0" + "@typescript-eslint/visitor-keys" "7.2.0" -"@typescript-eslint/types@6.21.0": - version "6.21.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.21.0.tgz#205724c5123a8fef7ecd195075fa6e85bac3436d" - integrity sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg== +"@typescript-eslint/types@7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.2.0.tgz#0feb685f16de320e8520f13cca30779c8b7c403f" + integrity sha512-XFtUHPI/abFhm4cbCDc5Ykc8npOKBSJePY3a3s+lwumt7XWJuzP5cZcfZ610MIPHjQjNsOLlYK8ASPaNG8UiyA== -"@typescript-eslint/typescript-estree@6.21.0": - version "6.21.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz#c47ae7901db3b8bddc3ecd73daff2d0895688c46" - integrity sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ== +"@typescript-eslint/typescript-estree@7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-7.2.0.tgz#5beda2876c4137f8440c5a84b4f0370828682556" + integrity sha512-cyxS5WQQCoBwSakpMrvMXuMDEbhOo9bNHHrNcEWis6XHx6KF518tkF1wBvKIn/tpq5ZpUYK7Bdklu8qY0MsFIA== dependencies: - "@typescript-eslint/types" "6.21.0" - "@typescript-eslint/visitor-keys" "6.21.0" + "@typescript-eslint/types" "7.2.0" + "@typescript-eslint/visitor-keys" "7.2.0" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" @@ -883,12 +883,12 @@ semver "^7.5.4" ts-api-utils "^1.0.1" -"@typescript-eslint/visitor-keys@6.21.0": - version "6.21.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz#87a99d077aa507e20e238b11d56cc26ade45fe47" - integrity sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A== +"@typescript-eslint/visitor-keys@7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-7.2.0.tgz#5035f177752538a5750cca1af6044b633610bf9e" + integrity sha512-c6EIQRHhcpl6+tO8EMR+kjkkV+ugUNXOmeASA1rlzkd8EPIriavpWoiEz1HR/VLhbVIdhqnV6E7JZm00cBDx2A== dependencies: - "@typescript-eslint/types" "6.21.0" + "@typescript-eslint/types" "7.2.0" eslint-visitor-keys "^3.4.1" "@ungap/structured-clone@^1.2.0": @@ -1794,14 +1794,14 @@ escape-string-regexp@^4.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== -eslint-config-next@14.1.4: - version "14.1.4" - resolved "https://registry.yarnpkg.com/eslint-config-next/-/eslint-config-next-14.1.4.tgz#22f2ba4c0993e991249d863656a64c204bae542c" - integrity sha512-cihIahbhYAWwXJwZkAaRPpUi5t9aOi/HdfWXOjZeUOqNWXHD8X22kd1KG58Dc3MVaRx3HoR/oMGk2ltcrqDn8g== +eslint-config-next@14.2.1: + version "14.2.1" + resolved "https://registry.yarnpkg.com/eslint-config-next/-/eslint-config-next-14.2.1.tgz#b19b53ca3d10379a98bc9bf497dbea651dfcd070" + integrity sha512-BgD0kPCWMlqoItRf3xe9fG0MqwObKfVch+f2ccwDpZiCJA8ghkz2wrASH+bI6nLZzGcOJOpMm1v1Q1euhfpt4Q== dependencies: - "@next/eslint-plugin-next" "14.1.4" + "@next/eslint-plugin-next" "14.2.1" "@rushstack/eslint-patch" "^1.3.3" - "@typescript-eslint/parser" "^5.4.2 || ^6.0.0" + "@typescript-eslint/parser" "^5.4.2 || ^6.0.0 || 7.0.0 - 7.2.0" eslint-import-resolver-node "^0.3.6" eslint-import-resolver-typescript "^3.5.2" eslint-plugin-import "^2.28.1" From 9dffc474ebd0089bb0a6f7a4bed0b22776524828 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 13:12:31 -0400 Subject: [PATCH 11/16] Chore(deps): Bump react-native-reanimated from 3.6.3 to 3.8.1 in /frontend/sac-mobile (#537) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Garrett Ladley <92384606+garrettladley@users.noreply.github.com> --- frontend/sac-mobile/package.json | 2 +- frontend/sac-mobile/yarn.lock | 104 +++++++++++++------------------ 2 files changed, 46 insertions(+), 60 deletions(-) diff --git a/frontend/sac-mobile/package.json b/frontend/sac-mobile/package.json index c83154565..2589d68b6 100644 --- a/frontend/sac-mobile/package.json +++ b/frontend/sac-mobile/package.json @@ -50,7 +50,7 @@ "react-native-loading-spinner-overlay": "^3.0.1", "react-native-maps": "1.14.0", "react-native-open-maps": "^0.4.3", - "react-native-reanimated": "~3.6.2", + "react-native-reanimated": "~3.8.1", "react-native-safe-area-context": "4.9.0", "react-native-screens": "~3.30.1", "react-native-svg": "^15.1.0", diff --git a/frontend/sac-mobile/yarn.lock b/frontend/sac-mobile/yarn.lock index da13023e4..b5eb04181 100644 --- a/frontend/sac-mobile/yarn.lock +++ b/frontend/sac-mobile/yarn.lock @@ -645,12 +645,12 @@ "@babel/helper-create-regexp-features-plugin" "^7.18.6" "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-arrow-functions@^7.0.0", "@babel/plugin-transform-arrow-functions@^7.23.3": - version "7.23.3" - resolved "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.23.3.tgz" - integrity sha512-NzQcQrzaQPkaEwoTm4Mhyl8jI1huEL/WWIEvudjTCMJ9aBZNpsJbMASx7EQECtQQPS/DcnFpo0FIh3LvEO9cxQ== +"@babel/plugin-transform-arrow-functions@^7.0.0", "@babel/plugin-transform-arrow-functions@^7.0.0-0", "@babel/plugin-transform-arrow-functions@^7.23.3": + version "7.24.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.24.1.tgz#2bf263617060c9cc45bcdbf492b8cc805082bf27" + integrity sha512-ngT/3NkRhsaep9ck9uj2Xhv9+xB1zShY3tM3g6om4xxCELwCDN4g4Aq5dRn48+0hasAql7s2hdBOysCfNpr4fw== dependencies: - "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-plugin-utils" "^7.24.0" "@babel/plugin-transform-async-generator-functions@^7.23.9": version "7.23.9" @@ -884,12 +884,12 @@ dependencies: "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-nullish-coalescing-operator@^7.23.4": - version "7.23.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.23.4.tgz#45556aad123fc6e52189ea749e33ce090637346e" - integrity sha512-jHE9EVVqHKAQx+VePv5LLGHjmHSJR76vawFPTdlxR/LVJPfOEGxREQwQfjuZEOPTwG92X3LINSh3M40Rv4zpVA== +"@babel/plugin-transform-nullish-coalescing-operator@^7.0.0-0", "@babel/plugin-transform-nullish-coalescing-operator@^7.23.4": + version "7.24.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.24.1.tgz#0cd494bb97cb07d428bd651632cb9d4140513988" + integrity sha512-iQ+caew8wRrhCikO5DrUYx0mrmdhkaELgFa+7baMcVuhxIkN7oxt06CZ51D65ugIb1UWRQ8oQe+HXAVM6qHFjw== dependencies: - "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-plugin-utils" "^7.24.0" "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" "@babel/plugin-transform-numeric-separator@^7.23.4": @@ -900,13 +900,6 @@ "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-numeric-separator" "^7.10.4" -"@babel/plugin-transform-object-assign@^7.16.7": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-assign/-/plugin-transform-object-assign-7.24.1.tgz#46a70169e56970aafd13a6ae677d5b497fc227e7" - integrity sha512-I1kctor9iKtupb7jv7FyjApHCuKLBKCblVAeHVK9PB6FW7GI0ac6RtobC3MwwJy8CZ1JxuhQmnbrsqI5G8hAIg== - dependencies: - "@babel/helper-plugin-utils" "^7.24.0" - "@babel/plugin-transform-object-rest-spread@^7.12.13": version "7.23.4" resolved "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.23.4.tgz" @@ -945,12 +938,12 @@ "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" -"@babel/plugin-transform-optional-chaining@^7.23.3", "@babel/plugin-transform-optional-chaining@^7.23.4": - version "7.23.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.23.4.tgz#6acf61203bdfc4de9d4e52e64490aeb3e52bd017" - integrity sha512-ZU8y5zWOfjM5vZ+asjgAPwDaBjJzgufjES89Rs4Lpq63O300R/kOz30WCLo6BxxX6QVEilwSlpClnG5cZaikTA== +"@babel/plugin-transform-optional-chaining@^7.0.0-0", "@babel/plugin-transform-optional-chaining@^7.23.3", "@babel/plugin-transform-optional-chaining@^7.23.4": + version "7.24.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.24.1.tgz#26e588acbedce1ab3519ac40cc748e380c5291e6" + integrity sha512-n03wmDt+987qXwAgcBlnUUivrZBPZ8z1plL0YvgQalLm+ZE5BMhGm94jhxXtA1wzv1Cu2aaOv1BM9vbVttrzSg== dependencies: - "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-plugin-utils" "^7.24.0" "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" "@babel/plugin-syntax-optional-chaining" "^7.8.3" @@ -1060,12 +1053,12 @@ babel-plugin-polyfill-regenerator "^0.5.5" semver "^6.3.1" -"@babel/plugin-transform-shorthand-properties@^7.0.0", "@babel/plugin-transform-shorthand-properties@^7.23.3": - version "7.23.3" - resolved "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.23.3.tgz" - integrity sha512-ED2fgqZLmexWiN+YNFX26fx4gh5qHDhn1O2gvEhreLW2iI63Sqm4llRLCXALKrCnbN4Jy0VcMQZl/SAzqug/jg== +"@babel/plugin-transform-shorthand-properties@^7.0.0", "@babel/plugin-transform-shorthand-properties@^7.0.0-0", "@babel/plugin-transform-shorthand-properties@^7.23.3": + version "7.24.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.24.1.tgz#ba9a09144cf55d35ec6b93a32253becad8ee5b55" + integrity sha512-LyjVB1nsJ6gTTUKRjRWx9C1s9hE7dLfP/knKdrfeH9UPtAGjYGgxIbFfx7xyLIEWs7Xe1Gnf8EWiUqfjLhInZA== dependencies: - "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-plugin-utils" "^7.24.0" "@babel/plugin-transform-spread@^7.0.0", "@babel/plugin-transform-spread@^7.23.3": version "7.23.3" @@ -1082,12 +1075,12 @@ dependencies: "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-template-literals@^7.0.0", "@babel/plugin-transform-template-literals@^7.23.3": - version "7.23.3" - resolved "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.23.3.tgz" - integrity sha512-Flok06AYNp7GV2oJPZZcP9vZdszev6vPBkHLwxwSpaIqx75wn6mUd3UFWsSsA0l8nXAKkyCmL/sR02m8RYGeHg== +"@babel/plugin-transform-template-literals@^7.0.0", "@babel/plugin-transform-template-literals@^7.0.0-0", "@babel/plugin-transform-template-literals@^7.23.3": + version "7.24.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.24.1.tgz#15e2166873a30d8617e3e2ccadb86643d327aab7" + integrity sha512-WRkhROsNzriarqECASCNu/nojeXCDTE/F2HmRgOzi7NGvyfYGq1NEjKBK3ckLfRgGc6/lPAqP0vDOSw3YtG34g== dependencies: - "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-plugin-utils" "^7.24.0" "@babel/plugin-transform-typeof-symbol@^7.23.3": version "7.23.3" @@ -1096,16 +1089,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-typescript@^7.23.3", "@babel/plugin-transform-typescript@^7.5.0": - version "7.23.6" - resolved "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.23.6.tgz" - integrity sha512-6cBG5mBvUu4VUD04OHKnYzbuHNP8huDsD3EDqqpIpsswTDoqHCjLoHb6+QgsV1WsT2nipRqCPgxD3LXnEO7XfA== - dependencies: - "@babel/helper-annotate-as-pure" "^7.22.5" - "@babel/helper-create-class-features-plugin" "^7.23.6" - "@babel/helper-plugin-utils" "^7.22.5" - "@babel/plugin-syntax-typescript" "^7.23.3" - "@babel/plugin-transform-typescript@^7.24.1": version "7.24.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.24.4.tgz#03e0492537a4b953e491f53f2bc88245574ebd15" @@ -1116,6 +1099,16 @@ "@babel/helper-plugin-utils" "^7.24.0" "@babel/plugin-syntax-typescript" "^7.24.1" +"@babel/plugin-transform-typescript@^7.5.0": + version "7.23.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.23.6.tgz" + integrity sha512-6cBG5mBvUu4VUD04OHKnYzbuHNP8huDsD3EDqqpIpsswTDoqHCjLoHb6+QgsV1WsT2nipRqCPgxD3LXnEO7XfA== + dependencies: + "@babel/helper-annotate-as-pure" "^7.22.5" + "@babel/helper-create-class-features-plugin" "^7.23.6" + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/plugin-syntax-typescript" "^7.23.3" + "@babel/plugin-transform-unicode-escapes@^7.23.3": version "7.23.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.23.3.tgz#1f66d16cab01fab98d784867d24f70c1ca65b925" @@ -1263,18 +1256,7 @@ "@babel/plugin-transform-react-jsx-development" "^7.22.5" "@babel/plugin-transform-react-pure-annotations" "^7.23.3" -"@babel/preset-typescript@^7.13.0": - version "7.23.3" - resolved "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.23.3.tgz" - integrity sha512-17oIGVlqz6CchO9RFYn5U6ZpWRZIngayYCtrPRSgANSwC2V1Jb+iP74nVxzzXJte8b8BYxrL1yY96xfhTBrNNQ== - dependencies: - "@babel/helper-plugin-utils" "^7.22.5" - "@babel/helper-validator-option" "^7.22.15" - "@babel/plugin-syntax-jsx" "^7.23.3" - "@babel/plugin-transform-modules-commonjs" "^7.23.3" - "@babel/plugin-transform-typescript" "^7.23.3" - -"@babel/preset-typescript@^7.16.7": +"@babel/preset-typescript@^7.13.0", "@babel/preset-typescript@^7.16.7": version "7.24.1" resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.24.1.tgz#89bdf13a3149a17b3b2a2c9c62547f06db8845ec" integrity sha512-1DBaMmRDpuYQBPWD8Pf/WEwCrtgRHxsZnP4mIy9G/X+hFfbI47Q2G4t1Paakld84+qsk2fSsUPMKg71jkoOOaQ== @@ -8661,12 +8643,16 @@ react-native-open-maps@^0.4.3: dependencies: query-string "^7.1.0" -react-native-reanimated@~3.6.2: - version "3.6.3" - resolved "https://registry.yarnpkg.com/react-native-reanimated/-/react-native-reanimated-3.6.3.tgz#859cf2320e37c80e3a21e19db24f82c34d6d3ded" - integrity sha512-2KkkPozoIvDbJcHuf8qeyoLROXQxizSi+2CTCkuNVkVZOxxY4B0Omvgq61aOQhSZUh/649x1YHoAaTyGMGDJUw== +react-native-reanimated@~3.8.1: + version "3.8.1" + resolved "https://registry.yarnpkg.com/react-native-reanimated/-/react-native-reanimated-3.8.1.tgz#45c13d4bedebef8df3d5a8756f25072de65960d7" + integrity sha512-EdM0vr3JEaNtqvstqESaPfOBy0gjYBkr1iEolWJ82Ax7io8y9OVUIphgsLKTB36CtR1XtmBw0RZVj7KArc7ZVA== dependencies: - "@babel/plugin-transform-object-assign" "^7.16.7" + "@babel/plugin-transform-arrow-functions" "^7.0.0-0" + "@babel/plugin-transform-nullish-coalescing-operator" "^7.0.0-0" + "@babel/plugin-transform-optional-chaining" "^7.0.0-0" + "@babel/plugin-transform-shorthand-properties" "^7.0.0-0" + "@babel/plugin-transform-template-literals" "^7.0.0-0" "@babel/preset-typescript" "^7.16.7" convert-source-map "^2.0.0" invariant "^2.2.4" From a911f1f839ac3d12f4883fe2554133cd21598ca1 Mon Sep 17 00:00:00 2001 From: Garrett Ladley <92384606+garrettladley@users.noreply.github.com> Date: Mon, 15 Apr 2024 13:58:06 -0400 Subject: [PATCH 12/16] fix: cli config fails (#542) --- backend/src/main.go | 2 -- cli/commands/clean_tests.go | 10 ++++++++-- cli/commands/config.go | 3 +-- cli/commands/drop.go | 15 +++++++++++++-- cli/commands/insert.go | 8 +++++++- 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/backend/src/main.go b/backend/src/main.go index 490404ff7..3a06ad1c3 100644 --- a/backend/src/main.go +++ b/backend/src/main.go @@ -58,8 +58,6 @@ func main() { configPath := flag.String("config", filepath.Join("..", "..", "config"), "Specify the path to the config directory") useDevDotEnv := flag.Bool("use-dev-dot-env", true, "Specify if you want to use the .env.dev file") - fmt.Println("foo", *useDevDotEnv) - flag.Parse() config, err := config.GetConfiguration(*configPath, *useDevDotEnv) diff --git a/cli/commands/clean_tests.go b/cli/commands/clean_tests.go index a3923ce53..edc7955bd 100644 --- a/cli/commands/clean_tests.go +++ b/cli/commands/clean_tests.go @@ -7,6 +7,7 @@ import ( "os/user" "sync" + "github.com/GenerateNU/sac/backend/src/config" _ "github.com/lib/pq" "github.com/urfave/cli/v2" ) @@ -32,7 +33,12 @@ func ClearDBCommand() *cli.Command { func CleanTestDBs(ctx context.Context) error { fmt.Println("Cleaning test databases") - db, err := sql.Open("postgres", CONFIG.Database.WithDb()) + config, err := config.GetConfiguration(CONFIG, false) + if err != nil { + return err + } + + db, err := sql.Open("postgres", config.Database.WithDb()) if err != nil { return err } @@ -45,7 +51,7 @@ func CleanTestDBs(ctx context.Context) error { } query := "SELECT datname FROM pg_database WHERE datistemplate = false AND datname != 'postgres' AND datname != $1 AND datname != $2 AND datname LIKE 'sac_test_%';" - rows, err := db.Query(query, currentUser.Username, CONFIG.Database.DatabaseName) + rows, err := db.Query(query, currentUser.Username, config.Database.DatabaseName) if err != nil { return err } diff --git a/cli/commands/config.go b/cli/commands/config.go index e33a7f4ab..b7bb45e1a 100644 --- a/cli/commands/config.go +++ b/cli/commands/config.go @@ -3,7 +3,6 @@ package commands import ( "path/filepath" - "github.com/GenerateNU/sac/backend/src/config" "github.com/GenerateNU/sac/cli/utils" ) @@ -12,6 +11,6 @@ var ( FRONTEND_DIR = filepath.Join(ROOT_DIR, "/frontend") BACKEND_DIR = filepath.Join(ROOT_DIR, "/backend") BACKEND_SRC_DIR = filepath.Join(BACKEND_DIR, "/src") - CONFIG, _ = config.GetConfiguration(filepath.Join(ROOT_DIR, "/config"), false) + CONFIG = filepath.Join(ROOT_DIR, "/config") MIGRATION_FILE = filepath.Join(BACKEND_SRC_DIR, "/migrations/data.sql") ) diff --git a/cli/commands/drop.go b/cli/commands/drop.go index 3a34f1ae1..37d90980e 100644 --- a/cli/commands/drop.go +++ b/cli/commands/drop.go @@ -5,6 +5,7 @@ import ( "fmt" "sync" + "github.com/GenerateNU/sac/backend/src/config" "github.com/urfave/cli/v2" ) @@ -52,7 +53,12 @@ func DropData() error { dbMutex.Lock() defer dbMutex.Unlock() - db, err := sql.Open("postgres", CONFIG.Database.WithDb()) + config, err := config.GetConfiguration(CONFIG, false) + if err != nil { + return err + } + + db, err := sql.Open("postgres", config.Database.WithDb()) if err != nil { return err } @@ -95,7 +101,12 @@ func DropDB() error { dbMutex.Lock() defer dbMutex.Unlock() - db, err := sql.Open("postgres", CONFIG.Database.WithDb()) + config, err := config.GetConfiguration(CONFIG, false) + if err != nil { + return err + } + + db, err := sql.Open("postgres", config.Database.WithDb()) if err != nil { return err } diff --git a/cli/commands/insert.go b/cli/commands/insert.go index afbf4dec8..b3d40eb1c 100644 --- a/cli/commands/insert.go +++ b/cli/commands/insert.go @@ -6,6 +6,7 @@ import ( "os" "os/exec" + "github.com/GenerateNU/sac/backend/src/config" "github.com/lib/pq" "github.com/urfave/cli/v2" ) @@ -34,7 +35,12 @@ func InsertCommand() *cli.Command { } func InsertDB() error { - db, err := sql.Open("postgres", CONFIG.Database.WithDb()) + config, err := config.GetConfiguration(CONFIG, false) + if err != nil { + return err + } + + db, err := sql.Open("postgres", config.Database.WithDb()) if err != nil { return err } From 109c5ae67ffc5129f51a19eeffde6f4cc60957e4 Mon Sep 17 00:00:00 2001 From: Garrett Ladley <92384606+garrettladley@users.noreply.github.com> Date: Mon, 15 Apr 2024 14:00:35 -0400 Subject: [PATCH 13/16] chore: rename cli (#545) --- .gitignore | 2 +- CONTRIBUTING.md | 2 +- cli/main.go | 2 +- cli/utils/path.go | 12 ++++++------ install.ps1 | 14 +++++++------- install.sh | 8 ++++---- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index 2142bdd9d..48a772f28 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ .DS_Store # Cli -sac-cli +sac # VSCode .vscode diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f935c8414..c5bbfbdd0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -131,7 +131,7 @@ ### SAC CLI - To install use `./install.sh` and then run `sac-cli` to see all commands. + To install use `./install.sh` and then run `sac` to see all commands. # Git Flow diff --git a/cli/main.go b/cli/main.go index 880a7598a..a81e5667b 100755 --- a/cli/main.go +++ b/cli/main.go @@ -10,7 +10,7 @@ import ( func main() { app := &cli.App{ - Name: "sac-cli", + Name: "sac", Usage: "CLI for the GenerateNU SAC", Commands: []*cli.Command{ commands.SwaggerCommand(), diff --git a/cli/utils/path.go b/cli/utils/path.go index 01b9a6a1a..7ff98bf94 100644 --- a/cli/utils/path.go +++ b/cli/utils/path.go @@ -13,7 +13,7 @@ func GetRootDir() (string, error) { return "", err } - // Find the closest directory containing "sac-cli" (the root directory) + // Find the closest directory containing "sac" (the root directory) rootDir, err := FindRootDir(currentDir) if err != nil { return "", err @@ -23,19 +23,19 @@ func GetRootDir() (string, error) { } func FindRootDir(dir string) (string, error) { - // Check if "sac-cli" exists in the current directory - mainGoPath := filepath.Join(dir, "sac-cli") + // Check if "sac" exists in the current directory + mainGoPath := filepath.Join(dir, "sac") _, err := os.Stat(mainGoPath) if err == nil { - // "sac-cli" found, this is the root directory + // "sac" found, this is the root directory return dir, nil } // If not found, go up one level parentDir := filepath.Dir(dir) if parentDir == dir { - // Reached the top without finding "sac-cli" - return "", fmt.Errorf("could not find root directory containing sac-cli") + // Reached the top without finding "sac" + return "", fmt.Errorf("could not find root directory containing sac") } // Recursively search in the parent directory diff --git a/install.ps1 b/install.ps1 index d7a8051eb..153e91c17 100644 --- a/install.ps1 +++ b/install.ps1 @@ -2,19 +2,19 @@ $ScriptPath = (Get-Item -Path $MyInvocation.MyCommand.Path).DirectoryName # Build the Go CLI tool -go build -o "sac-cli" "cli/main.go" +go build -o "sac" "cli/main.go" -# Check if sac-cli is already installed -if (Test-Path -Path "$Env:USERPROFILE\AppData\Local\Programs\sac-cli\sac-cli.exe") { +# Check if sac is already installed +if (Test-Path -Path "$Env:USERPROFILE\AppData\Local\Programs\sac\sac.exe") { exit 1 } -# Copy the sac-cli executable to a directory in the user's PATH -$InstallPath = "$Env:USERPROFILE\AppData\Local\Programs\sac-cli" +# Copy the sac executable to a directory in the user's PATH +$InstallPath = "$Env:USERPROFILE\AppData\Local\Programs\sac" if (-not (Test-Path -Path $InstallPath)) { New-Item -ItemType Directory -Path $InstallPath | Out-Null } -Copy-Item -Path "sac-cli" -Destination "$InstallPath\sac-cli.exe" -Force +Copy-Item -Path "sac" -Destination "$InstallPath\sac.exe" -Force # Add the installation path to the user's PATH $PathEnvVar = [System.Environment]::GetEnvironmentVariable("PATH", [System.EnvironmentVariableTarget]::User) @@ -23,4 +23,4 @@ if (-not ($PathEnvVar -like "*$InstallPath*")) { } # Inform the user -Write-Host "Installation complete. You can now run 'sac-cli' from anywhere." +Write-Host "Installation complete. You can now run 'sac' from anywhere." diff --git a/install.sh b/install.sh index 383916404..f797ee6a9 100755 --- a/install.sh +++ b/install.sh @@ -7,19 +7,19 @@ set -o pipefail SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # Build the Go CLI tool -go build -o "sac-cli" "cli/main.go" +go build -o "sac" "cli/main.go" # Identify the user's shell SHELL_NAME=$(basename "$SHELL") # Check if the command is already installed to avoid adding it to path multiple times -COMMAND_NAME="sac-cli" +COMMAND_NAME="sac" if command -v "$COMMAND_NAME" >/dev/null 2>&1; then exit 1 fi -# Add sac-cli to the user's PATH +# Add sac to the user's PATH if [[ $SHELL_NAME == "zsh" ]]; then echo "export PATH=\"$SCRIPT_PATH:\$PATH\"" >>~/.zshrc source ~/.zshrc @@ -32,4 +32,4 @@ else fi # Inform the user -echo "Installation complete. You can now run 'sac-cli' from anywhere." +echo "Installation complete. You can now run 'sac' from anywhere." From 7211d51c06d4c38be9697aac7149ed1fb0931ed5 Mon Sep 17 00:00:00 2001 From: Garrett Ladley <92384606+garrettladley@users.noreply.github.com> Date: Mon, 15 Apr 2024 16:19:56 -0400 Subject: [PATCH 14/16] feat: support for majors | model struct tag optimizations/cleanup | testing sync (#547) --- backend/src/database/super.go | 1 + backend/src/file/file.go | 1 - backend/src/models/category.go | 2 +- backend/src/models/club.go | 14 +-- backend/src/models/comment.go | 14 +-- backend/src/models/contact.go | 6 +- backend/src/models/event.go | 44 +++++----- backend/src/models/file.go | 10 +-- backend/src/models/follower.go | 4 +- backend/src/models/membership.go | 6 +- backend/src/models/notification.go | 14 +-- backend/src/models/poc.go | 8 +- backend/src/models/root.go | 6 +- backend/src/models/tag.go | 4 +- backend/src/models/user.go | 135 ++++++++++++++++++++++++++--- backend/src/models/verification.go | 4 +- backend/src/services/event.go | 1 + backend/src/utilities/validator.go | 11 +++ backend/tests/api/club_test.go | 2 - backend/tests/api/event_test.go | 83 +++++++++++------- backend/tests/api/helpers/auth.go | 5 ++ backend/tests/api/user_test.go | 20 ++++- 22 files changed, 280 insertions(+), 115 deletions(-) diff --git a/backend/src/database/super.go b/backend/src/database/super.go index 9d357ba24..7cc9c2b8d 100644 --- a/backend/src/database/super.go +++ b/backend/src/database/super.go @@ -22,6 +22,7 @@ func SuperUser(superUserSettings config.SuperUserSettings) (*models.User, *error PasswordHash: *passwordHash, FirstName: "SAC", LastName: "Super", + Major0: models.ComputerScience, College: models.KCCS, GraduationCycle: models.May, GraduationYear: 2025, diff --git a/backend/src/file/file.go b/backend/src/file/file.go index 9314ffce5..9e292dbe1 100644 --- a/backend/src/file/file.go +++ b/backend/src/file/file.go @@ -128,7 +128,6 @@ func (aw *AWSClient) UploadFile(folder string, fileHeader *multipart.FileHeader, Body: bytes.NewReader(file), }) if s3Err != nil { - fmt.Printf("Failed to upload data to %s/%s, %v\n", bucket, key, err) return nil, &errors.FailedToUploadFile } diff --git a/backend/src/models/category.go b/backend/src/models/category.go index 6f9770557..a6d757d10 100644 --- a/backend/src/models/category.go +++ b/backend/src/models/category.go @@ -3,7 +3,7 @@ package models type Category struct { Model - Name string `gorm:"type:varchar(255);unique" json:"name" validate:"required,max=255"` + Name string `gorm:"type:varchar(255);unique;not null" json:"name" validate:"required,max=255"` Tag []Tag `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` } diff --git a/backend/src/models/club.go b/backend/src/models/club.go index 23c931720..2e4b31918 100644 --- a/backend/src/models/club.go +++ b/backend/src/models/club.go @@ -30,13 +30,13 @@ type Club struct { SoftDeletedAt gorm.DeletedAt `gorm:"type:timestamptz;default:NULL" json:"-" validate:"-"` - Name string `gorm:"type:varchar(255)" json:"name" validate:"required,max=255"` - Preview string `gorm:"type:varchar(255)" json:"preview" validate:"required,max=255"` - Description string `gorm:"type:text" json:"description" validate:"required,http_url,s3_url,max=255"` // S3 URL - NumMembers int `gorm:"type:int" json:"num_members" validate:"required,min=1"` - IsRecruiting bool `gorm:"type:bool;default:false" json:"is_recruiting" validate:"required"` - RecruitmentCycle RecruitmentCycle `gorm:"type:varchar(255);default:always" json:"recruitment_cycle" validate:"required,max=255,oneof=fall spring fallSpring always"` - RecruitmentType RecruitmentType `gorm:"type:varchar(255);default:unrestricted" json:"recruitment_type" validate:"required,max=255,oneof=unrestricted tryout application"` + Name string `gorm:"type:varchar(255);not null" json:"name" validate:"required,max=255"` + Preview string `gorm:"type:varchar(255);not null" json:"preview" validate:"required,max=255"` + Description string `gorm:"type:text;not null" json:"description" validate:"required,http_url,s3_url,max=255"` // S3 URL + NumMembers int `gorm:"type:int;not null" json:"num_members" validate:"required,min=1"` + IsRecruiting bool `gorm:"type:bool;default:false;not null" json:"is_recruiting" validate:"required"` + RecruitmentCycle RecruitmentCycle `gorm:"type:varchar(255);default:always;not null" json:"recruitment_cycle" validate:"required,max=255,oneof=fall spring fallSpring always"` + RecruitmentType RecruitmentType `gorm:"type:varchar(255);default:unrestricted;not null" json:"recruitment_type" validate:"required,max=255,oneof=unrestricted tryout application"` ApplicationLink string `gorm:"type:varchar(255);default:NULL" json:"application_link" validate:"required,max=255,http_url"` Logo string `gorm:"type:varchar(255);default:NULL" json:"logo" validate:"omitempty,http_url,s3_url,max=255"` // S3 URL diff --git a/backend/src/models/comment.go b/backend/src/models/comment.go index 9e2bb9eb1..30448d0fd 100644 --- a/backend/src/models/comment.go +++ b/backend/src/models/comment.go @@ -5,15 +5,15 @@ import "github.com/google/uuid" type Comment struct { Model - Question string `gorm:"type:varchar(255)" json:"question" validate:"required,max=255"` - Answer string `gorm:"type:varchar(255)" json:"answer" validate:",max=255"` - NumFoundHelpful uint `gorm:"type:int;default:0" json:"num_found_helpful" validate:"min=0"` + Question string `gorm:"type:varchar(255);not null" json:"question" validate:"required,max=255"` + Answer string `gorm:"type:varchar(255);not null" json:"answer" validate:",max=255"` + NumFoundHelpful uint `gorm:"type:int;default:0;not null" json:"num_found_helpful" validate:"min=0"` - AskedByID uuid.UUID `gorm:"type:uuid" json:"-" validate:"uuid4"` - AskedBy User `gorm:"foreignKey:AskedByID" json:"-" validate:"-"` + AskedByID uuid.UUID `gorm:"type:uuid;not null" json:"-" validate:"uuid4"` + AskedBy User `gorm:"foreignKey:AskedByID;not null" json:"-" validate:"-"` - ClubID uuid.UUID `gorm:"type:uuid" json:"-" validate:"uuid4"` - Club Club `gorm:"foreignKey:ClubID" json:"-" validate:"-"` + ClubID uuid.UUID `gorm:"type:uuid;not null" json:"-" validate:"uuid4"` + Club Club `gorm:"foreignKey:ClubID;not null" json:"-" validate:"-"` AnsweredByID *uuid.UUID `gorm:"type:uuid" json:"-" validate:"uuid4"` AnsweredBy *User `gorm:"foreignKey:AnsweredBy" json:"-" validate:"-"` diff --git a/backend/src/models/contact.go b/backend/src/models/contact.go index 25993f43c..dc5280332 100644 --- a/backend/src/models/contact.go +++ b/backend/src/models/contact.go @@ -43,10 +43,10 @@ func GetContentPrefix(contactType ContactType) string { type Contact struct { Model - Type ContactType `gorm:"type:varchar(255);uniqueIndex:idx_contact_type" json:"type" validate:"required,max=255,oneof=facebook instagram x linkedin youtube github slack discord email customSite"` - Content string `gorm:"type:varchar(255)" json:"content" validate:"required,max=255"` + Type ContactType `gorm:"type:varchar(255);uniqueIndex:idx_contact_type;not null" json:"type" validate:"required,max=255,oneof=facebook instagram x linkedin youtube github slack discord email customSite"` + Content string `gorm:"type:varchar(255);not null" json:"content" validate:"required,max=255"` - ClubID uuid.UUID `gorm:"foreignKey:ClubID;uniqueIndex:idx_contact_type" json:"-" validate:"uuid4"` + ClubID uuid.UUID `gorm:"foreignKey:ClubID;uniqueIndex:idx_contact_type;not null" json:"-" validate:"uuid4"` } type PutContactRequestBody struct { diff --git a/backend/src/models/event.go b/backend/src/models/event.go index a5cf04cd7..3ec9c3db9 100644 --- a/backend/src/models/event.go +++ b/backend/src/models/event.go @@ -24,16 +24,16 @@ const ( type Event struct { Model - Name string `gorm:"type:varchar(255)" json:"name" validate:"required,max=255"` - Preview string `gorm:"type:varchar(255)" json:"preview" validate:"required,max=255"` - Content string `gorm:"type:varchar(255)" json:"content" validate:"required,max=255"` - StartTime time.Time `gorm:"type:timestamptz" json:"start_time" validate:"required,ltecsfield=EndTime"` - EndTime time.Time `gorm:"type:timestamptz" json:"end_time" validate:"required,gtecsfield=StartTime"` - Location string `gorm:"type:varchar(255)" json:"location" validate:"required,max=255"` - EventType EventType `gorm:"type:varchar(255);default:open" json:"event_type" validate:"required,max=255,oneof=open membersOnly"` - IsRecurring bool `gorm:"not null;type:bool;default:false" json:"is_recurring" validate:"-"` - - Host *uuid.UUID `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"uuid4"` + Name string `gorm:"type:varchar(255);not null" json:"name" validate:"required,max=255"` + Preview string `gorm:"type:varchar(255);not null" json:"preview" validate:"required,max=255"` + Content string `gorm:"type:varchar(255);not null" json:"content" validate:"required,max=255"` + StartTime time.Time `gorm:"type:timestamptz;not null" json:"start_time" validate:"required,ltecsfield=EndTime"` + EndTime time.Time `gorm:"type:timestamptz;not null" json:"end_time" validate:"required,gtecsfield=StartTime"` + Location string `gorm:"type:varchar(255);not null" json:"location" validate:"required,max=255"` + EventType EventType `gorm:"type:varchar(255);default:open;not null" json:"event_type" validate:"required,max=255,oneof=open membersOnly"` + IsRecurring bool `gorm:"type:bool;default:false;not null" json:"is_recurring" validate:"-"` + + Host *uuid.UUID `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;not null;" json:"-" validate:"uuid4"` RSVP []User `gorm:"many2many:user_event_rsvps;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` Waitlist []User `gorm:"many2many:user_event_waitlists;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` Clubs []Club `gorm:"many2many:club_events;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` @@ -43,28 +43,27 @@ type Event struct { type Series struct { Model - RecurringType RecurringType `gorm:"type:varchar(255);default:open" json:"recurring_type" validate:"max=255"` - MaxOccurrences int `gorm:"type:int" json:"max_occurrences" validate:"min=1"` + RecurringType RecurringType `gorm:"type:varchar(255);default:open;not null" json:"recurring_type" validate:"max=255"` + MaxOccurrences int `gorm:"type:int;not null" json:"max_occurrences" validate:"min=1"` Events []Event `gorm:"many2many:event_series;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"events" validate:"-"` } -// TODO: add not null to required fields on all gorm models type EventSeries struct { - EventID uuid.UUID `gorm:"not null; type:uuid;" json:"event_id" validate:"uuid4"` + EventID uuid.UUID `gorm:"type:uuid;not null" json:"event_id" validate:"uuid4"` Event Event `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` - SeriesID uuid.UUID `gorm:"not null; type:uuid;" json:"series_id" validate:"uuid4"` + SeriesID uuid.UUID `gorm:"type:uuid;not null" json:"series_id" validate:"uuid4"` Series Series `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` } // Not needed for now, we will just update the events separately type EventInstanceException struct { Model - EventID int `gorm:"not null; type:uuid" json:"event_id" validate:"required"` + EventID int `gorm:"type:uuid;not null" json:"event_id" validate:"required"` Event Event - IsRescheduled bool `gorm:"type:bool;default:true" json:"is_rescheduled" validate:"required"` - IsCancelled bool `gorm:"type:bool;default:false" json:"is_cancelled" validate:"required"` - StartTime time.Time `gorm:"type:timestamptz" json:"start_time" validate:"required,datetime,ltecsfield=EndTime"` - EndTime time.Time `gorm:"type:timestamptz" json:"end_time" validate:"required,datetime,gtecsfield=StartTime"` + IsRescheduled bool `gorm:"type:bool;default:true;not null" json:"is_rescheduled" validate:"required"` + IsCancelled bool `gorm:"type:bool;default:false;not null" json:"is_cancelled" validate:"required"` + StartTime time.Time `gorm:"type:timestamptz;not null" json:"start_time" validate:"required,datetime,ltecsfield=EndTime"` + EndTime time.Time `gorm:"type:timestamptz;not null" json:"end_time" validate:"required,datetime,gtecsfield=StartTime"` } // TODO We will likely need to update the create and update structs to account for recurring series @@ -79,7 +78,7 @@ type CreateEventRequestBody struct { IsRecurring *bool `json:"is_recurring" validate:"required"` // TODO club/tag/notification logic - Host *uuid.UUID `json:"host" validate:"omitempty"` + Host *uuid.UUID `json:"host" validate:"required,uuid4"` Clubs []Club `json:"-" validate:"omitempty"` Tag []Tag `json:"-" validate:"omitempty"` Notification []Notification `json:"-" validate:"omitempty"` @@ -100,8 +99,9 @@ type UpdateEventRequestBody struct { StartTime time.Time `json:"start_time" validate:"omitempty,ltecsfield=EndTime"` EndTime time.Time `json:"end_time" validate:"omitempty,gtecsfield=StartTime"` Location string `json:"location" validate:"omitempty,max=255"` - EventType EventType `gorm:"type:varchar(255);default:open" json:"event_type" validate:"omitempty,max=255,oneof=open membersOnly"` + EventType EventType `json:"event_type" validate:"omitempty,max=255,oneof=open membersOnly"` + Host *uuid.UUID `json:"host" validate:"omitempty"` RSVP []User `json:"-" validate:"omitempty"` Waitlist []User `json:"-" validate:"omitempty"` Clubs []Club `json:"-" validate:"omitempty"` diff --git a/backend/src/models/file.go b/backend/src/models/file.go index c64c95fc5..b33a5c68e 100644 --- a/backend/src/models/file.go +++ b/backend/src/models/file.go @@ -18,11 +18,11 @@ type File struct { OwnerID uuid.UUID `gorm:"uniqueIndex:compositeindex;index;not null;type:uuid" json:"-" validate:"required,uuid4"` OwnerType string `gorm:"uniqueIndex:compositeindex;index;not null;type:varchar(255)" json:"-" validate:"required,max=255"` - FileName string `gorm:"type:varchar(255)" json:"file_name" validate:"required,max=255"` - FileType string `gorm:"type:varchar(255)" json:"file_type" validate:"required,max=255"` - FileSize int `gorm:"type:int" json:"file_size" validate:"required,min=1"` - FileURL string `gorm:"type:varchar(255)" json:"file_url" validate:"required,max=255"` - ObjectKey string `gorm:"type:varchar(255)" json:"object_key" validate:"required,max=255"` + FileName string `gorm:"type:varchar(255);not null" json:"file_name" validate:"required,max=255"` + FileType string `gorm:"type:varchar(255);not null" json:"file_type" validate:"required,max=255"` + FileSize int `gorm:"type:int;not null" json:"file_size" validate:"required,min=1"` + FileURL string `gorm:"type:varchar(255);not null" json:"file_url" validate:"required,max=255"` + ObjectKey string `gorm:"type:varchar(255);not null" json:"object_key" validate:"required,max=255"` } type CreateFileRequestBody struct { diff --git a/backend/src/models/follower.go b/backend/src/models/follower.go index 2fe61d680..8002aeb6d 100644 --- a/backend/src/models/follower.go +++ b/backend/src/models/follower.go @@ -9,8 +9,8 @@ func (Follower) TableName() string { } type Follower struct { - UserID uuid.UUID `gorm:"type:uuid;not null;primaryKey" json:"user_id" validate:"required,uuid4"` - ClubID uuid.UUID `gorm:"type:uuid;not null;primaryKey" json:"club_id" validate:"required,uuid4"` + UserID uuid.UUID `gorm:"type:uuid;primaryKey;not null" json:"user_id" validate:"required,uuid4"` + ClubID uuid.UUID `gorm:"type:uuid;primaryKey;not null" json:"club_id" validate:"required,uuid4"` Club *Club `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` User *User `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` diff --git a/backend/src/models/membership.go b/backend/src/models/membership.go index f225acf72..ec28b2304 100644 --- a/backend/src/models/membership.go +++ b/backend/src/models/membership.go @@ -16,11 +16,11 @@ func (Membership) TableName() string { } type Membership struct { - UserID uuid.UUID `gorm:"type:uuid;not null;primaryKey" json:"user_id" validate:"required,uuid4"` - ClubID uuid.UUID `gorm:"type:uuid;not null;primaryKey" json:"club_id" validate:"required,uuid4"` + UserID uuid.UUID `gorm:"type:uuid;primaryKey;not null" json:"user_id" validate:"required,uuid4"` + ClubID uuid.UUID `gorm:"type:uuid;primaryKey;not null" json:"club_id" validate:"required,uuid4"` Club *Club `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` User *User `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` - MembershipType MembershipType `gorm:"type:varchar(255);not null;default:member" json:"membership_type" validate:"required,oneof=member admin"` + MembershipType MembershipType `gorm:"type:varchar(255);default:member;not null" json:"membership_type" validate:"required,oneof=member admin"` } diff --git a/backend/src/models/notification.go b/backend/src/models/notification.go index fd07e4580..87d84a4ec 100644 --- a/backend/src/models/notification.go +++ b/backend/src/models/notification.go @@ -16,12 +16,12 @@ const ( type Notification struct { Model - SendAt time.Time `gorm:"type:timestamptz" json:"send_at" validate:"required"` - Title string `gorm:"type:varchar(255)" json:"title" validate:"required,max=255"` - Content string `gorm:"type:varchar(255)" json:"content" validate:"required,max=255"` - DeepLink string `gorm:"type:varchar(255)" json:"deep_link" validate:"required,max=255"` - Icon string `gorm:"type:varchar(255)" json:"icon" validate:"required,http_url,max=255"` // S3 URL + SendAt time.Time `gorm:"type:timestamptz;not null" json:"send_at" validate:"required"` + Title string `gorm:"type:varchar(255);not null" json:"title" validate:"required,max=255"` + Content string `gorm:"type:varchar(255);not null" json:"content" validate:"required,max=255"` + DeepLink string `gorm:"type:varchar(255);not null" json:"deep_link" validate:"required,max=255"` + Icon string `gorm:"type:varchar(255);not null" json:"icon" validate:"required,s3_url,http_url,max=255"` // S3 URL - ReferenceID uuid.UUID `gorm:"type:int" json:"-" validate:"uuid4"` - ReferenceType NotificationType `gorm:"type:varchar(255)" json:"-" validate:"max=255"` + ReferenceID uuid.UUID `gorm:"type:int;not null" json:"-" validate:"uuid4"` + ReferenceType NotificationType `gorm:"type:varchar(255);not null" json:"-" validate:"max=255"` } diff --git a/backend/src/models/poc.go b/backend/src/models/poc.go index c2d424f1a..bfbf0a9c9 100644 --- a/backend/src/models/poc.go +++ b/backend/src/models/poc.go @@ -7,13 +7,13 @@ import ( type PointOfContact struct { Model - Name string `gorm:"type:varchar(255)" json:"name" validate:"required,max=255"` + Name string `gorm:"type:varchar(255);not null" json:"name" validate:"required,max=255"` Email string `gorm:"uniqueIndex:compositeindex;index;not null;type:varchar(255)" json:"email" validate:"required,email,max=255"` - Position string `gorm:"type:varchar(255);" json:"position" validate:"required,max=255"` + Position string `gorm:"type:varchar(255);not null" json:"position" validate:"required,max=255"` - ClubID uuid.UUID `gorm:"uniqueIndex:compositeindex;index;not null;foreignKey:ClubID" json:"-" validate:"min=1"` + ClubID uuid.UUID `gorm:"uniqueIndex:compositeindex;index;foreignKey:ClubID;not null" json:"-" validate:"required,uuid4"` - PhotoFile File `gorm:"polymorphic:Owner;" json:"photo_file"` + PhotoFile File `gorm:"polymorphic:Owner;not null" json:"photo_file"` } type CreatePointOfContactBody struct { diff --git a/backend/src/models/root.go b/backend/src/models/root.go index cf9a23f5e..b1f29154c 100644 --- a/backend/src/models/root.go +++ b/backend/src/models/root.go @@ -11,7 +11,7 @@ type Tabler interface { } type Model struct { - ID uuid.UUID `gorm:"type:uuid;primaryKey;default:uuid_generate_v4()" json:"id" example:"123e4567-e89b-12d3-a456-426614174000"` - CreatedAt time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"created_at" example:"2023-09-20T16:34:50Z"` - UpdatedAt time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"updated_at" example:"2023-09-20T16:34:50Z"` + ID uuid.UUID `gorm:"type:uuid;primaryKey;default:uuid_generate_v4();not null" json:"id" example:"123e4567-e89b-12d3-a456-426614174000"` + CreatedAt time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP;not null" json:"created_at" example:"2023-09-20T16:34:50Z"` + UpdatedAt time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP;not null" json:"updated_at" example:"2023-09-20T16:34:50Z"` } diff --git a/backend/src/models/tag.go b/backend/src/models/tag.go index 560e74d1b..42a2fea7b 100644 --- a/backend/src/models/tag.go +++ b/backend/src/models/tag.go @@ -5,9 +5,9 @@ import "github.com/google/uuid" type Tag struct { Model - Name string `gorm:"type:varchar(255)" json:"name" validate:"required,max=255"` + Name string `gorm:"type:varchar(255);not null" json:"name" validate:"required,max=255"` - CategoryID uuid.UUID `json:"category_id" validate:"required,uuid4"` + CategoryID uuid.UUID `gorm:"type:uuid;not null" json:"category_id" validate:"required,uuid4"` User []User `gorm:"many2many:user_tags;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` Club []Club `gorm:"many2many:club_tags;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` diff --git a/backend/src/models/user.go b/backend/src/models/user.go index a4b5d3632..aedfd98b7 100644 --- a/backend/src/models/user.go +++ b/backend/src/models/user.go @@ -26,6 +26,112 @@ const ( CSSH College = "CSSH" // College of Social Sciences and Humanities ) +type Major string + +// see https://admissions.northeastern.edu/academics/areas-of-study/ +const ( + AfricanaStudies Major = "africanaStudies" + AmericanSignLanguage Major = "americanSignLanguage" + AmericanSignLanguageEnglishInterpreting Major = "americanSignLanguage-EnglishInterpreting" + AppliedPhysics Major = "appliedPhysics" + ArchitecturalStudies Major = "architecturalStudies" + Architecture Major = "architecture" + ArtArtVisualStudies Major = "art:ArtVisualStudies" + BehavioralNeuroscience Major = "behavioralNeuroscience" + Biochemistry Major = "biochemistry" + Bioengineering Major = "bioengineering" + Biology Major = "biology" + BiomedicalPhysics Major = "biomedicalPhysics" + BusinessAdministration Major = "businessAdministration" + BusinessAdministrationAccounting Major = "businessAdministration:Accounting" + BusinessAdministrationAccountingAndAdvisoryServices Major = "businessAdministration:AccountingAndAdvisoryServices" + BusinessAdministrationBrandManagement Major = "businessAdministration:BrandManagement" + BusinessAdministrationBusinessAnalytics Major = "businessAdministration:BusinessAnalytics" + BusinessAdministrationCorporateInnovation Major = "businessAdministration:CorporateInnovation" + BusinessAdministrationEntrepreneurialStartups Major = "businessAdministration:EntrepreneurialStartups" + BusinessAdministrationFamilyBusiness Major = "businessAdministration:FamilyBusiness" + BusinessAdministrationFinance Major = "businessAdministration:Finance" + BusinessAdministrationFintech Major = "businessAdministration:Fintech" + BusinessAdministrationHealthcareManagementAndConsulting Major = "businessAdministration:HealthcareManagementAndConsulting" + BusinessAdministrationManagement Major = "businessAdministration:Management" + BusinessAdministrationManagementInformationSystems Major = "businessAdministration:ManagementInformationSystems" + BusinessAdministrationMarketing Major = "businessAdministration:Marketing" + BusinessAdministrationMarketingAnalytics Major = "businessAdministration:MarketingAnalytics" + BusinessAdministrationSocialInnovationAndEntrepreneurship Major = "businessAdministration:SocialInnovationAndEntrepreneurship" + BusinessAdministrationSupplyChainManagement Major = "businessAdministration:SupplyChainManagement" + CellAndMolecularBiology Major = "cellAndMolecularBiology" + ChemicalEngineering Major = "chemicalEngineering" + Chemistry Major = "chemistry" + CivilEngineering Major = "civilEngineering" + CommunicationStudies Major = "communicationStudies" + ComputerEngineering Major = "computerEngineering" + ComputerScience Major = "computerScience" + ComputingAndLaw Major = "computingAndLaw" + CriminologyAndCriminalJustice Major = "criminologyAndCriminalJustice" + CulturalAnthropology Major = "culturalAnthropology" + Cybersecurity Major = "cybersecurity" + DataScience Major = "dataScience" + Design Major = "design" + Economics Major = "economics" + ElectricalEngineering Major = "electricalEngineering" + English Major = "english" + EnvironmentalAndSustainabilityStudies Major = "environmentalAndSustainabilityStudies" + EnvironmentalEngineering Major = "environmentalEngineering" + EnvironmentalScience Major = "environmentalScience" + EnvironmentalStudies Major = "environmentalStudies" + GameArtAndAnimation Major = "gameArtAndAnimation" + GameDesign Major = "gameDesign" + GlobalAsianStudies Major = "globalAsianStudies" + HealthScience Major = "healthScience" + History Major = "history" + HistoryCultureAndLaw Major = "historyCultureAndLaw" + HumanServices Major = "humanServices" + IndustrialEngineering Major = "industrialEngineering" + InternationalAffairs Major = "internationalAffairs" + InternationalBusiness Major = "internationalBusiness" + InternationalBusinessAccounting Major = "internationalBusiness:Accounting" + InternationalBusinessAccountingAndAdvisoryServices Major = "internationalBusiness:AccountingAndAdvisoryServices" + InternationalBusinessBrandManagement Major = "internationalBusiness:BrandManagement" + InternationalBusinessBusinessAnalytics Major = "internationalBusiness:BusinessAnalytics" + InternationalBusinessCorporateInnovation Major = "internationalBusiness:CorporateInnovation" + InternationalBusinessEntrepreneurialStartups Major = "internationalBusiness:EntrepreneurialStartups" + InternationalBusinessFamilyBusiness Major = "internationalBusiness:FamilyBusiness" + InternationalBusinessFinance Major = "internationalBusiness:Finance" + InternationalBusinessFintech Major = "internationalBusiness:Fintech" + InternationalBusinessHealthcareManagementAndConsulting Major = "internationalBusiness:HealthcareManagementAndConsulting" + InternationalBusinessManagement Major = "internationalBusiness:Management" + InternationalBusinessManagementInformationSystems Major = "internationalBusiness:ManagementInformationSystems" + InternationalBusinessMarketing Major = "internationalBusiness:Marketing" + InternationalBusinessMarketingAnalytics Major = "internationalBusiness:MarketingAnalytics" + InternationalBusinessSocialInnovationAndEntrepreneurship Major = "internationalBusiness:SocialInnovationAndEntrepreneurship" + InternationalBusinessSupplyChainManagement Major = "internationalBusiness:SupplyChainManagement" + Journalism Major = "journalism" + LandscapeArchitecture Major = "landscapeArchitecture" + Linguistics Major = "linguistics" + MarineBiology Major = "marineBiology" + Mathematics Major = "mathematics" + MechanicalEngineering Major = "mechanicalEngineering" + MediaAndScreenStudies Major = "mediaAndScreenStudies" + MediaArts Major = "mediaArts" + Music Major = "music" + MusicTechnology Major = "musicTechnology" + Nursing Major = "nursing" + PharmaceuticalSciences Major = "pharmaceuticalSciences" + PharmacyPharmD Major = "pharmacy(PharmD)" + Philosophy Major = "philosophy" + Physics Major = "physics" + PoliticalScience Major = "politicalScience" + PoliticsPhilosophyEconomics Major = "politicsPhilosophyEconomics" + Psychology Major = "psychology" + PublicHealth Major = "publicHealth" + PublicRelations Major = "publicRelations" + ReligiousStudies Major = "religiousStudies" + Sociology Major = "sociology" + Spanish Major = "spanish" + SpeechLanguagePathologyAndAudiology Major = "speechLanguagePathologyAndAudiology" + Theatre Major = "theatre" +) + type GraduationCycle string const ( @@ -41,15 +147,18 @@ type Tokens struct { type User struct { Model - Role UserRole `gorm:"type:varchar(255);default:'student'" json:"role" validate:"required,oneof=super student"` - FirstName string `gorm:"type:varchar(255)" json:"first_name" validate:"required,max=255"` - LastName string `gorm:"type:varchar(255)" json:"last_name" validate:"required,max=255"` - Email string `gorm:"type:varchar(255);unique" json:"email" validate:"required,email,max=255"` - PasswordHash string `gorm:"type:varchar(97)" json:"-" validate:"required,len=97"` - College College `gorm:"type:varchar(255)" json:"college" validate:"required,max=255"` - GraduationCycle GraduationCycle `gorm:"type:varchar(255)" json:"graduation_cycle" validate:"required,max=255,oneof=december may"` - GraduationYear int16 `gorm:"type:smallint" json:"graduation_year" validate:"required"` - IsVerified bool `gorm:"type:boolean;default:false" json:"is_verified"` + Role UserRole `gorm:"type:varchar(255);default:'student';not null" json:"role" validate:"required,oneof=super student"` + FirstName string `gorm:"type:varchar(255);not null" json:"first_name" validate:"required,max=255"` + LastName string `gorm:"type:varchar(255);not null" json:"last_name" validate:"required,max=255"` + Email string `gorm:"type:varchar(255);unique;not null" json:"email" validate:"required,email,max=255"` + PasswordHash string `gorm:"type:varchar(97);not null" json:"-" validate:"required,len=97"` + Major0 Major `gorm:"type:varchar(255)" json:"major0" validate:"not_equal_if_not_empty=Major1,not_equal_if_not_empty=Major2,required,max=255,oneof=africanaStudies americanSignLanguage americanSignLanguage-EnglishInterpreting appliedPhysics architecturalStudies architecture art:ArtVisualStudies behavioralNeuroscience biochemistry bioengineering biology biomedicalPhysics businessAdministration businessAdministration:Accounting businessAdministration:AccountingAndAdvisoryServices businessAdministration:BrandManagement businessAdministration:BusinessAnalytics businessAdministration:CorporateInnovation businessAdministration:EntrepreneurialStartups businessAdministration:FamilyBusiness businessAdministration:Finance businessAdministration:Fintech businessAdministration:HealthcareManagementAndConsulting businessAdministration:Management businessAdministration:ManagementInformationSystems businessAdministration:Marketing businessAdministration:MarketingAnalytics businessAdministration:SocialInnovationAndEntrepreneurship businessAdministration:SupplyChainManagement cellAndMolecularBiology chemicalEngineering chemistry civilEngineering communicationStudies computerEngineering computerScience computingAndLaw criminologyAndCriminalJustice culturalAnthropology cybersecurity dataScience design economics electricalEngineering english environmentalAndSustainabilityStudies environmentalEngineering environmentalScience environmentalStudies gameArtAndAnimation gameDesign globalAsianStudies healthScience history historyCultureAndLaw humanServices industrialEngineering internationalAffairs internationalBusiness internationalBusiness:Accounting internationalBusiness:AccountingAndAdvisoryServices internationalBusiness:BrandManagement internationalBusiness:BusinessAnalytics internationalBusiness:CorporateInnovation internationalBusiness:EntrepreneurialStartups internationalBusiness:FamilyBusiness internationalBusiness:Finance internationalBusiness:Fintech internationalBusiness:HealthcareManagementAndConsulting internationalBusiness:Management internationalBusiness:ManagementInformationSystems internationalBusiness:Marketing internationalBusiness:MarketingAnalytics internationalBusiness:SocialInnovationAndEntrepreneurship internationalBusiness:SupplyChainManagement journalism landscapeArchitecture linguistics marineBiology mathematics mechanicalEngineering mediaAndScreenStudies mediaArts music musicTechnology nursing pharmaceuticalSciences pharmacy(PharmD) philosophy physics politicalScience politicsPhilosophyEconomics psychology publicHealth publicRelations religiousStudies sociology spanish speechLanguagePathologyAndAudiology theatre"` + Major1 Major `gorm:"type:varchar(255);" json:"major1" validate:"not_equal_if_not_empty=Major0,not_equal_if_not_empty=Major2,omitempty,max=255,oneof=africanaStudies americanSignLanguage americanSignLanguage-EnglishInterpreting appliedPhysics architecturalStudies architecture art:ArtVisualStudies behavioralNeuroscience biochemistry bioengineering biology biomedicalPhysics businessAdministration businessAdministration:Accounting businessAdministration:AccountingAndAdvisoryServices businessAdministration:BrandManagement businessAdministration:BusinessAnalytics businessAdministration:CorporateInnovation businessAdministration:EntrepreneurialStartups businessAdministration:FamilyBusiness businessAdministration:Finance businessAdministration:Fintech businessAdministration:HealthcareManagementAndConsulting businessAdministration:Management businessAdministration:ManagementInformationSystems businessAdministration:Marketing businessAdministration:MarketingAnalytics businessAdministration:SocialInnovationAndEntrepreneurship businessAdministration:SupplyChainManagement cellAndMolecularBiology chemicalEngineering chemistry civilEngineering communicationStudies computerEngineering computerScience computingAndLaw criminologyAndCriminalJustice culturalAnthropology cybersecurity dataScience design economics electricalEngineering english environmentalAndSustainabilityStudies environmentalEngineering environmentalScience environmentalStudies gameArtAndAnimation gameDesign globalAsianStudies healthScience history historyCultureAndLaw humanServices industrialEngineering internationalAffairs internationalBusiness internationalBusiness:Accounting internationalBusiness:AccountingAndAdvisoryServices internationalBusiness:BrandManagement internationalBusiness:BusinessAnalytics internationalBusiness:CorporateInnovation internationalBusiness:EntrepreneurialStartups internationalBusiness:FamilyBusiness internationalBusiness:Finance internationalBusiness:Fintech internationalBusiness:HealthcareManagementAndConsulting internationalBusiness:Management internationalBusiness:ManagementInformationSystems internationalBusiness:Marketing internationalBusiness:MarketingAnalytics internationalBusiness:SocialInnovationAndEntrepreneurship internationalBusiness:SupplyChainManagement journalism landscapeArchitecture linguistics marineBiology mathematics mechanicalEngineering mediaAndScreenStudies mediaArts music musicTechnology nursing pharmaceuticalSciences pharmacy(PharmD) philosophy physics politicalScience politicsPhilosophyEconomics psychology publicHealth publicRelations religiousStudies sociology spanish speechLanguagePathologyAndAudiology theatre"` + Major2 Major `gorm:"type:varchar(255);" json:"major2" validate:"not_equal_if_not_empty=Major0,not_equal_if_not_empty=Major1,omitempty,max=255,oneof=africanaStudies americanSignLanguage americanSignLanguage-EnglishInterpreting appliedPhysics architecturalStudies architecture art:ArtVisualStudies behavioralNeuroscience biochemistry bioengineering biology biomedicalPhysics businessAdministration businessAdministration:Accounting businessAdministration:AccountingAndAdvisoryServices businessAdministration:BrandManagement businessAdministration:BusinessAnalytics businessAdministration:CorporateInnovation businessAdministration:EntrepreneurialStartups businessAdministration:FamilyBusiness businessAdministration:Finance businessAdministration:Fintech businessAdministration:HealthcareManagementAndConsulting businessAdministration:Management businessAdministration:ManagementInformationSystems businessAdministration:Marketing businessAdministration:MarketingAnalytics businessAdministration:SocialInnovationAndEntrepreneurship businessAdministration:SupplyChainManagement cellAndMolecularBiology chemicalEngineering chemistry civilEngineering communicationStudies computerEngineering computerScience computingAndLaw criminologyAndCriminalJustice culturalAnthropology cybersecurity dataScience design economics electricalEngineering english environmentalAndSustainabilityStudies environmentalEngineering environmentalScience environmentalStudies gameArtAndAnimation gameDesign globalAsianStudies healthScience history historyCultureAndLaw humanServices industrialEngineering internationalAffairs internationalBusiness internationalBusiness:Accounting internationalBusiness:AccountingAndAdvisoryServices internationalBusiness:BrandManagement internationalBusiness:BusinessAnalytics internationalBusiness:CorporateInnovation internationalBusiness:EntrepreneurialStartups internationalBusiness:FamilyBusiness internationalBusiness:Finance internationalBusiness:Fintech internationalBusiness:HealthcareManagementAndConsulting internationalBusiness:Management internationalBusiness:ManagementInformationSystems internationalBusiness:Marketing internationalBusiness:MarketingAnalytics internationalBusiness:SocialInnovationAndEntrepreneurship internationalBusiness:SupplyChainManagement journalism landscapeArchitecture linguistics marineBiology mathematics mechanicalEngineering mediaAndScreenStudies mediaArts music musicTechnology nursing pharmaceuticalSciences pharmacy(PharmD) philosophy physics politicalScience politicsPhilosophyEconomics psychology publicHealth publicRelations religiousStudies sociology spanish speechLanguagePathologyAndAudiology theatre"` + College College `gorm:"type:varchar(255);" json:"college" validate:"required,max=255"` // TODO: gorm not null? + GraduationCycle GraduationCycle `gorm:"type:varchar(255);" json:"graduation_cycle" validate:"required,max=255,oneof=december may"` // TODO: gorm not null? + GraduationYear int16 `gorm:"type:smallint;" json:"graduation_year" validate:"required"` // TODO: gorm not null? + IsVerified bool `gorm:"type:boolean;default:false;not null" json:"is_verified"` Tag []Tag `gorm:"many2many:user_tags;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` Admin []Club `gorm:"many2many:user_club_admins;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"-" validate:"-"` @@ -68,6 +177,9 @@ type CreateUserRequestBody struct { Email string `json:"email" validate:"required,email,neu_email,max=255"` Password string `json:"password" validate:"required,password,min=8,max=255"` // Optional fields + Major0 Major `json:"major0" validate:"not_equal_if_not_empty=Major1,not_equal_if_not_empty=Major2,omitempty,max=255,oneof=africanaStudies americanSignLanguage americanSignLanguage-EnglishInterpreting appliedPhysics architecturalStudies architecture art:ArtVisualStudies behavioralNeuroscience biochemistry bioengineering biology biomedicalPhysics businessAdministration businessAdministration:Accounting businessAdministration:AccountingAndAdvisoryServices businessAdministration:BrandManagement businessAdministration:BusinessAnalytics businessAdministration:CorporateInnovation businessAdministration:EntrepreneurialStartups businessAdministration:FamilyBusiness businessAdministration:Finance businessAdministration:Fintech businessAdministration:HealthcareManagementAndConsulting businessAdministration:Management businessAdministration:ManagementInformationSystems businessAdministration:Marketing businessAdministration:MarketingAnalytics businessAdministration:SocialInnovationAndEntrepreneurship businessAdministration:SupplyChainManagement cellAndMolecularBiology chemicalEngineering chemistry civilEngineering communicationStudies computerEngineering computerScience computingAndLaw criminologyAndCriminalJustice culturalAnthropology cybersecurity dataScience design economics electricalEngineering english environmentalAndSustainabilityStudies environmentalEngineering environmentalScience environmentalStudies gameArtAndAnimation gameDesign globalAsianStudies healthScience history historyCultureAndLaw humanServices industrialEngineering internationalAffairs internationalBusiness internationalBusiness:Accounting internationalBusiness:AccountingAndAdvisoryServices internationalBusiness:BrandManagement internationalBusiness:BusinessAnalytics internationalBusiness:CorporateInnovation internationalBusiness:EntrepreneurialStartups internationalBusiness:FamilyBusiness internationalBusiness:Finance internationalBusiness:Fintech internationalBusiness:HealthcareManagementAndConsulting internationalBusiness:Management internationalBusiness:ManagementInformationSystems internationalBusiness:Marketing internationalBusiness:MarketingAnalytics internationalBusiness:SocialInnovationAndEntrepreneurship internationalBusiness:SupplyChainManagement journalism landscapeArchitecture linguistics marineBiology mathematics mechanicalEngineering mediaAndScreenStudies mediaArts music musicTechnology nursing pharmaceuticalSciences pharmacy(PharmD) philosophy physics politicalScience politicsPhilosophyEconomics psychology publicHealth publicRelations religiousStudies sociology spanish speechLanguagePathologyAndAudiology theatre"` + Major1 Major `json:"major1" validate:"not_equal_if_not_empty=Major0,not_equal_if_not_empty=Major2,omitempty,max=255,oneof=africanaStudies americanSignLanguage americanSignLanguage-EnglishInterpreting appliedPhysics architecturalStudies architecture art:ArtVisualStudies behavioralNeuroscience biochemistry bioengineering biology biomedicalPhysics businessAdministration businessAdministration:Accounting businessAdministration:AccountingAndAdvisoryServices businessAdministration:BrandManagement businessAdministration:BusinessAnalytics businessAdministration:CorporateInnovation businessAdministration:EntrepreneurialStartups businessAdministration:FamilyBusiness businessAdministration:Finance businessAdministration:Fintech businessAdministration:HealthcareManagementAndConsulting businessAdministration:Management businessAdministration:ManagementInformationSystems businessAdministration:Marketing businessAdministration:MarketingAnalytics businessAdministration:SocialInnovationAndEntrepreneurship businessAdministration:SupplyChainManagement cellAndMolecularBiology chemicalEngineering chemistry civilEngineering communicationStudies computerEngineering computerScience computingAndLaw criminologyAndCriminalJustice culturalAnthropology cybersecurity dataScience design economics electricalEngineering english environmentalAndSustainabilityStudies environmentalEngineering environmentalScience environmentalStudies gameArtAndAnimation gameDesign globalAsianStudies healthScience history historyCultureAndLaw humanServices industrialEngineering internationalAffairs internationalBusiness internationalBusiness:Accounting internationalBusiness:AccountingAndAdvisoryServices internationalBusiness:BrandManagement internationalBusiness:BusinessAnalytics internationalBusiness:CorporateInnovation internationalBusiness:EntrepreneurialStartups internationalBusiness:FamilyBusiness internationalBusiness:Finance internationalBusiness:Fintech internationalBusiness:HealthcareManagementAndConsulting internationalBusiness:Management internationalBusiness:ManagementInformationSystems internationalBusiness:Marketing internationalBusiness:MarketingAnalytics internationalBusiness:SocialInnovationAndEntrepreneurship internationalBusiness:SupplyChainManagement journalism landscapeArchitecture linguistics marineBiology mathematics mechanicalEngineering mediaAndScreenStudies mediaArts music musicTechnology nursing pharmaceuticalSciences pharmacy(PharmD) philosophy physics politicalScience politicsPhilosophyEconomics psychology publicHealth publicRelations religiousStudies sociology spanish speechLanguagePathologyAndAudiology theatre"` + Major2 Major `json:"major2" validate:"not_equal_if_not_empty=Major0,not_equal_if_not_empty=Major1,omitempty,max=255,oneof=africanaStudies americanSignLanguage americanSignLanguage-EnglishInterpreting appliedPhysics architecturalStudies architecture art:ArtVisualStudies behavioralNeuroscience biochemistry bioengineering biology biomedicalPhysics businessAdministration businessAdministration:Accounting businessAdministration:AccountingAndAdvisoryServices businessAdministration:BrandManagement businessAdministration:BusinessAnalytics businessAdministration:CorporateInnovation businessAdministration:EntrepreneurialStartups businessAdministration:FamilyBusiness businessAdministration:Finance businessAdministration:Fintech businessAdministration:HealthcareManagementAndConsulting businessAdministration:Management businessAdministration:ManagementInformationSystems businessAdministration:Marketing businessAdministration:MarketingAnalytics businessAdministration:SocialInnovationAndEntrepreneurship businessAdministration:SupplyChainManagement cellAndMolecularBiology chemicalEngineering chemistry civilEngineering communicationStudies computerEngineering computerScience computingAndLaw criminologyAndCriminalJustice culturalAnthropology cybersecurity dataScience design economics electricalEngineering english environmentalAndSustainabilityStudies environmentalEngineering environmentalScience environmentalStudies gameArtAndAnimation gameDesign globalAsianStudies healthScience history historyCultureAndLaw humanServices industrialEngineering internationalAffairs internationalBusiness internationalBusiness:Accounting internationalBusiness:AccountingAndAdvisoryServices internationalBusiness:BrandManagement internationalBusiness:BusinessAnalytics internationalBusiness:CorporateInnovation internationalBusiness:EntrepreneurialStartups internationalBusiness:FamilyBusiness internationalBusiness:Finance internationalBusiness:Fintech internationalBusiness:HealthcareManagementAndConsulting internationalBusiness:Management internationalBusiness:ManagementInformationSystems internationalBusiness:Marketing internationalBusiness:MarketingAnalytics internationalBusiness:SocialInnovationAndEntrepreneurship internationalBusiness:SupplyChainManagement journalism landscapeArchitecture linguistics marineBiology mathematics mechanicalEngineering mediaAndScreenStudies mediaArts music musicTechnology nursing pharmaceuticalSciences pharmacy(PharmD) philosophy physics politicalScience politicsPhilosophyEconomics psychology publicHealth publicRelations religiousStudies sociology spanish speechLanguagePathologyAndAudiology theatre"` College College `json:"college" validate:"omitempty,oneof=CAMD DMSB KCCS CE BCHS SL CPS CS CSSH"` GraduationCycle GraduationCycle `json:"graduation_cycle" validate:"omitempty,max=255,oneof=december may"` GraduationYear int16 `json:"graduation_year" validate:"omitempty"` @@ -76,6 +188,9 @@ type CreateUserRequestBody struct { type UpdateUserRequestBody struct { FirstName string `json:"first_name" validate:"omitempty,max=255"` LastName string `json:"last_name" validate:"omitempty,max=255"` + Major0 Major `json:"major0" validate:"not_equal_if_not_empty=Major1,not_equal_if_not_empty=Major2,omitempty,max=255,oneof=africanaStudies americanSignLanguage americanSignLanguage-EnglishInterpreting appliedPhysics architecturalStudies architecture art:ArtVisualStudies behavioralNeuroscience biochemistry bioengineering biology biomedicalPhysics businessAdministration businessAdministration:Accounting businessAdministration:AccountingAndAdvisoryServices businessAdministration:BrandManagement businessAdministration:BusinessAnalytics businessAdministration:CorporateInnovation businessAdministration:EntrepreneurialStartups businessAdministration:FamilyBusiness businessAdministration:Finance businessAdministration:Fintech businessAdministration:HealthcareManagementAndConsulting businessAdministration:Management businessAdministration:ManagementInformationSystems businessAdministration:Marketing businessAdministration:MarketingAnalytics businessAdministration:SocialInnovationAndEntrepreneurship businessAdministration:SupplyChainManagement cellAndMolecularBiology chemicalEngineering chemistry civilEngineering communicationStudies computerEngineering computerScience computingAndLaw criminologyAndCriminalJustice culturalAnthropology cybersecurity dataScience design economics electricalEngineering english environmentalAndSustainabilityStudies environmentalEngineering environmentalScience environmentalStudies gameArtAndAnimation gameDesign globalAsianStudies healthScience history historyCultureAndLaw humanServices industrialEngineering internationalAffairs internationalBusiness internationalBusiness:Accounting internationalBusiness:AccountingAndAdvisoryServices internationalBusiness:BrandManagement internationalBusiness:BusinessAnalytics internationalBusiness:CorporateInnovation internationalBusiness:EntrepreneurialStartups internationalBusiness:FamilyBusiness internationalBusiness:Finance internationalBusiness:Fintech internationalBusiness:HealthcareManagementAndConsulting internationalBusiness:Management internationalBusiness:ManagementInformationSystems internationalBusiness:Marketing internationalBusiness:MarketingAnalytics internationalBusiness:SocialInnovationAndEntrepreneurship internationalBusiness:SupplyChainManagement journalism landscapeArchitecture linguistics marineBiology mathematics mechanicalEngineering mediaAndScreenStudies mediaArts music musicTechnology nursing pharmaceuticalSciences pharmacy(PharmD) philosophy physics politicalScience politicsPhilosophyEconomics psychology publicHealth publicRelations religiousStudies sociology spanish speechLanguagePathologyAndAudiology theatre"` + Major1 Major `json:"major1" validate:"not_equal_if_not_empty=Major0,not_equal_if_not_empty=Major2,omitempty,max=255,oneof=africanaStudies americanSignLanguage americanSignLanguage-EnglishInterpreting appliedPhysics architecturalStudies architecture art:ArtVisualStudies behavioralNeuroscience biochemistry bioengineering biology biomedicalPhysics businessAdministration businessAdministration:Accounting businessAdministration:AccountingAndAdvisoryServices businessAdministration:BrandManagement businessAdministration:BusinessAnalytics businessAdministration:CorporateInnovation businessAdministration:EntrepreneurialStartups businessAdministration:FamilyBusiness businessAdministration:Finance businessAdministration:Fintech businessAdministration:HealthcareManagementAndConsulting businessAdministration:Management businessAdministration:ManagementInformationSystems businessAdministration:Marketing businessAdministration:MarketingAnalytics businessAdministration:SocialInnovationAndEntrepreneurship businessAdministration:SupplyChainManagement cellAndMolecularBiology chemicalEngineering chemistry civilEngineering communicationStudies computerEngineering computerScience computingAndLaw criminologyAndCriminalJustice culturalAnthropology cybersecurity dataScience design economics electricalEngineering english environmentalAndSustainabilityStudies environmentalEngineering environmentalScience environmentalStudies gameArtAndAnimation gameDesign globalAsianStudies healthScience history historyCultureAndLaw humanServices industrialEngineering internationalAffairs internationalBusiness internationalBusiness:Accounting internationalBusiness:AccountingAndAdvisoryServices internationalBusiness:BrandManagement internationalBusiness:BusinessAnalytics internationalBusiness:CorporateInnovation internationalBusiness:EntrepreneurialStartups internationalBusiness:FamilyBusiness internationalBusiness:Finance internationalBusiness:Fintech internationalBusiness:HealthcareManagementAndConsulting internationalBusiness:Management internationalBusiness:ManagementInformationSystems internationalBusiness:Marketing internationalBusiness:MarketingAnalytics internationalBusiness:SocialInnovationAndEntrepreneurship internationalBusiness:SupplyChainManagement journalism landscapeArchitecture linguistics marineBiology mathematics mechanicalEngineering mediaAndScreenStudies mediaArts music musicTechnology nursing pharmaceuticalSciences pharmacy(PharmD) philosophy physics politicalScience politicsPhilosophyEconomics psychology publicHealth publicRelations religiousStudies sociology spanish speechLanguagePathologyAndAudiology theatre"` + Major2 Major `json:"major2" validate:"not_equal_if_not_empty=Major0,not_equal_if_not_empty=Major1,omitempty,max=255,oneof=africanaStudies americanSignLanguage americanSignLanguage-EnglishInterpreting appliedPhysics architecturalStudies architecture art:ArtVisualStudies behavioralNeuroscience biochemistry bioengineering biology biomedicalPhysics businessAdministration businessAdministration:Accounting businessAdministration:AccountingAndAdvisoryServices businessAdministration:BrandManagement businessAdministration:BusinessAnalytics businessAdministration:CorporateInnovation businessAdministration:EntrepreneurialStartups businessAdministration:FamilyBusiness businessAdministration:Finance businessAdministration:Fintech businessAdministration:HealthcareManagementAndConsulting businessAdministration:Management businessAdministration:ManagementInformationSystems businessAdministration:Marketing businessAdministration:MarketingAnalytics businessAdministration:SocialInnovationAndEntrepreneurship businessAdministration:SupplyChainManagement cellAndMolecularBiology chemicalEngineering chemistry civilEngineering communicationStudies computerEngineering computerScience computingAndLaw criminologyAndCriminalJustice culturalAnthropology cybersecurity dataScience design economics electricalEngineering english environmentalAndSustainabilityStudies environmentalEngineering environmentalScience environmentalStudies gameArtAndAnimation gameDesign globalAsianStudies healthScience history historyCultureAndLaw humanServices industrialEngineering internationalAffairs internationalBusiness internationalBusiness:Accounting internationalBusiness:AccountingAndAdvisoryServices internationalBusiness:BrandManagement internationalBusiness:BusinessAnalytics internationalBusiness:CorporateInnovation internationalBusiness:EntrepreneurialStartups internationalBusiness:FamilyBusiness internationalBusiness:Finance internationalBusiness:Fintech internationalBusiness:HealthcareManagementAndConsulting internationalBusiness:Management internationalBusiness:ManagementInformationSystems internationalBusiness:Marketing internationalBusiness:MarketingAnalytics internationalBusiness:SocialInnovationAndEntrepreneurship internationalBusiness:SupplyChainManagement journalism landscapeArchitecture linguistics marineBiology mathematics mechanicalEngineering mediaAndScreenStudies mediaArts music musicTechnology nursing pharmaceuticalSciences pharmacy(PharmD) philosophy physics politicalScience politicsPhilosophyEconomics psychology publicHealth publicRelations religiousStudies sociology spanish speechLanguagePathologyAndAudiology theatre"` College College `json:"college" validate:"omitempty,oneof=CAMD DMSB KCCS CE BCHS SL CPS CS CSSH"` GraduationCycle GraduationCycle `json:"graduation_cycle" validate:"omitempty,max=255,oneof=december may"` GraduationYear int16 `json:"graduation_year" validate:"omitempty"` @@ -88,7 +203,7 @@ type LoginUserResponseBody struct { type UpdatePasswordRequestBody struct { OldPassword string `json:"old_password" validate:"required,password,min=8,max=255"` - NewPassword string `json:"new_password" validate:"required,password,nefield=OldPassword,min=8,max=255"` + NewPassword string `json:"new_password" validate:"required,password,not_equal_if_not_empty=OldPassword,min=8,max=255"` } type RefreshTokenRequestBody struct { diff --git a/backend/src/models/verification.go b/backend/src/models/verification.go index 434bb727e..db8fd37da 100644 --- a/backend/src/models/verification.go +++ b/backend/src/models/verification.go @@ -14,9 +14,9 @@ const ( ) type Verification struct { - UserID uuid.UUID `gorm:"type:varchar(36);not null;primaryKey" json:"user_id" validate:"required,uuid4"` + UserID uuid.UUID `gorm:"type:varchar(36);primaryKey;not null" json:"user_id" validate:"required,uuid4"` Token string `gorm:"type:varchar(255);unique" json:"token" validate:"required,max=255"` - ExpiresAt time.Time `gorm:"type:timestamp;not null;primaryKey" json:"expires_at" validate:"required"` + ExpiresAt time.Time `gorm:"type:timestamp;primaryKey;not null" json:"expires_at" validate:"required"` Type VerificationType `gorm:"type:varchar(255);not null" json:"type" validate:"required,oneof=email_verification password_reset"` } diff --git a/backend/src/services/event.go b/backend/src/services/event.go index 949eb6ffb..e544714b1 100644 --- a/backend/src/services/event.go +++ b/backend/src/services/event.go @@ -252,6 +252,7 @@ func mapToEvent(eventBody models.UpdateEventRequestBody) *models.Event { Location: eventBody.Location, EventType: eventBody.EventType, + Host: eventBody.Host, RSVP: eventBody.RSVP, Waitlist: eventBody.Waitlist, Clubs: eventBody.Clubs, diff --git a/backend/src/utilities/validator.go b/backend/src/utilities/validator.go index fe332be54..375335dec 100644 --- a/backend/src/utilities/validator.go +++ b/backend/src/utilities/validator.go @@ -36,6 +36,10 @@ func RegisterCustomValidators() (*validator.Validate, error) { return nil, err } + if err := validate.RegisterValidation("not_equal_if_not_empty", validateNotEqualIfNotEmpty); err != nil { + return nil, err + } + return validate, nil } @@ -97,6 +101,13 @@ func validateContactPointer(validate *validator.Validate, fl validator.FieldLeve return validate.Var(contact.Content, rule) == nil && strings.HasPrefix(contact.Content, models.GetContentPrefix(contact.Type)) } +func validateNotEqualIfNotEmpty(fl validator.FieldLevel) bool { + field := fl.Field().String() + otherField := fl.Parent().FieldByName(fl.Param()).String() + + return field == "" || field != otherField +} + func ValidateID(id string) (*uuid.UUID, *errors.Error) { idAsUUID, err := uuid.Parse(id) if err != nil { diff --git a/backend/tests/api/club_test.go b/backend/tests/api/club_test.go index e725eb1b3..e3b74f06b 100644 --- a/backend/tests/api/club_test.go +++ b/backend/tests/api/club_test.go @@ -42,8 +42,6 @@ func AssertClubBodyRespDB(eaa h.ExistingAppAssert, resp *http.Response, body *ma eaa.Assert.NilError(err) - eaa.Assert.Equal(2, len(dbClubs)) - dbClub := dbClubs[0] eaa.Assert.Equal(dbClub.ID, respClub.ID) diff --git a/backend/tests/api/event_test.go b/backend/tests/api/event_test.go index 37c629ed6..643140e5d 100644 --- a/backend/tests/api/event_test.go +++ b/backend/tests/api/event_test.go @@ -16,9 +16,9 @@ import ( "gorm.io/gorm" ) -type EventFactory func() *map[string]interface{} +type EventFactory func(hostID uuid.UUID) *map[string]interface{} -func SampleEventFactory() *map[string]interface{} { +func SampleEventFactory(hostID uuid.UUID) *map[string]interface{} { return &map[string]interface{}{ "name": "Generate", "preview": "Generate is Northeastern's premier student-led product development studio.", @@ -28,11 +28,13 @@ func SampleEventFactory() *map[string]interface{} { "location": "Carter Fields", "event_type": "open", "is_recurring": false, + "host": hostID, } } -func SampleSeriesFactory() *map[string]interface{} { +func SampleSeriesFactory(hostID uuid.UUID) *map[string]interface{} { return CustomSampleSeriesFactory( + hostID, models.CreateSeriesRequestBody{ RecurringType: "daily", MaxOccurrences: 10, @@ -40,7 +42,7 @@ func SampleSeriesFactory() *map[string]interface{} { ) } -func CustomSampleSeriesFactory(series models.CreateSeriesRequestBody) *map[string]interface{} { +func CustomSampleSeriesFactory(hostID uuid.UUID, series models.CreateSeriesRequestBody) *map[string]interface{} { return &map[string]interface{}{ "name": "Software Development", "preview": "CS4500 at northeastern", @@ -50,6 +52,7 @@ func CustomSampleSeriesFactory(series models.CreateSeriesRequestBody) *map[strin "location": "ISEC", "event_type": "membersOnly", "is_recurring": true, + "host": hostID, "series": series, } } @@ -138,25 +141,25 @@ func AssertEventBodyRespDB(eaa h.ExistingAppAssert, resp *http.Response, body *m return dbEvent.ID } -func AssertSampleEventBodyRespDB(eaa h.ExistingAppAssert, resp *http.Response) []uuid.UUID { - sampleEvent := SampleEventFactory() +func AssertSampleEventBodyRespDB(eaa h.ExistingAppAssert, hostID uuid.UUID, resp *http.Response) []uuid.UUID { + sampleEvent := SampleEventFactory(hostID) return AssertEventListBodyRespDB(eaa, resp, sampleEvent) } -func CreateSampleEvent(existingAppAssert h.ExistingAppAssert, factoryFunction EventFactory) (h.ExistingAppAssert, []uuid.UUID) { +func CreateSampleEvent(existingAppAssert h.ExistingAppAssert, hostID uuid.UUID, factoryFunction EventFactory) (h.ExistingAppAssert, []uuid.UUID) { var sampleEventUUIDs []uuid.UUID newAppAssert := existingAppAssert.TestOnStatusAndTester( h.TestRequest{ Method: fiber.MethodPost, Path: "/api/v1/events/", - Body: factoryFunction(), + Body: factoryFunction(hostID), Role: &models.Super, }, h.TesterWithStatus{ Status: fiber.StatusCreated, Tester: func(eaa h.ExistingAppAssert, resp *http.Response) { - sampleEventUUIDs = AssertSampleEventBodyRespDB(eaa, resp) + sampleEventUUIDs = AssertSampleEventBodyRespDB(eaa, hostID, resp) }, }, ) @@ -185,18 +188,20 @@ func AssertNumSeriesRemainsAtN(eaa h.ExistingAppAssert, resp *http.Response, n i } func TestCreateEventWorks(t *testing.T) { - existingAppAssert, _ := CreateSampleEvent(h.InitTest(t), SampleEventFactory) - existingAppAssert.Close() + eaa, _, clubID := CreateSampleClub(h.InitTest(t)) + eaa, _ = CreateSampleEvent(eaa, clubID, SampleEventFactory) + eaa.Close() } func TestCreateEventSeriesWorks(t *testing.T) { - existingAppAssert, _ := CreateSampleEvent(h.InitTest(t), SampleSeriesFactory) - existingAppAssert.Close() + eaa, _, clubID := CreateSampleClub(h.InitTest(t)) + eaa, _ = CreateSampleEvent(eaa, clubID, SampleSeriesFactory) + eaa.Close() } func TestGetEventWorks(t *testing.T) { - existingAppAssert, eventUUID := CreateSampleEvent(h.InitTest(t), SampleEventFactory) - + existingAppAssert, _, clubID := CreateSampleClub(h.InitTest(t)) + existingAppAssert, eventUUID := CreateSampleEvent(existingAppAssert, clubID, SampleEventFactory) existingAppAssert.TestOnStatusAndTester(h.TestRequest{ Method: fiber.MethodGet, Path: fmt.Sprintf("/api/v1/events/%s", eventUUID[0]), @@ -205,14 +210,15 @@ func TestGetEventWorks(t *testing.T) { h.TesterWithStatus{ Status: fiber.StatusOK, Tester: func(eaa h.ExistingAppAssert, resp *http.Response) { - AssertEventListBodyRespDB(eaa, resp, SampleEventFactory()) + AssertEventListBodyRespDB(eaa, resp, SampleEventFactory(clubID)) }, }, ).Close() } func TestGetEventsWorks(t *testing.T) { - existingAppAssert, _ := CreateSampleEvent(h.InitTest(t), SampleEventFactory) + existingAppAssert, _, clubID := CreateSampleClub(h.InitTest(t)) + existingAppAssert, _ = CreateSampleEvent(existingAppAssert, clubID, SampleEventFactory) existingAppAssert.TestOnStatusAndTester(h.TestRequest{ Method: fiber.MethodGet, @@ -235,7 +241,8 @@ func TestGetEventsWorks(t *testing.T) { } func TestGetSeriesByEventIDWorks(t *testing.T) { - existingAppAssert, eventUUIDs := CreateSampleEvent(h.InitTest(t), SampleSeriesFactory) + existingAppAssert, _, clubID := CreateSampleClub(h.InitTest(t)) + existingAppAssert, eventUUIDs := CreateSampleEvent(existingAppAssert, clubID, SampleSeriesFactory) existingAppAssert.TestOnStatusAndTester(h.TestRequest{ Method: fiber.MethodGet, @@ -254,9 +261,10 @@ func TestGetSeriesByEventIDWorks(t *testing.T) { func AssertCreateBadEventDataFails(t *testing.T, jsonKey string, badValues []interface{}, expectedErr errors.Error) { appAssert, _, _ := CreateSampleStudent(t, nil) + appAssert, _, clubID := CreateSampleClub(appAssert) for _, badValue := range badValues { - sampleEventPermutation := *SampleEventFactory() + sampleEventPermutation := *SampleEventFactory(clubID) sampleEventPermutation[jsonKey] = badValue appAssert.TestOnErrorAndTester( @@ -320,8 +328,9 @@ func TestCreateEventFailsOnInvalidEventType(t *testing.T) { func AssertCreateBadEventSeriesDataFails(t *testing.T, badSeries models.CreateSeriesRequestBody, expectedErr errors.Error) { appAssert, _, _ := CreateSampleStudent(t, nil) + appAssert, _, clubID := CreateSampleClub(appAssert) - sampleSeriesPermutation := CustomSampleSeriesFactory(badSeries) + sampleSeriesPermutation := CustomSampleSeriesFactory(clubID, badSeries) appAssert.TestOnErrorAndTester( h.TestRequest{ @@ -361,9 +370,10 @@ func TestCreateSeriesFailsOnInvalidMaxOccurrences(t *testing.T) { } func TestUpdateEventWorks(t *testing.T) { - appAssert, eventUUID := CreateSampleEvent(h.InitTest(t), SampleEventFactory) + appAssert, _, clubID := CreateSampleClub(h.InitTest(t)) + appAssert, eventUUID := CreateSampleEvent(appAssert, clubID, SampleEventFactory) - updatedEvent := SampleEventFactory() + updatedEvent := SampleEventFactory(clubID) (*updatedEvent)["name"] = "Updated Name" (*updatedEvent)["preview"] = "Updated Preview" @@ -384,7 +394,8 @@ func TestUpdateEventWorks(t *testing.T) { } func TestUpdateEventSeriesWorks(t *testing.T) { - appAssert, eventUUIDs := CreateSampleEvent(h.InitTest(t), SampleSeriesFactory) + appAssert, _, clubID := CreateSampleClub(h.InitTest(t)) + appAssert, eventUUIDs := CreateSampleEvent(appAssert, clubID, SampleSeriesFactory) updatedSeries := &map[string]interface{}{ "recurring_type": "daily", @@ -398,6 +409,7 @@ func TestUpdateEventSeriesWorks(t *testing.T) { "location": "Richards 224", "event_type": "open", "is_recurring": true, + "host": clubID, }, } @@ -418,9 +430,10 @@ func TestUpdateEventSeriesWorks(t *testing.T) { } func TestUpdateEventFailsOnInvalidBody(t *testing.T) { - appAssert, eventUUID := CreateSampleEvent(h.InitTest(t), SampleEventFactory) + appAssert, _, clubID := CreateSampleClub(h.InitTest(t)) + appAssert, eventUUID := CreateSampleEvent(appAssert, clubID, SampleEventFactory) - body := SampleEventFactory() + body := SampleEventFactory(clubID) for _, invalidData := range []map[string]interface{}{ {"start_time": "Not a datetime"}, @@ -466,7 +479,7 @@ func TestUpdateEventFailsOnInvalidBody(t *testing.T) { } func TestUpdateEventFailsBadRequest(t *testing.T) { - appAssert := h.InitTest(t) + appAssert, _, clubID := CreateSampleClub(h.InitTest(t)) badRequests := []string{ "0", @@ -481,7 +494,7 @@ func TestUpdateEventFailsBadRequest(t *testing.T) { h.TestRequest{ Method: fiber.MethodPatch, Path: fmt.Sprintf("/api/v1/events/%s", badRequest), - Body: SampleEventFactory(), + Body: SampleEventFactory(clubID), Role: &models.Super, }, errors.FailedToValidateID, @@ -492,12 +505,14 @@ func TestUpdateEventFailsBadRequest(t *testing.T) { } func TestUpdateEventFailsOnEventIdNotExist(t *testing.T) { + eaa, _, clubID := CreateSampleClub(h.InitTest(t)) + uuid := uuid.New() - h.InitTest(t).TestOnErrorAndTester(h.TestRequest{ + eaa.TestOnErrorAndTester(h.TestRequest{ Method: fiber.MethodPatch, Path: fmt.Sprintf("/api/v1/events/%s", uuid), - Body: SampleEventFactory(), + Body: SampleEventFactory(clubID), Role: &models.Super, TestUserIDReplaces: h.StringToPointer("user_id"), }, @@ -515,7 +530,7 @@ func TestUpdateEventFailsOnEventIdNotExist(t *testing.T) { } func TestUpdateSeriesFailsBadRequest(t *testing.T) { - appAssert := h.InitTest(t) + appAssert, _, clubID := CreateSampleClub(h.InitTest(t)) badRequests := []string{ "0", @@ -530,7 +545,7 @@ func TestUpdateSeriesFailsBadRequest(t *testing.T) { h.TestRequest{ Method: fiber.MethodPatch, Path: fmt.Sprintf("/api/v1/events/%s/series", badRequest), - Body: SampleEventFactory(), + Body: SampleEventFactory(clubID), Role: &models.Super, }, errors.FailedToValidateID, @@ -541,7 +556,8 @@ func TestUpdateSeriesFailsBadRequest(t *testing.T) { } func AssertDeleteWorks(t *testing.T, factoryFunction EventFactory, requestPath string, tester h.Tester) { - appAssert, eventUUIDs := CreateSampleEvent(h.InitTest(t), factoryFunction) + appAssert, _, clubID := CreateSampleClub(h.InitTest(t)) + appAssert, eventUUIDs := CreateSampleEvent(appAssert, clubID, factoryFunction) appAssert.TestOnStatusAndTester( h.TestRequest{ @@ -570,7 +586,8 @@ func TestDeleteSeriesByEventIDWorks(t *testing.T) { } func AssertDeleteNotExistFails(t *testing.T, factoryFunction EventFactory, requestPath string, tester h.Tester, badUUID uuid.UUID) { - appAssert, _ := CreateSampleEvent(h.InitTest(t), factoryFunction) + appAssert, _, clubID := CreateSampleClub(h.InitTest(t)) + appAssert, _ = CreateSampleEvent(appAssert, clubID, factoryFunction) appAssert.TestOnErrorAndTester( h.TestRequest{ diff --git a/backend/tests/api/helpers/auth.go b/backend/tests/api/helpers/auth.go index ab21ac2d0..c36778cb9 100644 --- a/backend/tests/api/helpers/auth.go +++ b/backend/tests/api/helpers/auth.go @@ -151,6 +151,8 @@ func SampleStudentFactory() (models.User, string) { LastName: "Doe", Email: "doe.jane@northeastern.edu", PasswordHash: *hashedPassword, + Major0: models.ComputerScience, + Major1: models.Economics, College: models.KCCS, GraduationCycle: models.May, GraduationYear: 2025, @@ -166,6 +168,9 @@ func SampleStudentJSONFactory(sampleStudent models.User, rawPassword string) *ma "last_name": sampleStudent.LastName, "email": sampleStudent.Email, "password": rawPassword, + "major0": string(sampleStudent.Major0), + "major1": string(sampleStudent.Major1), + "major2": string(sampleStudent.Major2), "college": string(sampleStudent.College), "graduation_cycle": string(sampleStudent.GraduationCycle), "graduation_year": int(sampleStudent.GraduationYear), diff --git a/backend/tests/api/user_test.go b/backend/tests/api/user_test.go index c9df6c605..f6af28f17 100644 --- a/backend/tests/api/user_test.go +++ b/backend/tests/api/user_test.go @@ -42,7 +42,10 @@ func TestGetUsersWorksForSuper(t *testing.T) { eaa.Assert.Equal("SAC", respUser.FirstName) eaa.Assert.Equal("Super", respUser.LastName) eaa.Assert.Equal("generatesac@gmail.com", respUser.Email) - eaa.Assert.Equal(models.College("KCCS"), respUser.College) + eaa.Assert.Equal(models.ComputerScience, respUser.Major0) + eaa.Assert.Equal(models.Major(""), respUser.Major1) + eaa.Assert.Equal(models.Major(""), respUser.Major2) + eaa.Assert.Equal(models.KCCS, respUser.College) eaa.Assert.Equal(models.May, respUser.GraduationCycle) eaa.Assert.Equal(int16(2025), respUser.GraduationYear) @@ -95,6 +98,9 @@ func TestGetUserWorks(t *testing.T) { eaa.Assert.Equal(sampleUser["first_name"].(string), respUser.FirstName) eaa.Assert.Equal(sampleUser["last_name"].(string), respUser.LastName) eaa.Assert.Equal(sampleUser["email"].(string), respUser.Email) + eaa.Assert.Equal(models.Major(sampleUser["major0"].(string)), respUser.Major0) + eaa.Assert.Equal(models.Major(sampleUser["major1"].(string)), respUser.Major1) + eaa.Assert.Equal(models.Major(sampleUser["major2"].(string)), respUser.Major2) eaa.Assert.Equal(models.College(sampleUser["college"].(string)), respUser.College) eaa.Assert.Equal(models.GraduationCycle(sampleUser["graduation_cycle"].(string)), respUser.GraduationCycle) eaa.Assert.Equal(int16(sampleUser["graduation_year"].(int)), respUser.GraduationYear) @@ -187,6 +193,9 @@ func TestUpdateUserWorks(t *testing.T) { eaa.Assert.Equal(newFirstName, respUser.FirstName) eaa.Assert.Equal(newLastName, respUser.LastName) eaa.Assert.Equal((sampleStudentJSON)["email"].(string), respUser.Email) + eaa.Assert.Equal(models.Major((sampleStudentJSON)["major0"].(string)), respUser.Major0) + eaa.Assert.Equal(models.Major((sampleStudentJSON)["major1"].(string)), respUser.Major1) + eaa.Assert.Equal(models.Major((sampleStudentJSON)["major2"].(string)), respUser.Major2) eaa.Assert.Equal(models.College((sampleStudentJSON)["college"].(string)), respUser.College) eaa.Assert.Equal(models.GraduationCycle(sampleStudentJSON["graduation_cycle"].(string)), respUser.GraduationCycle) eaa.Assert.Equal(int16(sampleStudentJSON["graduation_year"].(int)), respUser.GraduationYear) @@ -199,6 +208,9 @@ func TestUpdateUserWorks(t *testing.T) { eaa.Assert.Equal(dbUser.FirstName, respUser.FirstName) eaa.Assert.Equal(dbUser.LastName, respUser.LastName) eaa.Assert.Equal(dbUser.Email, respUser.Email) + eaa.Assert.Equal(dbUser.Major0, respUser.Major0) + eaa.Assert.Equal(dbUser.Major1, respUser.Major1) + eaa.Assert.Equal(dbUser.Major2, respUser.Major2) eaa.Assert.Equal(dbUser.College, respUser.College) eaa.Assert.Equal(dbUser.GraduationCycle, respUser.GraduationCycle) eaa.Assert.Equal(dbUser.GraduationYear, respUser.GraduationYear) @@ -367,6 +379,9 @@ func AssertUserWithIDBodyRespDB(eaa h.ExistingAppAssert, resp *http.Response, bo eaa.Assert.Equal(dbUser.FirstName, respUser.FirstName) eaa.Assert.Equal(dbUser.LastName, respUser.LastName) eaa.Assert.Equal(dbUser.Email, respUser.Email) + eaa.Assert.Equal(dbUser.Major0, respUser.Major0) + eaa.Assert.Equal(dbUser.Major1, respUser.Major1) + eaa.Assert.Equal(dbUser.Major2, respUser.Major2) eaa.Assert.Equal(dbUser.College, respUser.College) eaa.Assert.Equal(dbUser.GraduationCycle, respUser.GraduationCycle) eaa.Assert.Equal(dbUser.GraduationYear, respUser.GraduationYear) @@ -380,6 +395,9 @@ func AssertUserWithIDBodyRespDB(eaa h.ExistingAppAssert, resp *http.Response, bo eaa.Assert.Equal((*body)["first_name"].(string), dbUser.FirstName) eaa.Assert.Equal((*body)["last_name"].(string), dbUser.LastName) eaa.Assert.Equal((*body)["email"].(string), dbUser.Email) + eaa.Assert.Equal(models.Major((*body)["major0"].(string)), dbUser.Major0) + eaa.Assert.Equal(models.Major((*body)["major1"].(string)), dbUser.Major1) + eaa.Assert.Equal(models.Major((*body)["major2"].(string)), dbUser.Major2) eaa.Assert.Equal(models.College((*body)["college"].(string)), dbUser.College) eaa.Assert.Equal(models.GraduationCycle((*body)["graduation_cycle"].(string)), dbUser.GraduationCycle) eaa.Assert.Equal(int16((*body)["graduation_year"].(int)), dbUser.GraduationYear) From 6d608b02b5928a2eb95af1eb087c0254061800db Mon Sep 17 00:00:00 2001 From: Garrett Ladley <92384606+garrettladley@users.noreply.github.com> Date: Mon, 15 Apr 2024 17:22:58 -0400 Subject: [PATCH 15/16] feat: more informative error messages for password requirements (#549) --- backend/src/auth/password.go | 39 +++++++++++++++++++++++++ backend/src/constants/auth.go | 2 ++ backend/src/errors/auth.go | 12 ++++++++ backend/src/models/user.go | 8 ++--- backend/src/services/auth.go | 4 +++ backend/src/services/user.go | 12 ++++++++ backend/src/utilities/validator.go | 15 ---------- backend/tests/api/user_test.go | 47 +++++++++++++++++++++++------- 8 files changed, 109 insertions(+), 30 deletions(-) create mode 100644 backend/src/auth/password.go diff --git a/backend/src/auth/password.go b/backend/src/auth/password.go new file mode 100644 index 000000000..f1e6a9412 --- /dev/null +++ b/backend/src/auth/password.go @@ -0,0 +1,39 @@ +package auth + +import ( + "regexp" + "strings" + + "github.com/GenerateNU/sac/backend/src/constants" + "github.com/GenerateNU/sac/backend/src/errors" +) + +func ValidatePassword(password string) *errors.Error { + if len(password) < 8 { + return &errors.InvalidPasswordNotLongEnough + } + + if !hasDigit(password) { + return &errors.InvalidPasswordNoDigit + } + + if !hasSpecialChar(password) { + return &errors.InvalidPasswordNoSpecialCharacter + } + + return nil +} + +func hasDigit(str string) bool { + return regexp.MustCompile(`[0-9]`).MatchString(str) +} + +func hasSpecialChar(str string) bool { + for _, c := range constants.SPECIAL_CHARACTERS { + if strings.Contains(str, string(c)) { + return true + } + } + + return false +} diff --git a/backend/src/constants/auth.go b/backend/src/constants/auth.go index 236691482..1e0ca2966 100644 --- a/backend/src/constants/auth.go +++ b/backend/src/constants/auth.go @@ -6,3 +6,5 @@ const ( ACCESS_TOKEN_EXPIRY time.Duration = time.Hour * 24 * 30 // temporary TODO: change to 60 minutes REFRESH_TOKEN_EXPIRY time.Duration = time.Hour * 24 * 30 ) + +var SPECIAL_CHARACTERS = []rune{' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', '`', '{', '|', '}', '~'} // see https://owasp.org/www-community/password-special-characters diff --git a/backend/src/errors/auth.go b/backend/src/errors/auth.go index 57a6cc2d7..83b3c46c4 100644 --- a/backend/src/errors/auth.go +++ b/backend/src/errors/auth.go @@ -99,4 +99,16 @@ var ( StatusCode: fiber.StatusNotFound, Message: "otp not found", } + InvalidPasswordNotLongEnough = Error{ + StatusCode: fiber.StatusBadRequest, + Message: "password must be at least 8 characters long", + } + InvalidPasswordNoDigit = Error{ + StatusCode: fiber.StatusBadRequest, + Message: "password must contain at least one digit", + } + InvalidPasswordNoSpecialCharacter = Error{ + StatusCode: fiber.StatusBadRequest, + Message: "password must contain at least one special character", + } ) diff --git a/backend/src/models/user.go b/backend/src/models/user.go index aedfd98b7..e0c4015fc 100644 --- a/backend/src/models/user.go +++ b/backend/src/models/user.go @@ -175,7 +175,7 @@ type CreateUserRequestBody struct { FirstName string `json:"first_name" validate:"required,max=255"` LastName string `json:"last_name" validate:"required,max=255"` Email string `json:"email" validate:"required,email,neu_email,max=255"` - Password string `json:"password" validate:"required,password,min=8,max=255"` + Password string `json:"password" validate:"required,max=255"` // MARK: must be validated manually // Optional fields Major0 Major `json:"major0" validate:"not_equal_if_not_empty=Major1,not_equal_if_not_empty=Major2,omitempty,max=255,oneof=africanaStudies americanSignLanguage americanSignLanguage-EnglishInterpreting appliedPhysics architecturalStudies architecture art:ArtVisualStudies behavioralNeuroscience biochemistry bioengineering biology biomedicalPhysics businessAdministration businessAdministration:Accounting businessAdministration:AccountingAndAdvisoryServices businessAdministration:BrandManagement businessAdministration:BusinessAnalytics businessAdministration:CorporateInnovation businessAdministration:EntrepreneurialStartups businessAdministration:FamilyBusiness businessAdministration:Finance businessAdministration:Fintech businessAdministration:HealthcareManagementAndConsulting businessAdministration:Management businessAdministration:ManagementInformationSystems businessAdministration:Marketing businessAdministration:MarketingAnalytics businessAdministration:SocialInnovationAndEntrepreneurship businessAdministration:SupplyChainManagement cellAndMolecularBiology chemicalEngineering chemistry civilEngineering communicationStudies computerEngineering computerScience computingAndLaw criminologyAndCriminalJustice culturalAnthropology cybersecurity dataScience design economics electricalEngineering english environmentalAndSustainabilityStudies environmentalEngineering environmentalScience environmentalStudies gameArtAndAnimation gameDesign globalAsianStudies healthScience history historyCultureAndLaw humanServices industrialEngineering internationalAffairs internationalBusiness internationalBusiness:Accounting internationalBusiness:AccountingAndAdvisoryServices internationalBusiness:BrandManagement internationalBusiness:BusinessAnalytics internationalBusiness:CorporateInnovation internationalBusiness:EntrepreneurialStartups internationalBusiness:FamilyBusiness internationalBusiness:Finance internationalBusiness:Fintech internationalBusiness:HealthcareManagementAndConsulting internationalBusiness:Management internationalBusiness:ManagementInformationSystems internationalBusiness:Marketing internationalBusiness:MarketingAnalytics internationalBusiness:SocialInnovationAndEntrepreneurship internationalBusiness:SupplyChainManagement journalism landscapeArchitecture linguistics marineBiology mathematics mechanicalEngineering mediaAndScreenStudies mediaArts music musicTechnology nursing pharmaceuticalSciences pharmacy(PharmD) philosophy physics politicalScience politicsPhilosophyEconomics psychology publicHealth publicRelations religiousStudies sociology spanish speechLanguagePathologyAndAudiology theatre"` Major1 Major `json:"major1" validate:"not_equal_if_not_empty=Major0,not_equal_if_not_empty=Major2,omitempty,max=255,oneof=africanaStudies americanSignLanguage americanSignLanguage-EnglishInterpreting appliedPhysics architecturalStudies architecture art:ArtVisualStudies behavioralNeuroscience biochemistry bioengineering biology biomedicalPhysics businessAdministration businessAdministration:Accounting businessAdministration:AccountingAndAdvisoryServices businessAdministration:BrandManagement businessAdministration:BusinessAnalytics businessAdministration:CorporateInnovation businessAdministration:EntrepreneurialStartups businessAdministration:FamilyBusiness businessAdministration:Finance businessAdministration:Fintech businessAdministration:HealthcareManagementAndConsulting businessAdministration:Management businessAdministration:ManagementInformationSystems businessAdministration:Marketing businessAdministration:MarketingAnalytics businessAdministration:SocialInnovationAndEntrepreneurship businessAdministration:SupplyChainManagement cellAndMolecularBiology chemicalEngineering chemistry civilEngineering communicationStudies computerEngineering computerScience computingAndLaw criminologyAndCriminalJustice culturalAnthropology cybersecurity dataScience design economics electricalEngineering english environmentalAndSustainabilityStudies environmentalEngineering environmentalScience environmentalStudies gameArtAndAnimation gameDesign globalAsianStudies healthScience history historyCultureAndLaw humanServices industrialEngineering internationalAffairs internationalBusiness internationalBusiness:Accounting internationalBusiness:AccountingAndAdvisoryServices internationalBusiness:BrandManagement internationalBusiness:BusinessAnalytics internationalBusiness:CorporateInnovation internationalBusiness:EntrepreneurialStartups internationalBusiness:FamilyBusiness internationalBusiness:Finance internationalBusiness:Fintech internationalBusiness:HealthcareManagementAndConsulting internationalBusiness:Management internationalBusiness:ManagementInformationSystems internationalBusiness:Marketing internationalBusiness:MarketingAnalytics internationalBusiness:SocialInnovationAndEntrepreneurship internationalBusiness:SupplyChainManagement journalism landscapeArchitecture linguistics marineBiology mathematics mechanicalEngineering mediaAndScreenStudies mediaArts music musicTechnology nursing pharmaceuticalSciences pharmacy(PharmD) philosophy physics politicalScience politicsPhilosophyEconomics psychology publicHealth publicRelations religiousStudies sociology spanish speechLanguagePathologyAndAudiology theatre"` @@ -198,12 +198,12 @@ type UpdateUserRequestBody struct { type LoginUserResponseBody struct { Email string `json:"email" validate:"required,email"` - Password string `json:"password" validate:"required,password,min=8,max=255"` + Password string `json:"password" validate:"required,max=255"` // MARK: must be validated manually } type UpdatePasswordRequestBody struct { - OldPassword string `json:"old_password" validate:"required,password,min=8,max=255"` - NewPassword string `json:"new_password" validate:"required,password,not_equal_if_not_empty=OldPassword,min=8,max=255"` + OldPassword string `json:"old_password" validate:"required,max=255"` // MARK: must be validated manually + NewPassword string `json:"new_password" validate:"required,not_equal_if_not_empty=OldPassword,max=255"` // MARK: must be validated manually } type RefreshTokenRequestBody struct { diff --git a/backend/src/services/auth.go b/backend/src/services/auth.go index aa6d627a0..30079cd8f 100644 --- a/backend/src/services/auth.go +++ b/backend/src/services/auth.go @@ -40,6 +40,10 @@ func (a *AuthService) Login(loginBody models.LoginUserResponseBody) (*models.Use return nil, nil, &errors.FailedToValidateUser } + if pwordValErr := auth.ValidatePassword(loginBody.Password); pwordValErr != nil { + return nil, nil, pwordValErr + } + user, getUserByEmailErr := transactions.GetUserByEmail(a.DB, loginBody.Email) if getUserByEmailErr != nil { return nil, nil, getUserByEmailErr diff --git a/backend/src/services/user.go b/backend/src/services/user.go index 71dbf22d9..e10b6fee4 100644 --- a/backend/src/services/user.go +++ b/backend/src/services/user.go @@ -35,6 +35,10 @@ func (u *UserService) CreateUser(userBody models.CreateUserRequestBody) (*models return nil, nil, &errors.FailedToValidateUser } + if pwordValErr := auth.ValidatePassword(userBody.Password); pwordValErr != nil { + return nil, nil, pwordValErr + } + user, err := utilities.MapRequestToModel(userBody, &models.User{}) if err != nil { return nil, nil, &errors.FailedToMapRequestToModel @@ -141,6 +145,14 @@ func (u *UserService) UpdatePassword(id string, passwordBody models.UpdatePasswo return &errors.FailedToValidateUpdatePasswordBody } + if pwordValErr := auth.ValidatePassword(passwordBody.OldPassword); pwordValErr != nil { + return pwordValErr + } + + if pwordValErr := auth.ValidatePassword(passwordBody.NewPassword); pwordValErr != nil { + return pwordValErr + } + passwordHash, err := transactions.GetUserPasswordHash(u.DB, *idAsUUID) if err != nil { return err diff --git a/backend/src/utilities/validator.go b/backend/src/utilities/validator.go index 375335dec..092165f60 100644 --- a/backend/src/utilities/validator.go +++ b/backend/src/utilities/validator.go @@ -2,7 +2,6 @@ package utilities import ( "reflect" - "regexp" "strconv" "strings" @@ -22,10 +21,6 @@ func RegisterCustomValidators() (*validator.Validate, error) { return nil, err } - if err := validate.RegisterValidation("password", validatePassword); err != nil { - return nil, err - } - if err := validate.RegisterValidation("s3_url", validateS3URL); err != nil { return nil, err } @@ -60,16 +55,6 @@ func validateEmail(fl validator.FieldLevel) bool { return true } -func validatePassword(fl validator.FieldLevel) bool { - password := fl.Field().String() - - hasMinLength := len(password) >= 8 - hasDigit, _ := regexp.MatchString(`[0-9]`, password) - hasSpecialChar, _ := regexp.MatchString(`[@#%&*+]`, password) - - return hasMinLength && hasDigit && hasSpecialChar -} - func validateS3URL(fl validator.FieldLevel) bool { return strings.HasPrefix(fl.Field().String(), "https://s3.amazonaws.com/") } diff --git a/backend/tests/api/user_test.go b/backend/tests/api/user_test.go index f6af28f17..2db88c551 100644 --- a/backend/tests/api/user_test.go +++ b/backend/tests/api/user_test.go @@ -481,7 +481,7 @@ func TestCreateUserFailsIfUserWithEmailAlreadyExists(t *testing.T) { } func AssertCreateBadDataFails(t *testing.T, jsonKey string, badValues []interface{}) { - appAssert, _, _ := CreateSampleStudent(t, nil) + appAssert := h.InitTest(t) sampleStudent, rawPassword := h.SampleStudentFactory() @@ -498,7 +498,7 @@ func AssertCreateBadDataFails(t *testing.T, jsonKey string, badValues []interfac }, h.ErrorWithTester{ Error: errors.FailedToValidateUser, - Tester: TestNumUsersRemainsAt2, + Tester: TestNumUsersRemainsAt1, }, ) } @@ -520,15 +520,40 @@ func TestCreateUserFailsOnInvalidEmail(t *testing.T) { } func TestCreateUserFailsOnInvalidPassword(t *testing.T) { - AssertCreateBadDataFails(t, - "password", - []interface{}{ - "", - "foo", - "abcdefg", - "abcdefg0", - "abcdefg@", - }) + appAssert := h.InitTest(t) + + sampleStudent, rawPassword := h.SampleStudentFactory() + + inputsWithDesiredErr := []struct { + Password string + Error errors.Error + }{ + {"0", errors.InvalidPasswordNotLongEnough}, + {"foo", errors.InvalidPasswordNotLongEnough}, + {"abcdefgh", errors.InvalidPasswordNoDigit}, + {"abcdefg0", errors.InvalidPasswordNoSpecialCharacter}, + {"abcdefg@", errors.InvalidPasswordNoDigit}, + } + + for _, inputWithDesiredErr := range inputsWithDesiredErr { + sampleUserPermutation := *h.SampleStudentJSONFactory(sampleStudent, rawPassword) + sampleUserPermutation["password"] = inputWithDesiredErr.Password + + appAssert = appAssert.TestOnErrorAndTester( + h.TestRequest{ + Method: fiber.MethodPost, + Path: "/api/v1/users/", + Body: &sampleUserPermutation, + Role: &models.Super, + }, + h.ErrorWithTester{ + Error: inputWithDesiredErr.Error, + Tester: TestNumUsersRemainsAt1, + }, + ) + } + + appAssert.Close() } func TestCreateUserFailsOnMissingFields(t *testing.T) { From 65b4378bf6ef4d4cd9229725d541d5ec4ed0a496 Mon Sep 17 00:00:00 2001 From: Garrett Ladley <92384606+garrettladley@users.noreply.github.com> Date: Mon, 15 Apr 2024 17:29:26 -0400 Subject: [PATCH 16/16] parity: all content model fields are s3_urls (#550) --- backend/tests/api/club_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/tests/api/club_test.go b/backend/tests/api/club_test.go index e3b74f06b..d6ef0dcd6 100644 --- a/backend/tests/api/club_test.go +++ b/backend/tests/api/club_test.go @@ -253,7 +253,7 @@ func TestCreateClubFailsOnInvalidDescription(t *testing.T) { []interface{}{ "Not an URL", "@#139081#$Ad_Axf", - // "https://google.com", <-- TODO fix once we handle mongo urls + "https://google.com", }, ) } @@ -298,7 +298,7 @@ func TestCreateClubFailsOnInvalidLogo(t *testing.T) { []interface{}{ "Not an URL", "@#139081#$Ad_Axf", - // "https://google.com", <-- TODO uncomment once we figure out s3 url validation + "https://google.com", }, ) }