Skip to content

Commit

Permalink
minor: fixes of unused imports, wrong imports, renaming dto stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
rubvalave committed Apr 26, 2022
1 parent 4fa4bd3 commit 12ed10a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class PublishProjectDto {

@IsOptional()
@ApiPropertyOptional()
scenarioId?: string;
featuredScenarioId?: string;

@ApiProperty()
@ValidateNested({ each: true })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
Creator,
Resource,
} from '../dto/create-published-project.dto';
import { string } from 'fp-ts';

@Entity('published_projects')
export class PublishedProject {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { PublishProjectDto } from './dto/publish-project.dto';
import { WebshotService } from '@marxan/webshot';
import { AppConfig } from '@marxan-api/utils/config.utils';
import { assertDefined } from '@marxan/utils';
import { isLeft, isRight } from 'fp-ts/lib/These';
import { isLeft, isRight } from 'fp-ts/lib/Either';

export const notFound = Symbol(`project not found`);
export const accessDenied = Symbol(`not allowed`);
Expand Down Expand Up @@ -72,11 +72,17 @@ export class PublishedProjectService {

const webshotUrl = AppConfig.get('webshot.url') as string;

const { scenarioId, config, ...projectWithoutScenario } = projectToPublish;
assertDefined(scenarioId);
const {
featuredScenarioId,
config,
...projectWithoutScenario
} = projectToPublish;

assertDefined(featuredScenarioId);
assertDefined(config);

const pngData = await this.webshotService.getPublishedProjectsImage(
scenarioId,
featuredScenarioId,
id,
{
...config,
Expand Down
2 changes: 1 addition & 1 deletion api/apps/api/test/project/projects.fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ export const getFixtures = async () => {
creators: [{ displayName: 'fake name', avatarDataUrl: blmImageMock }],
resources: [{ title: 'fake url', url: 'http://www.example.com' }],
config: { baseUrl: 'example/png', cookie: 'randomCookie' },
scenarioId,
featuredScenarioId: scenarioId,
})
.set('Authorization', `Bearer ${randomUserToken}`),
WhenUnpublishingAProjectAsProjectOwner: async (projectId: string) =>
Expand Down

0 comments on commit 12ed10a

Please sign in to comment.