Skip to content

Commit

Permalink
Merge branch 'main' into SAC-29-Scrape-Clubs-By-Filters
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettladley authored Feb 20, 2024
2 parents a056341 + ef715e4 commit de3f40a
Show file tree
Hide file tree
Showing 65 changed files with 3,604 additions and 1,943 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
name: Backend

permissions: read-all

on:
push:
paths:
- "backend/**"
- ".github/workflows/backend.yml"
- backend/**
- .github/workflows/backend.yml
pull_request:
types: [opened]
paths:
- "backend/**"
- ".github/workflows/backend.yml"
- backend/**
- .github/workflows/backend.yml

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/cli.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
name: CLI

permissions: read-all

on:
push:
paths:
- "cli/**"
- ".github/workflows/cli.yml"
- cli/**
- .github/workflows/cli.yml
pull_request:
types: [opened]
paths:
- "cli/**"
- ".github/workflows/cli.yml"
- cli/**
- .github/workflows/cli.yml

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/mobile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Mobile

permissions: read-all

on:
push:
paths:
- frontend/sac-mobile/**
- .github/workflows/mobile.yml
pull_request:
types: opened
paths:
- frontend/sac-mobile/**
- .github/workflows/mobile.yml

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: yarn
cache-dependency-path: frontend/sac-mobile/yarn.lock

- name: Install dependencies
run: |
cd frontend/sac-mobile
yarn install
- name: Lint
run: |
cd frontend/sac-mobile
yarn lint
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: yarn
cache-dependency-path: frontend/sac-mobile/yarn.lock

- name: Install dependencies
run: |
cd frontend/sac-mobile
yarn install
- name: Test
run: |
cd frontend/sac-mobile
yarn test
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.DS_Store
.env
sac-cli
node_modules
.vscode
.trunk
.trunk
9 changes: 9 additions & 0 deletions .trunk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*out
*logs
*actions
*notifications
*tools
plugins
user_trunk.yaml
user.yaml
tmp
10 changes: 10 additions & 0 deletions .trunk/configs/.markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Autoformatter friendly markdownlint config (all formatting rules disabled)
default: true
blank_lines: false
bullet: false
html: false
indentation: false
line_length: false
spaces: false
url: false
whitespace: false
7 changes: 7 additions & 0 deletions .trunk/configs/.shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
enable=all
source-path=SCRIPTDIR
disable=SC2154

# If you're having issues with shellcheck following source, disable the errors via:
# disable=SC1090
# disable=SC1091
10 changes: 10 additions & 0 deletions .trunk/configs/.yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
rules:
quoted-strings:
required: only-when-needed
extra-allowed: ["{|}"]
empty-values:
forbid-in-block-mappings: true
forbid-in-flow-mappings: true
key-duplicates: {}
octal-values:
forbid-implicit-octal: true
14 changes: 14 additions & 0 deletions .trunk/configs/svgo.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
plugins: [
{
name: "preset-default",
params: {
overrides: {
removeViewBox: false, // https://github.com/svg/svgo/issues/1128
sortAttrs: true,
removeOffCanvasPaths: true,
},
},
},
],
};
43 changes: 43 additions & 0 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This file controls the behavior of Trunk: https://docs.trunk.io/cli
# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
version: 0.1
cli:
version: 1.19.0
# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins)
plugins:
sources:
- id: trunk
ref: v1.4.2
uri: https://github.com/trunk-io/plugins
# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes)
runtimes:
enabled:
- [email protected]
- [email protected]
- [email protected]
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
lint:
disabled:
- checkov
enabled:
- [email protected]
- git-diff-check
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
actions:
disabled:
- trunk-announce
- trunk-check-pre-push
- trunk-fmt-pre-commit
enabled:
- trunk-upgrade-available
24 changes: 14 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@

To install use `./install.sh` and then run `sac-cli` to see all commands.

```console
```console
NAME:
sac-cli - CLI for SAC

Expand All @@ -138,24 +138,28 @@

COMMANDS:
swagger, swag Updates the swagger documentation
be Run the backend
test, t Runs tests
format, f Runs formatting tools
lint, l Runs linting tools
help, h Shows a list of commands or help for one command
CI:
format, f Runs formatting tools
lint, l Runs linting tools
* can use --fix to fix linting errors for frontend
Database Operations:
clean Remove databases used for testing
migrate Migrate the database, creating tables and relationships
insert, i Inserts mock data into the database
reset, r Resets the database, dropping all tables, clearing data, and re-running migrations
clean, c Remove databases used for testing
migrate, m Migrate the database, creating tables and relationships
reset, r Resets the database, dropping all tables, clearing data, and re-running migrations
* can use --data to just reset data and not drop tables
drop, d Drop data with a migration or drops the entire database
insert, i Inserts mock data into the database
drop, d Drop data with a migration or drops the entire database
* can use --data to just drop data and not drop tables

Development:
be Run the backend
fe Run the frontend

GLOBAL OPTIONS:
--help, -h show help
```

# Git Flow

1. **Create a new branch**
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
<img src="https://github.com/GenerateNU/sac/actions/workflows/backend.yml/badge.svg"
alt="Backend Workflow Status" />
</a>
<a href="https://github.com/GenerateNU/sac/actions/workflows/mobile.yml">
<img src="https://github.com/GenerateNU/sac/actions/workflows/mobile.yml/badge.svg"
alt="Mobile Workflow Status" />
</a>

<a href="https://github.com/GenerateNU/sac/actions/workflows/backend_codeql.yml">
<img src="https://github.com/GenerateNU/sac/actions/workflows/backend_codeql.yml/badge.svg"
Expand Down
3 changes: 2 additions & 1 deletion backend/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ require (
github.com/klauspost/compress v1.17.0 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
Expand Down
7 changes: 4 additions & 3 deletions backend/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0V
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA=
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
Expand All @@ -113,8 +114,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ=
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
Expand Down
5 changes: 4 additions & 1 deletion backend/src/controllers/category.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func (cat *CategoryController) GetCategories(c *fiber.Ctx) error {
// @ID get-category
// @Tags category
// @Produce json
// @Param id path string true "Category ID"
// @Success 200 {object} models.Category
// @Failure 400 {string} string "failed to validate id"
// @Failure 404 {string} string "faied to find category"
Expand All @@ -96,7 +97,8 @@ func (cat *CategoryController) GetCategory(c *fiber.Ctx) error {
// @ID delete-category
// @Tags category
// @Produce json
// @Success 204 {object}
// @Param id path string true "Category ID"
// @Success 204 {string} string "no content"
// @Failure 400 {string} string "failed to validate id"
// @Failure 404 {string} string "failed to find category"
// @Failure 500 {string} string "failed to delete category"
Expand All @@ -116,6 +118,7 @@ func (cat *CategoryController) DeleteCategory(c *fiber.Ctx) error {
// @ID update-category
// @Tags category
// @Produce json
// @Param id path string true "Category ID"
// @Success 200 {object} models.Category
// @Failure 400 {string} string "failed to validate id"
// @Failure 404 {string} string "failed to find category"
Expand Down
8 changes: 5 additions & 3 deletions backend/src/controllers/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (u *UserController) GetUsers(c *fiber.Ctx) error {
// @Failure 404 {string} string "user not found"
// @Failure 400 {string} string "failed to validate id"
// @Failure 500 {string} string "failed to get user"
// @Router /api/v1/users/:id [get]
// @Router /api/v1/users/{id} [get]
func (u *UserController) GetUser(c *fiber.Ctx) error {
user, err := u.userService.GetUser(c.Params("userID"))
if err != nil {
Expand All @@ -96,13 +96,14 @@ func (u *UserController) GetUser(c *fiber.Ctx) error {
// @ID update-user-by-id
// @Tags user
// @Produce json
// @Param id path string true "User ID"
// @Success 200 {object} models.User
// @Failure 404 {string} string "user not found"
// @Failure 400 {string} string "invalid request body"
// @Failure 400 {string} string "failed to validate id"
// @Failure 500 {string} string "database error"
// @Failure 500 {string} string "failed to hash password"
// @Router /api/v1/users/:id [patch]
// @Router /api/v1/users/{id} [patch]
func (u *UserController) UpdateUser(c *fiber.Ctx) error {
var user models.UpdateUserRequestBody

Expand All @@ -126,9 +127,10 @@ func (u *UserController) UpdateUser(c *fiber.Ctx) error {
// @ID delete-user
// @Tags user
// @Produce json
// @Param id path string true "User ID"
// @Success 204 {string} string "no content"
// @Failure 500 {string} string "failed to get all users"
// @Router /api/v1/users/:id [delete]
// @Router /api/v1/users/{id} [delete]
func (u *UserController) DeleteUser(c *fiber.Ctx) error {
err := u.userService.DeleteUser(c.Params("userID"))
if err != nil {
Expand Down
Loading

0 comments on commit de3f40a

Please sign in to comment.