-
-
Notifications
You must be signed in to change notification settings - Fork 517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Override decorator doesn't work on base class #21
Comments
The point of creating |
since the lib doesn't support paging right now. so why I need create controller with If someone need override method, setup a route handle before the |
By saying that the lib doesn't support paging right now, what do you particular mean? |
I mean until #16 merged, I need to use {
"list": [
{
"id": 1,
"username": "player1"
}
],
"total": 1,
"pages": 1,
"size": 1,
"pageNum": 1,
"pageSize": 2,
"startRow": 0,
"endRow": 0
} Now I am doing this. export class PageInfo<T> {
pageNum: number;
pageSize: number;
size: number;
startRow: number;
endRow: number;
total: number;
pages: number;
list: T[];
constructor(page: [T[], number], query: RequestParamsParsed) {
const [list, total] = page;
this.list = list;
this.total = total;
this.pages = Math.floor((total - 1) / query.limit) + 1;
this.size = list.length;
const offset = query.offset || (query.page - 1) * query.limit;
this.pageNum = query.page;
this.pageSize = query.limit;
this.startRow = offset;
this.endRow = offset + this.size - 1;
}
}
RepositoryService.prototype.getMany = async function(query: RequestParamsParsed = {}, options: RestfulOptions = {}) {
const builder = await this.buildQuery(query, options);
if (query.page && query.limit) {
const page = await builder.getManyAndCount();
return new PageInfo(page, query);
}
return builder.getMany();
}; so I am finding a common way to override all the |
ok, I got your point. So as I said here I'll do this improvement in the near future. |
I will look forward to it. |
because of this
crud/src/decorators/crud.decorator.ts
Line 96 in e255120
I can't put override method on base controller. It needs be overridden in crud decorated class.
The text was updated successfully, but these errors were encountered: