gid-oss / dataui-nestjs-crud Goto Github PK
View Code? Open in Web Editor NEWThis project forked from rewiko/crud
NestJs CRUD for RESTful APIs
Home Page: https://github.com/nestjsx/crud/wiki
License: MIT License
This project forked from rewiko/crud
NestJs CRUD for RESTful APIs
Home Page: https://github.com/nestjsx/crud/wiki
License: MIT License
https://www.npmjs.com/package/@dataui/crud
the links in the npm package description leads to 404 pages
some time we need some endpoint public and some with Auth then how we can handle this
We get this warning in many files, is this some option we could use to fix it or it needs a change in this package?
WARNING in ./node_modules/@dataui/crud-request/lib/interfaces/create-query-params.interface.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'D:\R\project-frontend\node_modules\@dataui\crud-request\src\interfaces\create-query-params.interface.ts' file: Error: ENOENT: no such file or directory, open 'D:\R\project-front
end\node_modules\@dataui\crud-request\src\interfaces\create-query-params.interface.ts'
Thanks
I have two Entities, but I don't know how to implement ManyToMany in Curd
Category Entity
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm"
@Entity()
export class Category {
@PrimaryGeneratedColumn()
id: number
@Column()
name: string
}
Question Entity
import {
Entity,
PrimaryGeneratedColumn,
Column,
ManyToMany,
JoinTable,
} from "typeorm"
import { Category } from "./Category"
@Entity()
export class Question {
@PrimaryGeneratedColumn()
id: number
@Column()
title: string
@Column()
text: string
@ManyToMany(() => Category)
@JoinTable()
categories: Category[]
}
How can I insert, update, find, and delete ManyToMany in Crud?
I haven't found a good solution at the moment🙁
node_modules/@dataui/crud/lib/interfaces/auth-options.interface.d.ts(2,31): error TS2307: Cannot find module '@dataui/crud-util/src' or its corresponding type declarations.
import { SCondition } from '@dataui/crud-request/lib/types/request-query.types';
import { ObjectLiteral } from 'crud-util/src';
export interface AuthGlobalOptions {
property?: string;
}
export interface AuthOptions {
property?: string;
filter?: (req: any) => SCondition | void;
or?: (req: any) => SCondition | void;
persist?: (req: any) => ObjectLiteral;
}
to
import { SCondition } from '@dataui/crud-request/lib/types/request-query.types';
import { ObjectLiteral } from '@dataui/crud-util/lib/types/object-literal.type';
export interface AuthGlobalOptions {
property?: string;
}
export interface AuthOptions {
property?: string;
filter?: (req: any) => SCondition | void;
or?: (req: any) => SCondition | void;
persist?: (req: any) => ObjectLiteral;
}
Any change to add this function by default on CRUD config?
Something like that:
@Crud({
model: {
type: MyModel,
},
routes: {
deleteOneBase: {
softDelete: true,
},
},
})
@Controller('my-models')
export class MyModelController implements CrudController<MyModel> {
constructor(public service: MyModelService) {}
}
Hi.
First of all : thinks you for your fork ! ;-)
Subject :
CrudRequest
object is pass between Controller and Service. But on this object we dont store any context informations as authenticate user for exemple : (this is nice to have auth user object on service (stored on native Request
object))Do you think it's possible to store extra informations on CrudRequest
object and in particular auth. user?
Request
object is not possible : risk of producing strange case with singleton service (switch to Scope=Request by nestJs), but store auth user information seen to be possible.Request
object with nesths-crud configuration auth
. sample configuration ;CrudConfigService.load({
params: {
[...]
},
auth: {
property: 'user',
},
[...]
* CurdRequest interface can became :
export interface CrudRequest {
parsed: ParsedRequestParams;
options: CrudRequestOptions;
auth: any; // according to configuration
extra: any; // any params for business logic
}
First of all, thanks a lot for this fork and for keeping the lib alive, been using it since the guy from original library disappeared. The issue is that npm links to the wrong repo and so finding this one is really hard. The only direct link is in the issues for original lib.
Example of the search parameter (based on seeds)
{ name: { $eq: 'Project1' }, companyId: { $or: { $notnull: true, $eq: 1 } } }
Expectation:
The result is one project with the name Project1
Result:
Received all projects, filter name: { $eq: 'Project1' }
is ignoring
Hello,
all the documentation related links in the readme are broken:
https://github.com/dataui/crud/wiki#why
https://github.com/dataui/crud/wiki/Controllers#description
https://github.com/dataui/crud/wiki/Services#description
https://github.com/dataui/crud/wiki/Requests#description
This is an issue from the original repository but still relevant, so I am reposting the issue here.
Original issue: nestjsx#551
When declaring the filter
option inside of the @Crud()
decorator for a controller it is only working when provided as a static object. When I use the documented QueryFilterFunction
, as described [in the docs (https://github.com/nestjsx/crud/wiki/Controllers#filter), the first parameter is receiving undefined and all filters are ignored.
I need to extend any incoming filters with some persisted filters based on the current date for the records. Using new Date() in the static object generates a matching static date-value and therefore breaks my intent. The solution makes sense to use a factory function to merge the search options, but so long as the incoming ```SCondition```` is empty that is impossible.
I'm using the latest releases for the following libraries.
"@nestjs/typeorm": "~7.1.0",
"@nestjsx/crud": "~4.6.2",
"@nestjsx/crud-typeorm": "~4.6.2",
"typeorm": "~0.2.25"
I am having trouble with the following error.
The version of Typescript seems to be old.
Hey, just wanted to let you know that the npm package refers to incorrect/unknown repository URL (https://github.com/dataui/crud)!
Can you please please add the code of this PR into your package?
We really need to be able to query in an array!
Thanks a lot!
Is there a way to use CrudRequest in a custom endpoint and to have access in Query Params and their functionality? For example to have something like that:
custom endpoint: /something/3/stats?filter[0]=price||$lte||100
@Get('/:id/stats')
async getStatistics(
@Param('id') id:number,
@ParsedRequest() req: CrudRequest
) {
. . .
}
and to have access to these Query Params and the way they works:
or how to extend the functionality that the Query Params have?
When using with deleted from the query builder
.setIncludeDeleted(1)
the relations included via @crud decorator are not being fetched if they have been deleted.
This is because builder.withDeleted(); is being called after the joins are created.
I'm encountering an error when using getMany with joins and pagination. The issue seems to be related to duplicate column names in the query results.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.