Skip to content

Commit

Permalink
feat: sponsors front
Browse files Browse the repository at this point in the history
  • Loading branch information
guiseek committed Nov 20, 2021
1 parent 4e0cbb6 commit 285f208
Show file tree
Hide file tree
Showing 48 changed files with 736 additions and 145 deletions.
26 changes: 26 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,32 @@
},
"tags": []
},
"app-feature-sponsors": {
"projectType": "library",
"root": "libs/app/feature-sponsors",
"sourceRoot": "libs/app/feature-sponsors/src",
"prefix": "speak-out",
"architect": {
"test": {
"builder": "@nrwl/jest:jest",
"outputs": ["coverage/libs/app/feature-sponsors"],
"options": {
"jestConfig": "libs/app/feature-sponsors/jest.config.js",
"passWithNoTests": true
}
},
"lint": {
"builder": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": [
"libs/app/feature-sponsors/src/**/*.ts",
"libs/app/feature-sponsors/src/**/*.html"
]
}
}
},
"tags": []
},
"app-feature-talks": {
"projectType": "library",
"root": "libs/app/feature-talks",
Expand Down
11 changes: 11 additions & 0 deletions apps/api/src/features/sponsors/controller/sponsors.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,17 @@ export class SponsorsController {
);
}

@Delete(':id')
@UseGuards(JwtAuthGuard)
@ApiBearerAuth('access-token')
async delete(
@Param('id', ParseObjectIdPipe) id: string
) {
return this.sponsorsService.delete(
await this.sponsorsService.validateSponsorById(id),
);
}

@Post('join')
@UseGuards(JwtAuthGuard)
@ApiBearerAuth('access-token')
Expand Down
48 changes: 33 additions & 15 deletions apps/api/src/features/sponsors/dto/create-sponsor.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,60 +16,78 @@ export class CreateSponsorDto {
})
@IsString()
description: string;

@ApiProperty({
type: String,
required: true,
})
@IsString()
logo: string;

@ApiProperty({
type: String,
required: true,
required: false,
})
@IsString()
slug: string;

@IsUrl()
@IsOptional()
website: string;

@ApiProperty({
type: String,
required: false,
})
@IsString()
color: string;

@IsUrl()
@IsOptional()
youtube: string;

@ApiProperty({
type: String,
required: false,
})
@IsUrl()
@IsOptional()
website: string;
linkedin: string;

@ApiProperty({
type: String,
required: false,
})
@IsUrl()
@IsOptional()
youtube: string;

instagram: string;

@ApiProperty({
type: String,
required: false,
})
@IsUrl()
@IsOptional()
facebook: string;

@ApiProperty({
type: String,
required: false,
})
@IsUrl()
@IsOptional()
twitter: string;

@ApiProperty({
type: String,
required: false,
})
@IsUrl()
@IsOptional()
calendlyUrl: string;

@ApiProperty({
type: String,
required: false,
})
@IsUrl()
@IsOptional()
videoUrl: string;

@ApiProperty({
type: String,
required: false,
Expand Down
88 changes: 62 additions & 26 deletions apps/api/src/features/sponsors/schema/sponsor.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,76 @@ import { Document } from 'mongoose';
@Schema()
export class Sponsor extends Document {
@Prop({
type: String,
required: true,
})
name: string;

@Prop()
@Prop({
type: String,
required: false,
})
description: string;

@Prop()

@Prop({
type: String,
required: true,
})
logo: string;

@Prop()
slug: string;

@Prop()
color: string;

@Prop()

@Prop({
type: String,
required: false,
})
website: string;

@Prop()

@Prop({
type: String,
required: false,
})
youtube: string;

@Prop({
type: String,
required: false,
})
linkedin: string;

@Prop({
type: String,
required: false,
})
instagram: string;

@Prop({
type: String,
required: false,
})
facebook: string;

@Prop({
type: String,
required: false,
})
twitter: string;

@Prop({
type: String,
required: false,
})
calendlyUrl: string;

@Prop({
type: String,
required: false,
})
videoUrl: string;

@Prop({
type: String,
required: false,
})
formUrl: string;

@Prop({
type: [
Expand All @@ -38,19 +87,6 @@ export class Sponsor extends Document {
],
})
members: User[];

// @ApiProperty()
// @Prop({
// type: ObjectId,
// ref: Conf.name,
// })
// conf: Conf;

// @Prop({
// type: ObjectId,
// ref: User.name,
// })
// owner: User;
}

export const SponsorSchema = createSchemaForClassWithMethods(Sponsor);
5 changes: 5 additions & 0 deletions apps/api/src/features/sponsors/service/sponsors.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ export class SponsorsService {
.findOneAndUpdate({ _id: sponsor._id, owner: user._id }, body);
}

async delete(sponsor: Sponsor) {
return this.sponsorModel
.findByIdAndDelete(sponsor._id);
}

handleUpdateSponsor(sponsor: Sponsor, body: Partial<Sponsor>) {
this.sendMessage(sponsor, 'sponsor:update', Object.assign(sponsor, body));
}
Expand Down
1 change: 1 addition & 0 deletions apps/app/src/theming/_custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ body {
}

.mat-toolbar {
gap: 12px;
min-height: 64px;

.mat-button {
Expand Down
Loading

0 comments on commit 285f208

Please sign in to comment.