Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vori/nest-schematics

Package Overview
Dependencies
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vori/nest-schematics - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

8

dist/lib/resource/files/ts/__name__.controller.ts

@@ -34,3 +34,3 @@ <% if (crud && type === 'rest') { %>import { Get, Post, Body, Patch, Param, Delete, Req } from '@nestjs/common';

const <%= singular(camelize(name)) %> = await this.<%= lowercased(name) %>Service.create(request.user, create<%= singular(classify(name)) %>Dto);
return <%= singular(classify(name)) %>Dto.from(<%= singular(camelize(name)) %>);
return new <%= singular(classify(name)) %>Dto(<%= singular(camelize(name)) %>);
}

@@ -43,3 +43,3 @@

const <%= camelize(name) %> = await this.<%= lowercased(name) %>Service.findAll(request.user);
return <%= camelize(name) %>.map(<%= singular(classify(name)) %>Dto.from);
return <%= camelize(name) %>.map(<%= singular(camelize(name)) %> => new <%= singular(classify(name)) %>Dto(<%= singular(camelize(name)) %>));
}

@@ -53,3 +53,3 @@

const <%= singular(camelize(name)) %> = await this.<%= lowercased(name) %>Service.findOne(request.user, params.id);
return <%= singular(classify(name)) %>Dto.from(<%= singular(camelize(name)) %>);
return new <%= singular(classify(name)) %>Dto(<%= singular(camelize(name)) %>);
}

@@ -64,3 +64,3 @@

const <%= singular(camelize(name)) %> = await this.<%= lowercased(name) %>Service.update(request.user, params.id, update<%= singular(classify(name)) %>Dto);
return <%= singular(classify(name)) %>Dto.from(<%= singular(camelize(name)) %>);
return new <%= singular(classify(name)) %>Dto(<%= singular(camelize(name)) %>);
}

@@ -67,0 +67,0 @@

@@ -97,3 +97,3 @@ import { INestApplication } from '@nestjs/common';

expect(response.body).toEqual(
instanceToPlain(<%= singular(classify(name)) %>Dto.from(<%= singular(camelize(name)) %>))
instanceToPlain(new <%= singular(classify(name)) %>Dto(<%= singular(camelize(name)) %>))
);

@@ -132,3 +132,3 @@ });

orderBy(<%= camelize(name) %>, 'createdAt', 'desc').map(
<%= singular(classify(name)) %>Dto.from
<%= singular(camelize(name)) %> => new <%= singular(classify(name)) %>Dto(<%= singular(camelize(name)) %>)
)

@@ -165,3 +165,3 @@ );

expect(response.body).toEqual(
instanceToPlain(<%= singular(classify(name)) %>Dto.from(<%= singular(camelize(name)) %>))
instanceToPlain(new <%= singular(classify(name)) %>Dto(<%= singular(camelize(name)) %>))
);

@@ -218,3 +218,3 @@ });

instanceToPlain(
<%= singular(classify(name)) %>Dto.from(reloaded<%= singular(classify(name)) %>)
new <%= singular(classify(name)) %>Dto(reloaded<%= singular(classify(name)) %>)
)

@@ -221,0 +221,0 @@ );

import { faker } from '@faker-js/faker';
import { instanceToPlain } from 'class-transformer';

@@ -13,3 +14,3 @@ import { getDataSource } from '@vori/providers/database';

describe('from', () => {
describe('constructor', () => {
it('converts an entity to a DTO', () => {

@@ -19,3 +20,3 @@ const <%= singular(camelize(name)) %> = make<%= singular(classify(name)) %>({

});
const dto = <%= singular(classify(name)) %>Dto.from(<%= singular(camelize(name)) %>);
const dto = instanceToPlain(new <%= singular(classify(name)) %>Dto(<%= singular(camelize(name)) %>));

@@ -22,0 +23,0 @@ expect(dto).toMatchObject({

<% if (isSwaggerInstalled) { %>import { PartialType } from '@nestjs/swagger';<% } else { %>import { PartialType } from '@nestjs/mapped-types';<% } %>
import { BaseEntityDto } from '@vori/nest/libs/dto';
import { BaseEntityDto } from '@vori/nest/libs/dto/base-entity.dto';
import { <%= classify(singular(name)) %> } from '../entities/<%= singular(name) %>.entity';
export class <%= singular(classify(name)) %>Dto extends BaseEntityDto {
public static from(<%= singular(camelize(name)) %>: <%= singular(classify(name)) %>): <%= singular(classify(name)) %>Dto {
return {
...BaseEntityDto.from(<%= singular(camelize(name)) %>),
};
public constructor(<%= singular(camelize(name)) %>: <%= singular(classify(name)) %>) {
super(<%= singular(camelize(name)) %>);
}

@@ -11,0 +9,0 @@ }

@@ -7,3 +7,3 @@ {

},
"version": "1.0.5",
"version": "1.0.6",
"description": "Nest - modern, fast, powerful node.js web framework (@schematics)",

@@ -10,0 +10,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc