-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of github.com:Vizzuality/marxan-cloud into fix…
…/custom-grid-texts-layer
- Loading branch information
Showing
55 changed files
with
1,311 additions
and
307 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
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
22 changes: 22 additions & 0 deletions
22
api/apps/api/src/migrations/api/1634209362000-AddCascadeToFeaturesFKs.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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class AddCascadeToFeaturesFKs1634209362000 | ||
implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(` | ||
ALTER TABLE public.features DROP CONSTRAINT features_project_id_fkey; | ||
ALTER TABLE public.features DROP CONSTRAINT features_created_by_fkey; | ||
ALTER TABLE public.features ADD CONSTRAINT features_project_id_fkey FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE; | ||
ALTER TABLE public.features ADD CONSTRAINT features_created_by_fkey FOREIGN KEY (created_by) REFERENCES users(id) ON DELETE SET NULL; | ||
`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(` | ||
ALTER TABLE public.features DROP CONSTRAINT features_project_id_fkey; | ||
ALTER TABLE public.features DROP CONSTRAINT features_created_by_fkey; | ||
ALTER TABLE public.features ADD CONSTRAINT features_project_id_fkey FOREIGN KEY (project_id) REFERENCES projects(id); | ||
ALTER TABLE public.features ADD CONSTRAINT features_created_by_fkey FOREIGN KEY (created_by) REFERENCES users(id); | ||
`); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
api/apps/api/src/migrations/api/1634807093754-AddPublishedProjectsTable.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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class AddPublishedProjectsTable1634807093754 | ||
implements MigrationInterface { | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`CREATE TABLE "published_projects" | ||
( | ||
"id" uuid NOT NULL, | ||
"name" character varying NOT NULL, | ||
"description" text, | ||
CONSTRAINT "REL_50b117f602b62155ceacac2fde" UNIQUE ("id"), | ||
CONSTRAINT "PK_50b117f602b62155ceacac2fde3" PRIMARY KEY ("id") | ||
)`); | ||
await queryRunner.query(`ALTER TABLE "published_projects" | ||
ADD CONSTRAINT "published_projects_id_fkey" FOREIGN KEY ("id") REFERENCES "projects" ("id") ON DELETE CASCADE ON UPDATE NO ACTION`); | ||
await queryRunner.query(`ALTER TABLE "projects" DROP COLUMN "is_public"`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`ALTER TABLE "published_projects" DROP CONSTRAINT "published_projects_id_fkey"`, | ||
); | ||
await queryRunner.query(`DROP TABLE "published_projects"`); | ||
await queryRunner.query(`ALTER TABLE "projects" | ||
ADD "is_public" boolean NOT NULL DEFAULT false`); | ||
} | ||
} |
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
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
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
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
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
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
26 changes: 26 additions & 0 deletions
26
api/apps/api/src/modules/published-project/controllers/publish-project.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Body, Controller, Param, Post, UseGuards } from '@nestjs/common'; | ||
import { PublishedProjectService } from '../published-project.service'; | ||
import { PublishProjectDto } from '../dto/publish-project.dto'; | ||
import { JwtAuthGuard } from '@marxan-api/guards/jwt-auth.guard'; | ||
import { ApiBearerAuth, ApiNoContentResponse, ApiTags } from '@nestjs/swagger'; | ||
import { projectResource } from '@marxan-api/modules/projects/project.api.entity'; | ||
import { apiGlobalPrefixes } from '@marxan-api/api.config'; | ||
|
||
@UseGuards(JwtAuthGuard) | ||
@ApiBearerAuth() | ||
@ApiTags(projectResource.className) | ||
@Controller(`${apiGlobalPrefixes.v1}/projects`) | ||
export class PublishProjectController { | ||
constructor( | ||
private readonly publishedProjectService: PublishedProjectService, | ||
) {} | ||
|
||
@Post(':id/publish') | ||
@ApiNoContentResponse() | ||
async publish( | ||
@Param('id') id: string, | ||
@Body() createPublishedProjectDto: PublishProjectDto, | ||
): Promise<void> { | ||
await this.publishedProjectService.publish(id); | ||
} | ||
} |
Oops, something went wrong.