diff --git a/apps/api/db/schema.ts b/apps/api/db/schema.ts index 2e1a2f2e..36e601a8 100644 --- a/apps/api/db/schema.ts +++ b/apps/api/db/schema.ts @@ -84,6 +84,7 @@ export const company = pgTable('company', { name: text('name').notNull(), username: text('username').unique().notNull(), description: text('description'), + opportunitiesDescription: text('opportunities_description'), website: text('website_url'), boothLocation: text('booth_location'), logoImage: text('logo_image'), diff --git a/apps/api/src/company/company.controller.ts b/apps/api/src/company/company.controller.ts index da332701..fb825758 100644 --- a/apps/api/src/company/company.controller.ts +++ b/apps/api/src/company/company.controller.ts @@ -84,9 +84,9 @@ export class CompanyController { @Patch('/description') async updateDescription( @Req() { user }: AuthenticatedRequest, - @Body() { description }: CompanyModifyDescriptionDto, + @Body() data: CompanyModifyDescriptionDto, ) { - return await this.companyService.updateDescription(user.id, description); + return await this.companyService.updateDescription(user.id, data); } @UseGuards(SponsorGuard) diff --git a/apps/api/src/company/company.service.ts b/apps/api/src/company/company.service.ts index 2a7eea81..7dce845e 100644 --- a/apps/api/src/company/company.service.ts +++ b/apps/api/src/company/company.service.ts @@ -1,5 +1,6 @@ import { CompanyDto, + CompanyModifyDescriptionDto, CompanyModifyDto, CompanyPublicDto, } from '@ddays-app/types'; @@ -43,6 +44,7 @@ export class CompanyService { category: company.category, name: company.name, description: company.description, + opportunitiesDescription: company.opportunitiesDescription, website: company.website, boothLocation: company.boothLocation, logoImage: company.logoImage, @@ -77,6 +79,7 @@ export class CompanyService { category: company.category, name: company.name, description: company.description, + opportunitiesDescription: company.opportunitiesDescription, website: company.website, boothLocation: company.boothLocation, logoImage: company.logoImage, @@ -156,12 +159,13 @@ export class CompanyService { async updateDescription( companyId: number, - description: string, + data: CompanyModifyDescriptionDto, ): Promise { const [updatedCompany] = await db .update(company) .set({ - description, + description: data.description, + opportunitiesDescription: data.opportunitiesDescription, }) .where(eq(company.id, companyId)) .returning({ @@ -169,6 +173,7 @@ export class CompanyService { category: company.category, name: company.name, description: company.description, + opportunitiesDescription: company.opportunitiesDescription, website: company.website, boothLocation: company.boothLocation, logoImage: company.logoImage, @@ -200,6 +205,7 @@ export class CompanyService { category: company.category, name: company.name, description: company.description, + opportunitiesDescription: company.opportunitiesDescription, website: company.website, boothLocation: company.boothLocation, logoImage: company.logoImage, @@ -231,6 +237,7 @@ export class CompanyService { category: company.category, name: company.name, description: company.description, + opportunitiesDescription: company.opportunitiesDescription, website: company.website, boothLocation: company.boothLocation, logoImage: company.logoImage, @@ -262,6 +269,7 @@ export class CompanyService { category: company.category, name: company.name, description: company.description, + opportunitiesDescription: company.opportunitiesDescription, website: company.website, boothLocation: company.boothLocation, logoImage: company.logoImage, diff --git a/apps/sponsor/src/constants/forms.ts b/apps/sponsor/src/constants/forms.ts index 9b096fd9..0dae0527 100644 --- a/apps/sponsor/src/constants/forms.ts +++ b/apps/sponsor/src/constants/forms.ts @@ -1,3 +1,5 @@ +import { CompanyCategory } from '@ddays-app/types'; + import { Description } from '../formSteps/Description'; import { InterestPicker } from '../formSteps/InterestPicker'; import { Job } from '../formSteps/Job/Job'; @@ -21,6 +23,7 @@ export const sponsorForm: SponsorForm = { title: 'Fotografije tvrtke', description: 'Predaja do x x', component: PhotoUpload, + tier: [CompanyCategory.Gold], }, [FormSteps.Videos]: { title: 'Videozapis tvrtke', diff --git a/apps/sponsor/src/formSteps/Description/Description.tsx b/apps/sponsor/src/formSteps/Description/Description.tsx index 45036cf2..45eb2d60 100644 --- a/apps/sponsor/src/formSteps/Description/Description.tsx +++ b/apps/sponsor/src/formSteps/Description/Description.tsx @@ -1,3 +1,4 @@ +import { CompanyCategory } from '@ddays-app/types'; import { useState } from 'react'; import { useCompanyGetCurrentPublic } from '../../api/company/useCompanyGetCurrentPublic'; @@ -8,21 +9,25 @@ import c from './Description.module.scss'; export const Description: FormComponent = ({ close }) => { const [description, setDescription] = useState(); + const [opportunitiesDescription, setOpportunitiesDescription] = + useState(); - const { data, error, isLoading } = useCompanyGetCurrentPublic(); + const { data: company, error, isLoading } = useCompanyGetCurrentPublic(); const updateDescription = useCompanyUpdateDescription(); if (error) { return
{error.toString()}
; } - if (isLoading || !data) { + if (isLoading || !company) { return
Loading...
; } const handleSubmit = async () => { await updateDescription.mutateAsync({ - description: description ?? data.description ?? '', + description: description ?? company.description ?? '', + opportunitiesDescription: + opportunitiesDescription ?? company.opportunitiesDescription ?? '', }); close(); }; @@ -37,14 +42,28 @@ export const Description: FormComponent = ({ close }) => {