Skip to content

Commit a39c17a

Browse files
authored
Merge pull request #624 from dump-hr/ninom5/614-dodat-da-sponzori-sami-dodaju-ljude-za-akreditacije
Ninom5/614 dodat da sponzori sami dodaju ljude za akreditacije
2 parents f93e453 + ad07a5d commit a39c17a

File tree

18 files changed

+491
-133
lines changed

18 files changed

+491
-133
lines changed

apps/admin/tsconfig.tsbuildinfo

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

apps/api/src/company/company.controller.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,16 @@ export class CompanyController {
162162
return await this.companyService.updateDescription(user.id, data);
163163
}
164164

165+
@UseGuards(SponsorGuard)
166+
@ApiBearerAuth()
167+
@Patch('/accreditation')
168+
async updateAccreditation(
169+
@Req() { user }: AuthenticatedRequest,
170+
@Body() data: string[],
171+
) {
172+
return await this.companyService.updateAccreditation(user.id, data);
173+
}
174+
165175
@UseGuards(SponsorGuard)
166176
@ApiBearerAuth()
167177
@ApiConsumes('multipart/form-data')

apps/api/src/company/company.service.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,15 @@ export class CompanyService {
4141

4242
async getAllPublic(): Promise<CompanyPublicDto[]> {
4343
const companies = await this.prisma.company.findMany({
44-
include: {
44+
select: {
45+
id: true,
46+
name: true,
47+
username: true,
4548
booth: {
4649
select: { name: true },
4750
},
51+
password: false,
52+
campfireParticipation: true,
4853
},
4954
orderBy: { name: 'asc' },
5055
});
@@ -336,6 +341,20 @@ export class CompanyService {
336341
return updatedCompany;
337342
}
338343

344+
async updateAccreditation(
345+
companyId: number,
346+
data: string[],
347+
): Promise<CompanyPublicDto> {
348+
const updatedCompany = await this.prisma.company.update({
349+
where: { id: companyId },
350+
data: {
351+
peopleForAccreditation: data,
352+
},
353+
});
354+
355+
return updatedCompany;
356+
}
357+
339358
async updateLandingImage(
340359
id: number,
341360
file: Express.Multer.File,
@@ -527,6 +546,7 @@ export class CompanyService {
527546
id: company.id,
528547
category: null,
529548
name: company.name,
549+
username: company.username,
530550
description: null,
531551
opportunitiesDescription: null,
532552
websiteUrl: null,
@@ -546,6 +566,7 @@ export class CompanyService {
546566
})),
547567
jobs: null,
548568
averageRating: null,
569+
campfireParticipation: company.campfireParticipation,
549570
}));
550571
}
551572
}

apps/api/src/event/event.service.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,13 @@ export class EventService {
9696
select: {
9797
id: true,
9898
name: true,
99+
username: true,
99100
category: true,
100101
websiteUrl: true,
101102
instagramUrl: true,
102103
linkedinUrl: true,
103104
logoImage: true,
105+
campfireParticipation: true,
104106
},
105107
},
106108
},
@@ -158,11 +160,13 @@ export class EventService {
158160
select: {
159161
id: true,
160162
name: true,
163+
username: true,
161164
category: true,
162165
websiteUrl: true,
163166
instagramUrl: true,
164167
linkedinUrl: true,
165168
logoImage: true,
169+
campfireParticipation: true,
166170
},
167171
},
168172
},
@@ -478,11 +482,13 @@ export class EventService {
478482
select: {
479483
id: true,
480484
name: true,
485+
username: true,
481486
category: true,
482487
websiteUrl: true,
483488
instagramUrl: true,
484489
linkedinUrl: true,
485490
logoImage: true,
491+
campfireParticipation: true,
486492
},
487493
},
488494
},

apps/api/src/speaker/speaker.service.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@ export class SpeakerService {
5151
select: {
5252
id: true,
5353
name: true,
54+
username: true,
5455
category: true,
5556
websiteUrl: true,
5657
instagramUrl: true,
5758
linkedinUrl: true,
59+
campfireParticipation: true,
5860
},
5961
},
6062
},

apps/api/src/user/user.controller.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
UseGuards,
1717
} from '@nestjs/common';
1818
import { AdminGuard } from 'src/auth/admin.guard';
19+
import { SponsorGuard } from 'src/auth/sponsor.guard';
1920
import { UserGuard } from 'src/auth/user.guard';
2021

2122
import { UserModifyDto } from './user.dto';
@@ -92,6 +93,14 @@ export class UserController {
9293
return await this.userService.createUserForAccreditation(dto);
9394
}
9495

96+
@UseGuards(SponsorGuard)
97+
@Post('company-employee')
98+
async createCompanyEmployeeForAccreditation(
99+
@Body() dto: UserCreateForAccreditationDto,
100+
): Promise<Partial<UserPublicDto>> {
101+
return await this.userService.createUserForAccreditation(dto);
102+
}
103+
95104
@UseGuards(AdminGuard)
96105
@Patch(':id')
97106
async updateUserForAccreditation(

apps/app/src/pages/Home/events.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const events: EventWithSpeakerDto[] = [
3333
id: 1,
3434
category: CompanyCategory.GOLD,
3535
name: 'Tech Co.',
36+
username: 'Tech Co.',
3637
description:
3738
'A leading tech company specializing in web development.',
3839
opportunitiesDescription: 'We offer great growth opportunities.',
@@ -64,6 +65,7 @@ export const events: EventWithSpeakerDto[] = [
6465
companyId: 1,
6566
},
6667
],
68+
campfireParticipation: false,
6769
},
6870
},
6971
],
@@ -95,6 +97,7 @@ export const events: EventWithSpeakerDto[] = [
9597
id: 1,
9698
category: CompanyCategory.GOLD,
9799
name: 'Tech Co.',
100+
username: 'Tech Co.',
98101
description:
99102
'A leading tech company specializing in web development.',
100103
opportunitiesDescription: 'We offer great growth opportunities.',
@@ -126,6 +129,7 @@ export const events: EventWithSpeakerDto[] = [
126129
companyId: 1,
127130
},
128131
],
132+
campfireParticipation: false,
129133
},
130134
},
131135
],
@@ -157,6 +161,7 @@ export const events: EventWithSpeakerDto[] = [
157161
id: 1,
158162
category: CompanyCategory.GOLD,
159163
name: 'Tech Co.',
164+
username: 'Tech Co.',
160165
description:
161166
'A leading tech company specializing in web development.',
162167
opportunitiesDescription: 'We offer great growth opportunities.',
@@ -188,6 +193,7 @@ export const events: EventWithSpeakerDto[] = [
188193
companyId: 1,
189194
},
190195
],
196+
campfireParticipation: false,
191197
},
192198
},
193199
],
@@ -219,6 +225,7 @@ export const events: EventWithSpeakerDto[] = [
219225
id: 1,
220226
category: CompanyCategory.GOLD,
221227
name: 'Tech Co.',
228+
username: 'Tech Co.',
222229
description:
223230
'A leading tech company specializing in web development.',
224231
opportunitiesDescription: 'We offer great growth opportunities.',
@@ -250,6 +257,7 @@ export const events: EventWithSpeakerDto[] = [
250257
companyId: 1,
251258
},
252259
],
260+
campfireParticipation: false,
253261
},
254262
},
255263
],

apps/app/src/pages/ProfileRecommendationsPage/EventsSection/events.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const events: EventWithSpeakerDto[] = [
3333
id: 1,
3434
category: CompanyCategory.GOLD,
3535
name: 'Tech Co.',
36+
username: 'Tech Co.',
3637
description:
3738
'A leading tech company specializing in web development.',
3839
opportunitiesDescription: 'We offer great growth opportunities.',
@@ -64,6 +65,7 @@ export const events: EventWithSpeakerDto[] = [
6465
companyId: 1,
6566
},
6667
],
68+
campfireParticipation: false,
6769
},
6870
},
6971
],
@@ -95,6 +97,7 @@ export const events: EventWithSpeakerDto[] = [
9597
id: 1,
9698
category: CompanyCategory.GOLD,
9799
name: 'Tech Co.',
100+
username: 'Tech Co.',
98101
description:
99102
'A leading tech company specializing in web development.',
100103
opportunitiesDescription: 'We offer great growth opportunities.',
@@ -126,6 +129,7 @@ export const events: EventWithSpeakerDto[] = [
126129
companyId: 1,
127130
},
128131
],
132+
campfireParticipation: false,
129133
},
130134
},
131135
],
@@ -157,6 +161,7 @@ export const events: EventWithSpeakerDto[] = [
157161
id: 1,
158162
category: CompanyCategory.GOLD,
159163
name: 'Tech Co.',
164+
username: 'Tech Co.',
160165
description:
161166
'A leading tech company specializing in web development.',
162167
opportunitiesDescription: 'We offer great growth opportunities.',
@@ -188,6 +193,7 @@ export const events: EventWithSpeakerDto[] = [
188193
companyId: 1,
189194
},
190195
],
196+
campfireParticipation: false,
191197
},
192198
},
193199
],
@@ -219,6 +225,7 @@ export const events: EventWithSpeakerDto[] = [
219225
id: 1,
220226
category: CompanyCategory.GOLD,
221227
name: 'Tech Co.',
228+
username: 'Tech Co.',
222229
description:
223230
'A leading tech company specializing in web development.',
224231
opportunitiesDescription: 'We offer great growth opportunities.',
@@ -250,6 +257,7 @@ export const events: EventWithSpeakerDto[] = [
250257
companyId: 1,
251258
},
252259
],
260+
campfireParticipation: false,
253261
},
254262
},
255263
],

0 commit comments

Comments
 (0)