Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
88c4ae6
Modals for Event Card + Comments
hugoliu-code Dec 8, 2025
51db1e1
Waitlist functionality added
hugoliu-code Dec 8, 2025
7a8e28a
Add acceptance
hugoliu-code Dec 9, 2025
fad4a40
Application Acceptance + QUery invalidation
hugoliu-code Dec 9, 2025
991ba38
Add application status buttons for accepting/withdrawing
hugoliu-code Dec 9, 2025
ad1e3aa
Duplicated flow on application status page
hugoliu-code Dec 9, 2025
d1c1431
comment fix
hugoliu-code Dec 9, 2025
0833194
feat: Bat service + task logic
AlexanderWangY Dec 14, 2025
ca6f69c
temp: pushes for phoenix to branch off of, GL!
AlexanderWangY Dec 14, 2025
eb543b9
feat: HOLY SHIT IT WORKS LMFAO
AlexanderWangY Dec 15, 2025
afb971c
feat: bat result crud
h1divp Dec 15, 2025
6e37f73
fix: improved crud
h1divp Dec 15, 2025
830d3d6
Merge pull request #230 from swamphacks/feature/rejection+waitlist+ac…
AlexanderWangY Dec 15, 2025
0486935
chore/current stuff
h1divp Dec 15, 2025
21d3057
chore: rename
h1divp Dec 15, 2025
6e2039c
feat: handler and route
h1divp Dec 16, 2025
cc188b0
fix: add/update run logic
h1divp Dec 16, 2025
ae23ffa
feat: delete route
h1divp Dec 16, 2025
cf1fc91
Merge pull request #234 from swamphacks/feat/bat-ui-integration
h1divp Dec 16, 2025
ddf8541
Merge branch 'dev' into feat/teams-selection
h1divp Dec 16, 2025
a69e4a2
chore/sqlc generate
h1divp Dec 16, 2025
d18f30a
feat: app reviews finished status check, started decision ui
h1divp Dec 16, 2025
eeae581
feat: update review finished status handler
h1divp Dec 16, 2025
1f619b3
Added app decisions route
h1divp Dec 16, 2025
e1658ff
Merge pull request #232 from swamphacks/feat/teams-selection
AlexanderWangY Dec 17, 2025
3574bcc
feat: event application reviews finished hook
h1divp Dec 17, 2025
06d0f1e
fix/missing changes
h1divp Dec 17, 2025
132582c
Merge pull request #235 from swamphacks/feat/decision-release-ui
h1divp Dec 17, 2025
3fa103b
refactor: move engine logic into engine.go
AlexanderWangY Dec 17, 2025
5d2213b
tracking bat internal
AlexanderWangY Dec 17, 2025
ab4f7e8
fix: injection properties
AlexanderWangY Dec 17, 2025
a730f9d
Merge pull request #236 from swamphacks/refactor/bat-engine
AlexanderWangY Dec 17, 2025
71fe5f8
fix/removed column
h1divp Dec 17, 2025
26b0d17
fix:handler
h1divp Dec 17, 2025
856dc59
chore/rename var + unprotected route
h1divp Dec 17, 2025
1b092f0
chore/moved route back
h1divp Dec 17, 2025
24fc8db
feat: deployment + release
AlexanderWangY Dec 17, 2025
ed04908
Merge pull request #238 from swamphacks/fix/remove-app-review-finishe…
AlexanderWangY Dec 17, 2025
9257f49
resolve merge conflicts
AlexanderWangY Dec 17, 2025
12f6556
Merge pull request #239 from swamphacks/feat/decision-release
AlexanderWangY Dec 17, 2025
45ecbf5
merged from dev
AlexanderWangY Dec 17, 2025
606373d
decision release work
AlexanderWangY Dec 17, 2025
4bd1b6b
Merge pull request #240 from swamphacks/feat/decision-release
AlexanderWangY Dec 17, 2025
3ddcf4f
feat/send html email task
h1divp Dec 17, 2025
2fba483
chore/email template updates
h1divp Dec 17, 2025
dcb1c6d
feat/decision emails
h1divp Dec 18, 2025
ca1e943
fix:app review check
h1divp Dec 18, 2025
afa08af
fix:name
h1divp Dec 18, 2025
f054246
chore/sqlc generate
h1divp Dec 18, 2025
a8eea41
chore:comment
h1divp Dec 18, 2025
0f8bb6c
feat:reviewed email templates
h1divp Dec 18, 2025
8466c04
Merge branch 'dev' into feat/app-decision-emails
h1divp Dec 18, 2025
6a90d31
chore:sqlc generate
h1divp Dec 18, 2025
703e09e
Merge pull request #241 from swamphacks/feat/app-decision-emails
h1divp Dec 18, 2025
f9a55c0
fix:lmao
h1divp Dec 18, 2025
b8a91d2
Merge pull request #242 from swamphacks/feat/app-decision-emails
h1divp Dec 18, 2025
27addaf
hotfix:print working dir
h1divp Dec 18, 2025
11a567a
Merge pull request #243 from swamphacks/feat/app-decision-emails
h1divp Dec 18, 2025
189b984
fix:actually pwd
h1divp Dec 18, 2025
340a55e
Merge pull request #244 from swamphacks/feat/app-decision-emails
h1divp Dec 18, 2025
29cac59
Create prod-build-deploy-bat-worker.yml
h1divp Dec 18, 2025
b98f1b1
Merge pull request #245 from swamphacks/h1divp-patch-1
h1divp Dec 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions .github/workflows/dev-build-deploy-bat-worker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Deploy BAT Worker to Development

on:
push:
branches:
- dev
paths:
- 'apps/api/**'
- 'infra/docker-compose.api.yml'
workflow_dispatch:

permissions:
contents: read
packages: write

jobs:
build-and-push:
name: Build and Push Docker Image to GHCR
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
run: |
docker build \
--target prod \
-f ./apps/api/cmd/BAT_worker/Dockerfile \
-t ghcr.io/${{ github.repository_owner }}/core-bat-worker:dev \
./apps/api
docker push ghcr.io/${{ github.repository_owner }}/core-bat-worker:dev

run-migrations:
name: Run Goose Migrations
runs-on: ubuntu-latest
needs: build-and-push

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Goose
run: |
curl -fsSL https://raw.githubusercontent.com/pressly/goose/master/install.sh | sh

- name: Run migrations
run: |
goose -dir ./apps/api/internal/db/migrations postgres "${{ secrets.DEV_DB_URL }}" up

deploy:
name: Deploy to Development Server
runs-on: ubuntu-latest
needs: [build-and-push, run-migrations]

steps:
- name: SSH proxy command
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.API_HOST }}
username: root
password: ${{ secrets.API_PASSWORD }}
script: |
cd /root/core/infra
git fetch
git checkout dev
git reset --hard origin/dev
git pull

export INFISICAL_TOKEN=$(infisical login \
--method=universal-auth \
--client-id='${{ secrets.INFISICAL_CLIENT_ID }}' \
--client-secret='${{ secrets.INFISICAL_CLIENT_SECRET }}' \
--silent \
--plain)

infisical export \
--token=$INFISICAL_TOKEN \
--env=dev \
--format=dotenv \
--path="/api" \
--projectId='${{ secrets.INFISICAL_PROJECT_ID }}' \
> ./secrets/.env.dev.api

docker compose -f docker-compose.api.yml pull bat-worker-dev
docker compose -f docker-compose.api.yml up -d --no-deps --force-recreate bat-worker-dev
93 changes: 93 additions & 0 deletions .github/workflows/prod-build-deploy-bat-worker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Deploy BAT Worker to Production

on:
push:
branches:
- dev
paths:
- 'apps/api/**'
- 'infra/docker-compose.api.yml'
workflow_dispatch:

permissions:
contents: read
packages: write

jobs:
build-and-push:
name: Build and Push Docker Image to GHCR
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
run: |
docker build \
--target prod \
-f ./apps/api/cmd/BAT_worker/Dockerfile \
-t ghcr.io/${{ github.repository_owner }}/core-bat-worker:latest \
./apps/api
docker push ghcr.io/${{ github.repository_owner }}/core-bat-worker:latest

run-migrations:
name: Run Goose Migrations
runs-on: ubuntu-latest
needs: build-and-push

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Goose
run: |
curl -fsSL https://raw.githubusercontent.com/pressly/goose/master/install.sh | sh

- name: Run migrations
run: |
goose -dir ./apps/api/internal/db/migrations postgres "${{ secrets.DEV_DB_URL }}" up

deploy:
name: Deploy to Development Server
runs-on: ubuntu-latest
needs: [build-and-push, run-migrations]

steps:
- name: SSH proxy command
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.API_HOST }}
username: root
password: ${{ secrets.API_PASSWORD }}
script: |
cd /root/core/infra
git fetch
git checkout dev
git reset --hard origin/dev
git pull

export INFISICAL_TOKEN=$(infisical login \
--method=universal-auth \
--client-id='${{ secrets.INFISICAL_CLIENT_ID }}' \
--client-secret='${{ secrets.INFISICAL_CLIENT_SECRET }}' \
--silent \
--plain)

infisical export \
--token=$INFISICAL_TOKEN \
--env=dev \
--format=dotenv \
--path="/api" \
--projectId='${{ secrets.INFISICAL_PROJECT_ID }}' \
> ./secrets/.env.dev.api

docker compose -f docker-compose.api.yml pull bat-worker
docker compose -f docker-compose.api.yml up -d --no-deps --force-recreate bat-worker
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ local:
api:
docker compose up api

bat:
docker compose up api bat_worker asynqmon

storage:
docker compose up postgres redis

Expand Down
31 changes: 31 additions & 0 deletions apps/api/.air.bat.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
root = "."
tmp_dir = "tmp"

[build]
cmd = "go build -o ./tmp/main ./cmd/BAT_worker"
bin = "./tmp/main"
exclude_dir = ["tmp", "vendor"]
include_dir = ["cmd", "internal", "docs"] # same as API if you want
exclude_regex = ["_test.go"]
include_ext = ["go", "tpl", "tmpl", "html"]
log = "tmp/build-errors.log"
poll = true

[color]
app = ""
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"

[log]
main_only = false
silent = false
time = true

[misc]
clean_on_exit = false

[screen]
clear_on_rebuild = false
keep_scroll = true
1 change: 1 addition & 0 deletions apps/api/.air.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ testdata_dir = "testdata"
cmd = "go build -o ./tmp/main ./cmd/api"
bin = "./tmp/main"
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
include_dir = ["cmd", "internal", "docs", "pkgs"]
exclude_regex = ["_test.go"]
include_ext = ["go", "tpl", "tmpl", "html"]
log = "build-errors.log"
Expand Down
4 changes: 3 additions & 1 deletion apps/api/cmd/BAT_worker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ FROM base AS dev

RUN go install github.com/air-verse/air@latest

CMD ["air"]
COPY .air.bat.toml .

CMD ["air", "-c", ".air.bat.toml"]

# Production
FROM base AS prod
Expand Down
22 changes: 21 additions & 1 deletion apps/api/cmd/BAT_worker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import (

"github.com/hibiken/asynq"
"github.com/swamphacks/core/apps/api/internal/config"
"github.com/swamphacks/core/apps/api/internal/db"
"github.com/swamphacks/core/apps/api/internal/db/repository"
"github.com/swamphacks/core/apps/api/internal/email"
"github.com/swamphacks/core/apps/api/internal/logger"
"github.com/swamphacks/core/apps/api/internal/services"
"github.com/swamphacks/core/apps/api/internal/tasks"
"github.com/swamphacks/core/apps/api/internal/workers"
)

Expand Down Expand Up @@ -51,9 +56,24 @@ func main() {
},
)

_ = workers.NewBATWorker(logger)
database := db.NewDB(cfg.DatabaseURL)
defer database.Close()

txm := db.NewTransactionManager(database)

applicationRepo := repository.NewApplicationRepository(database)
eventRepo := repository.NewEventRespository(database)
userRepo := repository.NewUserRepository(database)
batRunsRepo := repository.NewBatRunsRepository(database)

sesClient := email.NewSESClient(cfg.AWS.AccessKey, cfg.AWS.AccessKeySecret, cfg.AWS.Region, logger)
emailService := services.NewEmailService(nil, sesClient, logger)
batService := services.NewBatService(applicationRepo, eventRepo, userRepo, batRunsRepo, emailService, txm, nil, logger)

BATWorker := workers.NewBATWorker(batService, logger)

mux := asynq.NewServeMux()
mux.HandleFunc(tasks.TypeCalculateAdmissions, BATWorker.HandleCalculateAdmissionsTask)

if err := srv.Run(mux); err != nil {
logger.Fatal().Msg("Failed to run BAT worker")
Expand Down
4 changes: 3 additions & 1 deletion apps/api/cmd/api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func main() {
teamRepo := repository.NewTeamRespository(database)
teamMemberRepo := repository.NewTeamMemberRespository(database)
teamJoinRequestRepo := repository.NewTeamJoinRequestRepository(database)
batRunsRepo := repository.NewBatRunsRepository(database)

// Injections into services
authService := services.NewAuthService(userRepo, accountRepo, sessionRepo, txm, client, logger, &cfg.Auth)
Expand All @@ -90,9 +91,10 @@ func main() {
emailService := services.NewEmailService(taskQueueClient, sesClient, logger)
applicationService := services.NewApplicationService(applicationRepo, eventService, emailService, txm, r2Client, &cfg.CoreBuckets, logger)
teamService := services.NewTeamService(teamRepo, teamMemberRepo, teamJoinRequestRepo, eventRepo, txm, logger)
batService := services.NewBatService(applicationRepo, eventRepo, userRepo, batRunsRepo, emailService, txm, taskQueueClient, logger)

// Injections into handlers
apiHandlers := handlers.NewHandlers(authService, userService, eventInterestService, eventService, emailService, applicationService, teamService, cfg, logger)
apiHandlers := handlers.NewHandlers(authService, userService, eventInterestService, eventService, emailService, applicationService, teamService, batService, cfg, logger)

api := api.NewAPI(&logger, apiHandlers, mw)

Expand Down
9 changes: 8 additions & 1 deletion apps/api/cmd/email_worker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"log"
"os"
"time"

"github.com/hibiken/asynq"
Expand Down Expand Up @@ -46,8 +47,14 @@ func main() {
mux := asynq.NewServeMux()

mux.HandleFunc(tasks.TypeSendConfirmationEmail, emailWorker.HandleSendConfirmationEmailTask)
mux.HandleFunc(tasks.TypeSendHtmlEmail, emailWorker.HandleSendHtmlEmailTask)

logger.Info().Msg("Starting email worker")
wd, err := os.Getwd()
if err != nil {
log.Fatalf("Failed to run email worker (could not get working directory)")
}

logger.Info().Str("Working dir", wd).Msg("Starting email worker")

if err := srv.Run(mux); err != nil {
log.Fatalf("Failed to run email worker")
Expand Down
18 changes: 16 additions & 2 deletions apps/api/internal/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
fmt.Printf("%v", err)
}

fmt.Fprintln(w, htmlContent)

Check failure on line 77 in apps/api/internal/api/api.go

View workflow job for this annotation

GitHub Actions / API Lint

Error return value of `fmt.Fprintln` is not checked (errcheck)
})

// Health check
Expand Down Expand Up @@ -122,8 +122,8 @@

// --- Event routes ---
api.Router.Route("/events", func(r chi.Router) {
// r.Post("/{eventId}/application/reset-reviews", api.Handlers.Application.ResetApplicationReviews)
// r.Post("/{eventId}/application/assign-reviewers", api.Handlers.Application.AssignApplicationReviewers)
r.Post("/{eventId}/calc-admissions", api.Handlers.Admission.HandleCalculateAdmissionsRequest)
r.Post("/{eventId}/reviews/bat-runs/{runId}/release", api.Handlers.Admission.ReleaseDecisions)

// Superuser-only
r.With(mw.Auth.RequireAuth, ensureSuperuser).Post("/", api.Handlers.Event.CreateEvent)
Expand Down Expand Up @@ -151,6 +151,11 @@
r.With(ensureEventAdmin).Post("/roles", api.Handlers.Event.AssignEventRole)
r.With(ensureEventAdmin).Delete("/roles/{userId}", api.Handlers.Event.RevokeEventRole)
r.With(ensureEventAdmin).Post("/roles/batch", api.Handlers.Event.BatchAssignEventRoles)
r.With(ensureEventAdmin).Get("/bat-runs", api.Handlers.Bat.GetRunsByEventId)
r.With(ensureEventAdmin).Delete("/bat-runs", api.Handlers.Bat.GetRunsByEventId)
r.With(ensureEventAdmin).Get("/review-status", api.Handlers.Bat.CheckApplicationReviewsComplete)
r.With(ensureEventAdmin).Post("/reviews/bat-runs", api.Handlers.Admission.HandleCalculateAdmissionsRequest)
r.With(ensureEventAdmin).Post("/reviews/bat-runs/{runId}/release", api.Handlers.Admission.ReleaseDecisions)

// Superuser-only
r.With(ensureSuperuser).Delete("/", api.Handlers.Event.DeleteEventById)
Expand All @@ -177,6 +182,15 @@
// Review admin routes (For Event Admins only)
r.With(ensureEventAdmin).Post("/reset-reviews", api.Handlers.Application.ResetApplicationReviews)
r.With(ensureEventAdmin).Post("/assign-reviewers", api.Handlers.Application.AssignApplicationReviewers)

//withdraw Acceptance
r.Patch("/withdraw-acceptance", api.Handlers.Application.WithdrawAcceptance)

//Accept acceptance
r.Patch("/accept-acceptance", api.Handlers.Application.AcceptApplicationAcceptance)

//Waitlist application
r.Patch("/join-waitlist", api.Handlers.Application.JoinWaitlist)
})

// Team routes
Expand Down
Loading
Loading