Skip to content

Commit 3b32703

Browse files
formatting
1 parent 715cf87 commit 3b32703

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed

backend/__tests__/controllers/organizationController.test.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import { OrganizationRole, OrganizationStatus, TennesseeRegion, OrganizationSize, PrismaClient } from '@prisma/client';
1+
import {
2+
OrganizationRole,
3+
OrganizationStatus,
4+
TennesseeRegion,
5+
OrganizationSize,
6+
PrismaClient,
7+
} from '@prisma/client';
28
import { mockDeep, mockReset } from 'jest-mock-extended';
39
import admin from 'firebase-admin';
410

@@ -219,7 +225,8 @@ describe('OrganizationController', () => {
219225
await registerOrganization(req, res);
220226
expect(res.status).toHaveBeenCalledWith(400);
221227
expect(res.json).toHaveBeenCalledWith({
222-
error: 'Email, password, name, and primary contact information (name, email, phone) are required',
228+
error:
229+
'Email, password, name, and primary contact information (name, email, phone) are required',
223230
});
224231
});
225232
it('should prevent duplicate registration - POST /api/organizations/register', async () => {

backend/controllers/organizationController.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import { Request, Response } from 'express';
2-
import { PrismaClient, OrganizationRole, OrganizationStatus, TennesseeRegion, OrganizationSize } from '@prisma/client';
2+
import {
3+
PrismaClient,
4+
OrganizationRole,
5+
OrganizationStatus,
6+
TennesseeRegion,
7+
OrganizationSize,
8+
} from '@prisma/client';
39
import { AuthenticatedRequest } from '../types/index.js';
410
import admin from 'firebase-admin';
511

@@ -12,7 +18,8 @@ const prisma = new PrismaClient();
1218
*/
1319
export const getAllOrganizations = async (req: AuthenticatedRequest, res: Response) => {
1420
try {
15-
const { search, status, role, city, state, tags, region, membershipActive, organizationType } = req.query;
21+
const { search, status, role, city, state, tags, region, membershipActive, organizationType } =
22+
req.query;
1623
const where: any = {};
1724
if (search) {
1825
where.OR = [
@@ -93,10 +100,20 @@ export const registerOrganization = async (req: Request, res: Response) => {
93100
tags,
94101
} = req.body;
95102

96-
if (!email || !password || !name || !primaryContactName || !primaryContactEmail || !primaryContactPhone) {
103+
if (
104+
!email ||
105+
!password ||
106+
!name ||
107+
!primaryContactName ||
108+
!primaryContactEmail ||
109+
!primaryContactPhone
110+
) {
97111
return res
98112
.status(400)
99-
.json({ error: 'Email, password, name, and primary contact information (name, email, phone) are required' });
113+
.json({
114+
error:
115+
'Email, password, name, and primary contact information (name, email, phone) are required',
116+
});
100117
}
101118
const existingOrg = await prisma.organization.findFirst({
102119
where: {

0 commit comments

Comments
 (0)