-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Admin - Extend site edit functionality (#958)
Co-authored-by: Eric Boucher <[email protected]>
- Loading branch information
1 parent
b91e0b2
commit fe25a19
Showing
35 changed files
with
640 additions
and
98 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
packages/api/migration/1702565409448-AddContactInformationColumn.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,19 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class AddContactInformationColumn1702565409448 | ||
implements MigrationInterface | ||
{ | ||
name = 'AddContactInformationColumn1702565409448'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`ALTER TABLE "site" ADD "contact_information" character varying`, | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`ALTER TABLE "site" DROP COLUMN "contact_information"`, | ||
); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,12 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { Type } from 'class-transformer'; | ||
import { | ||
IsEmail, | ||
IsEnum, | ||
IsNumber, | ||
IsOptional, | ||
Validate, | ||
} from 'class-validator'; | ||
import { IsEnum, IsOptional, Validate } from 'class-validator'; | ||
import { Site, SiteStatus } from 'sites/sites.entity'; | ||
import { EntityExists } from 'validations/entity-exists.constraint'; | ||
|
||
export class GetSitesOverview { | ||
export class GetSitesOverviewDto { | ||
@ApiProperty({ example: 42 }) | ||
@IsOptional() | ||
@IsNumber() | ||
@Validate(EntityExists, [Site]) | ||
siteId?: number; | ||
|
||
|
@@ -30,7 +23,6 @@ export class GetSitesOverview { | |
@ApiProperty({ example: '[email protected]' }) | ||
@Type(() => String) | ||
@IsOptional() | ||
@IsEmail() | ||
adminEmail?: string; | ||
|
||
@ApiProperty({ example: 'John Smith' }) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,9 +10,11 @@ import { | |
IsLongitude, | ||
IsObject, | ||
ValidateNested, | ||
IsEnum, | ||
} from 'class-validator'; | ||
import { Type } from 'class-transformer'; | ||
import { Transform, Type } from 'class-transformer'; | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { SiteStatus } from 'sites/sites.entity'; | ||
import { EntityExists } from '../../validations/entity-exists.constraint'; | ||
import { Region } from '../../regions/regions.entity'; | ||
import { User } from '../../users/users.entity'; | ||
|
@@ -49,7 +51,7 @@ export class UpdateSiteDto { | |
|
||
@IsOptional() | ||
@IsUrl() | ||
readonly videoStream?: string; | ||
readonly videoStream?: string | null; | ||
|
||
@ApiProperty({ example: 1 }) | ||
@IsOptional() | ||
|
@@ -82,4 +84,22 @@ export class UpdateSiteDto { | |
@IsNotEmpty() | ||
@MaxLength(100) | ||
readonly spotterApiToken?: string | null; | ||
|
||
@ApiProperty({ example: 'deployed' }) | ||
@IsOptional() | ||
@IsEnum(SiteStatus) | ||
readonly status?: SiteStatus; | ||
|
||
@IsOptional() | ||
@Transform(({ value }) => { | ||
return [true, 'true', 1, '1'].indexOf(value) > -1; | ||
}) | ||
readonly display?: boolean; | ||
|
||
@ApiProperty({ example: 'email: [email protected]' }) | ||
@IsOptional() | ||
@IsString() | ||
@IsNotEmpty() | ||
@MaxLength(100) | ||
readonly contactInformation?: string | null; | ||
} |
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
Oops, something went wrong.