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 }) => {
+ {company.category === CompanyCategory.Gold && (
+
+
+ )}
diff --git a/apps/sponsor/src/formSteps/Job/Job.tsx b/apps/sponsor/src/formSteps/Job/Job.tsx
index 10e27a0b..38982fda 100644
--- a/apps/sponsor/src/formSteps/Job/Job.tsx
+++ b/apps/sponsor/src/formSteps/Job/Job.tsx
@@ -1,4 +1,4 @@
-import { JobModifyForCompanyDto } from '@ddays-app/types';
+import { CompanyCategory, JobModifyForCompanyDto } from '@ddays-app/types';
import clsx from 'clsx';
import { useEffect, useState } from 'react';
@@ -10,6 +10,19 @@ import { TextArea } from '../../components/TextArea';
import { FormComponent } from '../../types/form';
import c from './Job.module.scss';
+const getMaxJobsPerTier = (category: CompanyCategory) => {
+ switch (category) {
+ case CompanyCategory.Bronze:
+ return 1;
+ case CompanyCategory.Silver:
+ return 3;
+ case CompanyCategory.Gold:
+ return 3;
+ default:
+ return 0;
+ }
+};
+
export const Job: FormComponent = ({ close }) => {
const [jobs, setJobs] = useState([]);
@@ -122,7 +135,8 @@ export const Job: FormComponent = ({ close }) => {
- {jobs.length < 3 && (
+ {jobs.length <
+ getMaxJobsPerTier(company?.category as CompanyCategory) && (
diff --git a/apps/sponsor/src/pages/CompanyProfile/CompanyProfile.module.scss b/apps/sponsor/src/pages/CompanyProfile/CompanyProfile.module.scss
index 6654bb97..6d9ef0d6 100644
--- a/apps/sponsor/src/pages/CompanyProfile/CompanyProfile.module.scss
+++ b/apps/sponsor/src/pages/CompanyProfile/CompanyProfile.module.scss
@@ -100,6 +100,9 @@ h3 {
font-weight: 400;
size: 14px;
color: rgba(255, 255, 255, 0.5);
+ display: flex;
+ flex-direction: column;
+ gap: 24px;
}
.pillGroup {
diff --git a/apps/sponsor/src/pages/CompanyProfile/CompanyProfile.tsx b/apps/sponsor/src/pages/CompanyProfile/CompanyProfile.tsx
index 144d2267..94bee3b2 100644
--- a/apps/sponsor/src/pages/CompanyProfile/CompanyProfile.tsx
+++ b/apps/sponsor/src/pages/CompanyProfile/CompanyProfile.tsx
@@ -126,9 +126,12 @@ export const CompanyProfile = () => {
title='Uvod'
buttonText='Dodajte svoje kratko predstavljanje'
onClick={() => setCurrentModal(FormSteps.Description)}>
-
- {company?.description || 'Nema opisa'}
-
+
+
{company?.description || 'Nema opisa'}
+ {company?.opportunitiesDescription && (
+
{company.opportunitiesDescription}
+ )}
+
{
//[FormSteps.SwagBag]: false,
};
+ if (!company) return null;
+
return (
<>
@@ -58,8 +61,13 @@ export const MaterialsPage: React.FC = () => {
- {Object.entries(sponsorForm).map(
- ([key, { description, title }], index) => (
+ {Object.entries(sponsorForm)
+ .filter(
+ ([, fs]) =>
+ !fs.tier ||
+ fs.tier.includes(company.category as CompanyCategory),
+ )
+ .map(([key, { description, title }], index) => (
{
@@ -84,8 +92,7 @@ export const MaterialsPage: React.FC = () => {
- ),
- )}
+ ))}
{currentForm && (