Skip to content

Commit

Permalink
Merge branch 'main' into rich-text-editor
Browse files Browse the repository at this point in the history
  • Loading branch information
in-mai-space committed May 24, 2024
2 parents 13c02b9 + 0d64721 commit dc971df
Show file tree
Hide file tree
Showing 71 changed files with 2,174 additions and 1,263 deletions.
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: "☢️ Bug"
about: Create a report to help us improve
title: "☢️ bug: [Short description of the bug]"
labels: ["☢️ bug"]
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '...'
3. Scroll down to '...'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/chore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: "🧹 Chore"
about: Something you'd like to see done but not urgently
title: "🧹 chore: [Short description of the chore]"
labels: ["🧹 chore"]
---

**Please describe.**
A clear and concise description of what you'd like to see. Ex. We should [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: "📝 Feature Request"
about: Suggest an idea for this project
title: "📝 feat: [Short description of the feature]"
labels: ["📝 feature"]
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
28 changes: 24 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,47 @@ updates:
directory: ./backend/
schedule:
interval: weekly
groups:
backend:
patterns:
- "*"
- package-ecosystem: gomod
directory: ./cli/
schedule:
interval: weekly
groups:
cli:
patterns:
- "*"
- package-ecosystem: npm
directory: ./frontend/mobile/
schedule:
interval: weekly
groups:
mobile:
patterns:
- "*"
- package-ecosystem: npm
directory: ./frontend/web/
schedule:
interval: weekly
groups:
web:
patterns:
- "*"
- package-ecosystem: npm
directory: ./frontend/dashboard/
schedule:
interval: weekly
groups:
dashboard:
patterns:
- "*"
- package-ecosystem: npm
directory: ./frontend/lib/
schedule:
interval: weekly
- package-ecosystem: cargo
directory: ./scraper/clubs/
schedule:
interval: weekly
groups:
lib:
patterns:
- "*"
17 changes: 11 additions & 6 deletions .github/workflows/frontend_lib_release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
name: Frontend Lib Release

on:
pull_request:
branches-ignore:
- dependabot/**
push:
branches:
- main
paths:
- "frontend/lib/**"
- frontend/lib/**

permissions:
contents: read

jobs:
build:
Expand All @@ -14,12 +20,11 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
scope: '@octocat'
node-version: 20.x
registry-url: https://registry.npmjs.org
scope: "@octocat"
- run: |
cd frontend/lib
yarn
yarn build
NODE_AUTH_TOKEN=${{ secrets.NPM_AUTH_TOKEN }}
yarn publish --access public
NODE_AUTH_TOKEN=${{ secrets.NPM_AUTH_TOKEN }} yarn publish --access public
10 changes: 5 additions & 5 deletions backend/entities/auth/base/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ func (a *AuthController) Register(c *fiber.Ctx) error {

// Refresh godoc
//
// @Summary Refreshes a user's access token
// @Description Refreshes a user's access token
// @Summary Refreshes a user's access token and returns a new pair of tokens
// @Description Refreshes a user's access token and returns a new pair of tokens
// @ID refresh-user
// @Tags auth
// @Accept json
Expand All @@ -100,10 +100,10 @@ func (a *AuthController) Register(c *fiber.Ctx) error {
// @Failure 500 {object} error
// @Router /auth/refresh [post]
func (a *AuthController) Refresh(c *fiber.Ctx) error {
var refreshBody authEntities.RefreshTokenRequestBody
var refreshBody RefreshTokenCookieBody

if err := c.BodyParser(&refreshBody); err != nil {
return utilities.InvalidJSON()
if err := c.CookieParser(&refreshBody); err != nil {
return utilities.InvalidCookies()
}

tokens, err := a.authService.Refresh(refreshBody.RefreshToken)
Expand Down
4 changes: 4 additions & 0 deletions backend/entities/auth/base/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ type VerifyPasswordResetTokenRequestBody struct {
type EmailRequestBody struct {
Email string `json:"email" validate:"required,email"`
}

type RefreshTokenCookieBody struct {
RefreshToken string `cookie:"refresh_token" validate:"required"`
}
3 changes: 1 addition & 2 deletions backend/entities/categories/base/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"github.com/GenerateNU/sac/backend/auth"
"github.com/GenerateNU/sac/backend/entities/categories/tags"
"github.com/GenerateNU/sac/backend/types"
"github.com/garrettladley/fiberpaginate"
"github.com/gofiber/fiber/v2"
)

Expand All @@ -24,7 +23,7 @@ func Category(categoryParams types.RouteParams) fiber.Router {
categories := categoryParams.Router.Group("/categories")

categories.Post("/", categoryParams.AuthMiddleware.Authorize(auth.CreateAll), categoryController.CreateCategory)
categories.Get("/", fiberpaginate.New(), categoryController.GetCategories)
categories.Get("/", categoryParams.UtilityMiddleware.Paginator, categoryController.GetCategories)

// api/v1/categories/:categoryID/*
categoryID := categories.Group("/:categoryID")
Expand Down
3 changes: 1 addition & 2 deletions backend/entities/categories/tags/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package tags

import (
"github.com/GenerateNU/sac/backend/types"
"github.com/garrettladley/fiberpaginate"
)

func CategoryTag(categoryParams types.RouteParams) {
Expand All @@ -11,6 +10,6 @@ func CategoryTag(categoryParams types.RouteParams) {
// api/v1/categories/:categoryID/tags/*
categoryTags := categoryParams.Router.Group("/tags")

categoryTags.Get("/", fiberpaginate.New(), categoryTagController.GetTagsByCategory)
categoryTags.Get("/", categoryParams.UtilityMiddleware.Paginator, categoryTagController.GetTagsByCategory)
categoryTags.Get("/:tagID", categoryTagController.GetTagByCategory)
}
7 changes: 3 additions & 4 deletions backend/entities/clubs/base/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import (
"github.com/GenerateNU/sac/backend/entities/clubs/members"
"github.com/GenerateNU/sac/backend/entities/clubs/pocs"
"github.com/GenerateNU/sac/backend/entities/clubs/tags"
"github.com/GenerateNU/sac/backend/middleware"
"github.com/garrettladley/fiberpaginate"
authMiddleware "github.com/GenerateNU/sac/backend/middleware/auth"

"github.com/GenerateNU/sac/backend/types"
"github.com/gofiber/fiber/v2"
Expand All @@ -32,7 +31,7 @@ func ClubRouter(clubParams types.RouteParams) fiber.Router {
// api/v1/clubs/*
clubs := clubParams.Router.Group("/clubs")

clubs.Get("/", fiberpaginate.New(), clubController.GetClubs)
clubs.Get("/", clubParams.UtilityMiddleware.Paginator, clubController.GetClubs)
clubs.Post("/", clubParams.AuthMiddleware.Authorize(p.CreateAll), clubController.CreateClub)

// api/v1/clubs/:clubID/*
Expand All @@ -41,7 +40,7 @@ func ClubRouter(clubParams types.RouteParams) fiber.Router {
clubID.Get("/", clubController.GetClub)
clubID.Patch(
"/",
middleware.AttachExtractor(clubParams.AuthMiddleware.ClubAuthorizeById, middleware.ExtractFromParams("clubID")),
authMiddleware.AttachExtractor(clubParams.AuthMiddleware.ClubAuthorizeById, authMiddleware.ExtractFromParams("clubID")),
clubController.UpdateClub,
)
clubID.Delete("/", clubParams.AuthMiddleware.Authorize(p.DeleteAll), clubController.DeleteClub)
Expand Down
4 changes: 2 additions & 2 deletions backend/entities/clubs/contacts/routes.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package contacts

import (
"github.com/GenerateNU/sac/backend/middleware"
authMiddleware "github.com/GenerateNU/sac/backend/middleware/auth"
"github.com/GenerateNU/sac/backend/types"
)

Expand All @@ -14,7 +14,7 @@ func ClubContact(clubParams types.RouteParams) {
clubContacts.Get("/", clubContactController.GetClubContacts)
clubContacts.Put(
"/",
middleware.AttachExtractor(clubParams.AuthMiddleware.ClubAuthorizeById, middleware.ExtractFromParams("clubID")),
authMiddleware.AttachExtractor(clubParams.AuthMiddleware.ClubAuthorizeById, authMiddleware.ExtractFromParams("clubID")),
clubContactController.PutContact,
)
}
3 changes: 1 addition & 2 deletions backend/entities/clubs/events/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package events

import (
"github.com/GenerateNU/sac/backend/types"
"github.com/garrettladley/fiberpaginate"
)

func ClubEvent(clubParams types.RouteParams) {
Expand All @@ -11,5 +10,5 @@ func ClubEvent(clubParams types.RouteParams) {
// api/v1/clubs/:clubID/events/*
events := clubParams.Router.Group("/events")

events.Get("/", fiberpaginate.New(), clubEventController.GetClubEvents)
events.Get("/", clubParams.UtilityMiddleware.Paginator, clubEventController.GetClubEvents)
}
3 changes: 1 addition & 2 deletions backend/entities/clubs/followers/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package followers

import (
"github.com/GenerateNU/sac/backend/types"
"github.com/garrettladley/fiberpaginate"
)

func ClubFollower(clubParams types.RouteParams) {
Expand All @@ -11,5 +10,5 @@ func ClubFollower(clubParams types.RouteParams) {
clubFollowers := clubParams.Router.Group("/followers")

// api/clubs/:clubID/followers/*
clubFollowers.Get("/", fiberpaginate.New(), clubFollowerController.GetClubFollowers)
clubFollowers.Get("/", clubParams.UtilityMiddleware.Paginator, clubFollowerController.GetClubFollowers)
}
9 changes: 4 additions & 5 deletions backend/entities/clubs/members/routes.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package members

import (
"github.com/GenerateNU/sac/backend/middleware"
authMiddleware "github.com/GenerateNU/sac/backend/middleware/auth"
"github.com/GenerateNU/sac/backend/types"
"github.com/garrettladley/fiberpaginate"
)

func ClubMember(clubParams types.RouteParams) {
Expand All @@ -12,15 +11,15 @@ func ClubMember(clubParams types.RouteParams) {
clubMembers := clubParams.Router.Group("/members")

// api/v1/clubs/:clubID/members/*
clubMembers.Get("/", fiberpaginate.New(), clubMemberController.GetClubMembers)
clubMembers.Get("/", clubParams.UtilityMiddleware.Paginator, clubMemberController.GetClubMembers)
clubMembers.Post(
"/:userID",
middleware.AttachExtractor(clubParams.AuthMiddleware.ClubAuthorizeById, middleware.ExtractFromParams("clubID")),
authMiddleware.AttachExtractor(clubParams.AuthMiddleware.ClubAuthorizeById, authMiddleware.ExtractFromParams("clubID")),
clubMemberController.CreateClubMember,
)
clubMembers.Delete(
"/:userID",
middleware.AttachExtractor(clubParams.AuthMiddleware.ClubAuthorizeById, middleware.ExtractFromParams("clubID")),
authMiddleware.AttachExtractor(clubParams.AuthMiddleware.ClubAuthorizeById, authMiddleware.ExtractFromParams("clubID")),
clubMemberController.DeleteClubMember,
)
}
10 changes: 5 additions & 5 deletions backend/entities/clubs/pocs/routes.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package pocs

import (
"github.com/GenerateNU/sac/backend/middleware"
authMiddleware "github.com/GenerateNU/sac/backend/middleware/auth"
"github.com/GenerateNU/sac/backend/types"
)

Expand All @@ -15,22 +15,22 @@ func ClubPointOfContact(clubParams types.RouteParams) {
clubPointOfContacts.Get("/:pocID", clubPointOfContactController.GetClubPointOfContact)
clubPointOfContacts.Post(
"/",
middleware.AttachExtractor(clubParams.AuthMiddleware.ClubAuthorizeById, middleware.ExtractFromParams("clubID")),
authMiddleware.AttachExtractor(clubParams.AuthMiddleware.ClubAuthorizeById, authMiddleware.ExtractFromParams("clubID")),
clubPointOfContactController.CreateClubPointOfContact,
)
clubPointOfContacts.Patch(
"/:pocID",
middleware.AttachExtractor(clubParams.AuthMiddleware.ClubAuthorizeById, middleware.ExtractFromParams("clubID")),
authMiddleware.AttachExtractor(clubParams.AuthMiddleware.ClubAuthorizeById, authMiddleware.ExtractFromParams("clubID")),
clubPointOfContactController.UpdateClubPointOfContact,
)
clubPointOfContacts.Patch(
"/:pocID/photo",
middleware.AttachExtractor(clubParams.AuthMiddleware.ClubAuthorizeById, middleware.ExtractFromParams("clubID")),
authMiddleware.AttachExtractor(clubParams.AuthMiddleware.ClubAuthorizeById, authMiddleware.ExtractFromParams("clubID")),
clubPointOfContactController.UpdateClubPointOfContactPhoto,
)
clubPointOfContacts.Delete(
"/:pocID",
middleware.AttachExtractor(clubParams.AuthMiddleware.ClubAuthorizeById, middleware.ExtractFromParams("clubID")),
authMiddleware.AttachExtractor(clubParams.AuthMiddleware.ClubAuthorizeById, authMiddleware.ExtractFromParams("clubID")),
clubPointOfContactController.DeleteClubPointOfContact,
)
}
6 changes: 3 additions & 3 deletions backend/entities/clubs/tags/routes.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tags

import (
"github.com/GenerateNU/sac/backend/middleware"
authMiddleware "github.com/GenerateNU/sac/backend/middleware/auth"
"github.com/GenerateNU/sac/backend/types"
)

Expand All @@ -14,12 +14,12 @@ func ClubTag(clubParams types.RouteParams) {
clubTags.Get("/", clubTagController.GetClubTags)
clubTags.Post(
"/",
middleware.AttachExtractor(clubParams.AuthMiddleware.ClubAuthorizeById, middleware.ExtractFromParams("clubID")),
authMiddleware.AttachExtractor(clubParams.AuthMiddleware.ClubAuthorizeById, authMiddleware.ExtractFromParams("clubID")),
clubTagController.CreateClubTags,
)
clubTags.Delete(
"/:tagID",
middleware.AttachExtractor(clubParams.AuthMiddleware.ClubAuthorizeById, middleware.ExtractFromParams("clubID")),
authMiddleware.AttachExtractor(clubParams.AuthMiddleware.ClubAuthorizeById, authMiddleware.ExtractFromParams("clubID")),
clubTagController.DeleteClubTag,
)
}
Loading

0 comments on commit dc971df

Please sign in to comment.