Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #1947

Merged
merged 7 commits into from
Oct 30, 2024
Merged

Develop #1947

Show file tree
Hide file tree
Changes from all commits
Commits
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
288 changes: 216 additions & 72 deletions .forestadmin-schema.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions apps/web-api/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ model PLEventGuest {
isHost Boolean @default(false)
isSpeaker Boolean @default(false)
isFeatured Boolean @default(false)
@@unique([memberUid, teamUid, eventUid])
}

model FocusArea {
Expand Down
3 changes: 1 addition & 2 deletions apps/web-api/src/guards/user-auth-validate.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ export class UserAuthValidateGuard implements CanActivate {
if (!token && request.method !== 'GET') {
throw new UnauthorizedException();
}

if (!token && request.method === 'GET') {
return true;
}

try {
const validationResult: any = await axios.post(
`${process.env.AUTH_API_URL}/auth/introspect`,
Expand All @@ -33,6 +31,7 @@ export class UserAuthValidateGuard implements CanActivate {
validationResult?.data?.email
) {
request['isUserLoggedIn'] = true;
request['userEmail'] = validationResult.data.email;
}

if (!validationResult?.data?.active && request.method !== 'GET') {
Expand Down
11 changes: 11 additions & 0 deletions apps/web-api/src/internals/pl-events.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { apiInternals } from 'libs/contracts/src/lib/contract-internals';
import { ResponsePLEventGuestSchemaWithRelationsSchema } from 'libs/contracts/src/schema';
import { ApiOkResponseFromZod } from '../decorators/api-response-from-zod';
import { PLEventGuestsService } from '../pl-events/pl-event-guests.service';
import { PLEventsService } from '../pl-events/pl-events.service';
import { PrismaQueryBuilder } from '../utils/prisma-query-builder';
import { prismaQueryableFieldsFromZod } from '../utils/prisma-queryable-fields-from-zod';
import { InternalAuthGuard } from '../guards/auth.guard';
Expand All @@ -18,6 +19,7 @@ type RouteShape = typeof server.routeShapes;
export class PLEventsInternalController {
constructor(
private readonly eventGuestsService: PLEventGuestsService,
private readonly eventService: PLEventsService
) {}

@Api(server.route.getPLEventGuestsByLocation)
Expand All @@ -31,6 +33,15 @@ export class PLEventsInternalController {
);
const builder = new PrismaQueryBuilder(queryableFields);
const builtQuery = builder.build(request.query);
if (request.query.searchBy) {
delete builtQuery.where?.searchBy;
builtQuery.where = {
AND: [
builtQuery.where,
this.eventGuestsService.buildSearchFilter(request.query),
]
};
}
return await this.eventGuestsService.getPLEventGuestsByLocation(locationUid, builtQuery);
}
}
Loading
Loading