Comments (9)
Same here, version 3.2.0
from crud.
@dolphub yeah, you should name your service as
service
here is the example: https://github.com/nestjsx/crud/blob/master/integration/typeorm/src/companies/companies.controller.ts#L23
Worked for me.
P.S: The url of example has changed.
https://github.com/nestjsx/crud/blob/master/integration/crud-typeorm/companies/companies.controller.ts#L32
from crud.
@dolphub yeah, you should name your service as service
here is the example: https://github.com/nestjsx/crud/blob/master/integration/typeorm/src/companies/companies.controller.ts#L23
from crud.
@zMotivat0r Thanks for the fix, I am able to create / fetch (simple testing).
I still am not sure why the order of imports fails it,
I actually pulled down the example you're referring to in the docs, but am unable to actually get it to run out of the box. Says CrudOptions
is has invalid types. Both options
and params
don't exist on the type definition of CrudOptions following through the Crud
definition.
I pulled down the repo down actually to see if the swagger docs contained the model information and how it was configured.
Is there a tag or branch somewhere where I can see a working example?
from crud.
@dolphub sorry, I've updated dependencies in the integration. Please pull and try again
from crud.
Hi @zMotivat0r,
I can confirm this issue (and my service is named service
like it is shown in the documentation).
Works
import { Controller, Inject } from '@nestjs/common';
import { LabelEntity } from '../entities/label.entity';
import { LabelsService } from '../services/labels.service';
import { Crud } from '@nestjsx/crud';
@Crud(LabelEntity)
@Controller('labels')
export class LabelsController {
@Inject(LabelsService)
private service: LabelsService;
}
Doesn't work
import { Controller, Inject } from '@nestjs/common';
import { Crud } from '@nestjsx/crud';
import { LabelEntity } from '../entities/label.entity';
import { LabelsService } from '../services/labels.service';
@Crud(LabelEntity)
@Controller('labels')
export class LabelsController {
@Inject(LabelsService)
private service: LabelsService;
}
Here is the raised error (triggered during tests):
TypeError: typeorm_1.Entity is not a function
1 | import { PrimaryGeneratedColumn, Entity, Column } from 'typeorm';
2 |
> 3 | @Entity()
| ^
4 | export class LabelEntity {
5 | @PrimaryGeneratedColumn()
6 | id: number;
at Object.<anonymous> (annotations/entities/label.entity.ts:3:2)
at Object.<anonymous> (annotations/controllers/labels.controller.ts:3:1)
at Object.<anonymous> (annotations/controllers/labels.controller.spec.ts:2:1)
from crud.
Same on 3.1.0
from crud.
I have a feeling its related to tslib
and maybe jest stuff
Code from typeorm index.js:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
// ...
tslib_1.__exportStar(require("./decorator/entity/Entity"), exports);
tslib_1.__exportStar(require("./decorator/entity/ChildEntity"), exports);
tslib_1.__exportStar(require("./decorator/entity/TableInheritance"), exports);
// ....
Code from crud index:
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./decorators"));
__export(require("./dto"));
__export(require("./constants"));
__export(require("./enums"));
__export(require("./module"));
//# sourceMappingURL=index.js.map
from crud.
@jakobrosenberg @avatsaev @fwoelffel are you guys still having this issue with version 4?
from crud.
Related Issues (20)
- Array text fields : QueryFailedError when using CondOperator.CONTAINS
- Just wanted to say fuck Ukraine HOT 2
- Exclude 'createManyBase' is not working
- listing soft deleted items in crud generator
- How to list soft deleted data when using crud generator HOT 2
- allow mapping uuid to id field
- id's are returned as array of two instead of one numeric value HOT 5
- Duplicate column name (ER_DUP_FIELDNAME errno: 1060) when join table HOT 5
- using $or in ?s ignores auth filter HOT 2
- Rest api with xml request and response body HOT 1
- How get custom DTO type in TypeOrmCrudService?
- Mysql with Post and user one to may relation issue
- Queries are returning a duplicated id element inside an Array HOT 2
- Database JSON column and query WHERE support
- nestjs 10 removed misspelled CUSTOM_ROUTE_ARGS_METADATA HOT 4
- Is this open source maintained? HOT 7
- Cannot destructure property 'parsed' of 'req' as it is null. HOT 9
- ERROR [ExceptionsHandler] Cannot read properties of null (reading 'options') HOT 9
- error Command "bootstrap" not found HOT 2
- access to Query Params from custom endpoint
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crud.