class-transformer#Expose TypeScript Examples

The following examples show how to use class-transformer#Expose. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: User.ts    From gobarber-api with MIT License 6 votes vote down vote up
@Expose({ name: 'avatar_url' })
  getAvatarUrl(): string | null {
    if (!this.avatar) {
      return null;
    }

    switch (uploadConfig.driver) {
      case 'disk':
        return `${process.env.APP_API_URL}/files/${this.avatar}`;
      case 's3':
        return `https://${uploadConfig.config.aws.bucket}.s3.amazonaws.com/${this.avatar}`;
      default:
        return null;
    }
  }
Example #2
Source File: User.ts    From GoBarber with MIT License 6 votes vote down vote up
@Expose({ name: 'avatar_url' })
  getAvatarUrl(): string | null {
    if (!this.avatar) return null;
    switch (storageConfig.driver) {
      case 'disk':
        return `${APP_API_URL}/files/${this.avatar}`;
      case 's3':
        return `https://${AWS_S3_BUCKET}.s3.amazonaws.com/${this.avatar}`;
      default:
        return null;
    }
  }
Example #3
Source File: metatype_relationship_pair.ts    From Deep-Lynx with MIT License 6 votes vote down vote up
@MetatypeRelationshipID({
        message: 'Metatype Relationship must have valid ID',
    })
    @Expose({name: 'relationship_id', toClassOnly: true})
    @Transform(
        ({value}) => {
            const relationship = plainToClass(MetatypeRelationship, {});
            relationship.id = value;
            return relationship;
        },
        {toClassOnly: true},
    )
    relationship: MetatypeRelationship | undefined;
Example #4
Source File: helper_classes.ts    From SFDX-Data-Move-Utility-Desktop-App with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Expose()
export class ForceOrgListCommandResponse {

    @Expose()
    status: number;

    @Expose()
    result: ForceOrgListCommandResponseBody;
}
Example #5
Source File: sample-model.ts    From cloudformation-cli-typescript-plugin with Apache License 2.0 6 votes vote down vote up
@Expose({ name: 'ListListAny' })
    @Transform(
        (value, obj) =>
            transformValue(Object, 'listListAny', value, obj, [Array, Array]),
        {
            toClassOnly: true,
        }
    )
    listListAny?: Optional<Array<Array<object>>>;
Example #6
Source File: helper_classes.ts    From SFDX-Data-Move-Utility-Desktop-App with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Expose()
export class ForceOrgListCommandResponseBody {

    @Expose()
    @Type(() => ForceOrgListResult)
    nonScratchOrgs: ForceOrgListResult[];

    @Expose()
    @Type(() => ForceOrgListResult)
    scratchOrgs: ForceOrgListResult[];
}
Example #7
Source File: sample-model.ts    From cloudformation-cli-typescript-plugin with Apache License 2.0 6 votes vote down vote up
@Expose({ name: 'ListListInt' })
    @Transform(
        (value, obj) =>
            transformValue(Integer, 'listListInt', value, obj, [Array, Array]),
        {
            toClassOnly: true,
        }
    )
    listListInt?: Optional<Array<Array<integer>>>;
Example #8
Source File: helper_classes.ts    From SFDX-Data-Move-Utility-Desktop-App with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Expose()
export class ForceOrgListResult {

    @Expose()
    orgId: string;

    @Expose()
    instanceUrl: string;

    @Expose()
    loginUrl: string;

    @Expose()
    username: string;

    @Expose()
    clientId: string;

    @Expose()
    connectedStatus: string;

    @Expose()
    alias?: string;

    isScratchOrg: boolean = false;

    get isConnected(): boolean {
        return this.connectedStatus == "Connected";
    }

}
Example #9
Source File: stage.dto.ts    From codeclannigeria-backend with MIT License 5 votes vote down vote up
@Expose()
  @Min(0)
  @IsInt()
  level: number;
Example #10
Source File: helper_classes.ts    From SFDX-Data-Move-Utility-Desktop-App with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Expose()
    orgId: string;
Example #11
Source File: author-output.dto.ts    From nestjs-starter-rest-api with MIT License 5 votes vote down vote up
@Expose()
  @ApiProperty()
  name: string;
Example #12
Source File: lbsqq.model.ts    From life-helper-backend with MIT License 5 votes vote down vote up
/** 市 */
  @Expose()
  city?: string
Example #13
Source File: helper_classes.ts    From SFDX-Data-Move-Utility-Desktop-App with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Expose()
    clientId: string;
Example #14
Source File: calendar.dto.ts    From life-helper-backend with MIT License 5 votes vote down vote up
@Expose()
  id: number
Example #15
Source File: article-output.dto.ts    From nestjs-starter-rest-api with MIT License 5 votes vote down vote up
@Expose()
  @ApiProperty()
  title: string;
Example #16
Source File: weather-city.dto.ts    From life-helper-backend with MIT License 5 votes vote down vote up
/** 主键 ID */
  @Expose()
  id: number