-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: campaign application create contract (#648)
- Loading branch information
Showing
6 changed files
with
123 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 16 additions & 5 deletions
21
apps/api/src/campaign-application/campaign-application.controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 98 additions & 15 deletions
113
apps/api/src/campaign-application/dto/create-campaign-application.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,121 @@ | ||
import { ApiProperty } from '@nestjs/swagger' | ||
import { Prisma } from '@prisma/client' | ||
import { CampaignTypeCategory, Prisma } from '@prisma/client' | ||
import { Expose } from 'class-transformer' | ||
import { IsString } from 'class-validator' | ||
import { IsBoolean, IsOptional, IsString } from 'class-validator' | ||
|
||
@Expose() | ||
export class CreateCampaignApplicationDto { | ||
/** | ||
* What would the campaign be called. ('Help Vesko' or 'Castrate Plovdiv Cats') | ||
*/ | ||
@ApiProperty() | ||
@Expose() | ||
@IsString() | ||
title: string | ||
campaignName: string | ||
|
||
/** user needs to agree to this as a prerequisite to creating a campaign application */ | ||
@ApiProperty() | ||
@Expose() | ||
acceptTermsAndConditions: boolean | ||
@IsBoolean() | ||
acceptTermsAndConditions: true | ||
|
||
/** user needs to agree to this as a prerequisite to creating a campaign application */ | ||
@ApiProperty() | ||
@Expose() | ||
transparencyTermsAccepted: boolean | ||
@IsBoolean() | ||
transparencyTermsAccepted: true | ||
|
||
/** user needs to agree to this as a prerequisite to creating a campaign application */ | ||
@ApiProperty() | ||
@Expose() | ||
personalInformationProcessingAccepted: boolean | ||
@IsBoolean() | ||
personalInformationProcessingAccepted: true | ||
|
||
/** Who is organizing this campaign */ | ||
@ApiProperty() | ||
@Expose() | ||
@IsString() | ||
organizerName: string | ||
|
||
/** Contact Email to use for the Campaign Application process i.e. if more documents or other info are requested */ | ||
@ApiProperty() | ||
@Expose() | ||
@IsString() | ||
organizerEmail: string | ||
|
||
/** Contact Email to use for the Campaign Application process i.e. if more documents or other info are requested */ | ||
@ApiProperty() | ||
@Expose() | ||
@IsString() | ||
organizerPhone: string | ||
|
||
/** Who will benefit and use the collected donations */ | ||
@ApiProperty() | ||
@Expose() | ||
@IsString() | ||
beneficiary: string | ||
|
||
/** What is the relationship between the Organizer and the Beneficiary ('They're my elderly relative and I'm helping with the internet-computer stuff') */ | ||
@ApiProperty() | ||
@Expose() | ||
@IsString() | ||
organizerBeneficiaryRel: string | ||
|
||
/** What is the result that the collected donations will help achieve */ | ||
@ApiProperty() | ||
@Expose() | ||
@IsString() | ||
goal: string | ||
|
||
/** What if anything has been done so far */ | ||
@ApiProperty() | ||
@Expose() | ||
@IsString() | ||
@IsOptional() | ||
history?: string | ||
|
||
/** How much would the campaign be looking for i.e '10000lv or 5000 Eur or $5000' */ | ||
@ApiProperty() | ||
@Expose() | ||
@IsString() | ||
amount: string | ||
|
||
/** Describe the goal of the campaign in more details */ | ||
@ApiProperty() | ||
@Expose() | ||
@IsString() | ||
@IsOptional() | ||
description?: string | ||
|
||
/** Describe public figures that will back the campaign and help popularize it. */ | ||
@ApiProperty() | ||
@Expose() | ||
@IsString() | ||
@IsOptional() | ||
campaignGuarantee?: string | ||
|
||
/** If any - describe what other sources were used to gather funds for the goal */ | ||
@ApiProperty() | ||
@Expose() | ||
@IsString() | ||
@IsOptional() | ||
otherFinanceSources?: string | ||
|
||
/** Anything that the operator needs to know about the campaign */ | ||
@ApiProperty() | ||
@Expose() | ||
@IsString() | ||
@IsOptional() | ||
otherNotes?: string | ||
|
||
@ApiProperty({ enum: CampaignTypeCategory }) | ||
@Expose() | ||
@IsOptional() | ||
category?: CampaignTypeCategory | ||
|
||
public toEntity(): Prisma.CampaignApplicationCreateInput { | ||
return { | ||
campaignName: this.title, | ||
amount: '', | ||
beneficiary: '', | ||
goal: '', | ||
organizerBeneficiaryRel: '', | ||
organizerName: '', | ||
category: 'others', | ||
organizer: { connect: { id: 'id', personId: '' } }, | ||
documents: { connect: [{ id: '1' }] }, | ||
...this, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters