Skip to content

Commit 8be7fa0

Browse files
prettier formatting
1 parent 76d950c commit 8be7fa0

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

.github/workflows/prettier-auto-format.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
branches:
99
- main
1010

11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
1115
jobs:
1216
prettier-frontend:
1317
name: Prettier Frontend
@@ -19,6 +23,7 @@ jobs:
1923
with:
2024
token: ${{ secrets.GITHUB_TOKEN }}
2125
fetch-depth: 0
26+
ref: ${{ github.head_ref || github.ref_name }}
2227

2328
- name: Set up Node.js
2429
uses: actions/setup-node@v4
@@ -38,10 +43,11 @@ jobs:
3843
git config --local user.email "action@github.com"
3944
git config --local user.name "GitHub Action"
4045
git add .
41-
git diff --staged --quiet || git commit -m "Auto-format frontend code with Prettier"
46+
git diff --staged --quiet || git commit -m "Auto-format frontend code with Prettier 🤖"
4247
4348
- name: Push changes
44-
run: git push
49+
run: |
50+
git push origin main --force-with-lease
4551
4652
prettier-backend:
4753
name: Prettier Backend
@@ -53,6 +59,7 @@ jobs:
5359
with:
5460
token: ${{ secrets.GITHUB_TOKEN }}
5561
fetch-depth: 0
62+
ref: ${{ github.head_ref || github.ref_name }}
5663

5764
- name: Set up Node.js
5865
uses: actions/setup-node@v4
@@ -72,7 +79,8 @@ jobs:
7279
git config --local user.email "action@github.com"
7380
git config --local user.name "GitHub Action"
7481
git add .
75-
git diff --staged --quiet || git commit -m "Auto-format backend code with Prettier"
82+
git diff --staged --quiet || git commit -m "Auto-format backend code with Prettier 🤖"
7683
7784
- name: Push changes
78-
run: git push
85+
run: |
86+
git push origin main --force-with-lease

backend/controllers/organizationController.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ export const registerOrganization = async (req: Request, res: Response) => {
9292
emailVerified: false,
9393
displayName: name,
9494
});
95+
let organizationTags = [];
96+
if (tags) {
97+
organizationTags = tags;
98+
}
9599
const newOrg = await prisma.organization.create({
96100
data: {
97101
email,
@@ -105,7 +109,7 @@ export const registerOrganization = async (req: Request, res: Response) => {
105109
state,
106110
zipCode,
107111
phoneNumber,
108-
tags: tags || [],
112+
tags: organizationTags,
109113
firebaseUid: firebaseUser.uid,
110114
role: 'MEMBER',
111115
status: 'PENDING',
@@ -127,7 +131,12 @@ export const getOrganizationById = async (req: AuthenticatedRequest, res: Respon
127131
try {
128132
const { id } = req.params;
129133
const currentUser = req.user;
130-
const targetId = id === 'profile' ? currentUser?.id : id;
134+
let targetId;
135+
if (id === 'profile') {
136+
targetId = currentUser?.id;
137+
} else {
138+
targetId = id;
139+
}
131140
if (!targetId) {
132141
return res.status(401).json({ error: 'Organization not authenticated' });
133142
}
@@ -176,7 +185,12 @@ export const updateOrganization = async (req: AuthenticatedRequest, res: Respons
176185
role,
177186
status,
178187
} = req.body;
179-
const targetId = id === 'profile' ? currentUser?.id : id;
188+
let targetId;
189+
if (id === 'profile') {
190+
targetId = currentUser?.id;
191+
} else {
192+
targetId = id;
193+
}
180194

181195
if (!targetId) {
182196
return res.status(401).json({ error: 'Organization not authenticated' });

0 commit comments

Comments
 (0)