change according to connection from frontend
This commit is contained in:
parent
2609ecc1bf
commit
e3db523a0e
36 changed files with 611 additions and 173 deletions
|
@ -27,11 +27,16 @@ export default abstract class VehicleService {
|
|||
.leftJoinAndSelect("vehicle.vehicleType", "vehicletype");
|
||||
|
||||
if (search != "") {
|
||||
query = query.where({
|
||||
code: Like(search),
|
||||
name: Like(search),
|
||||
location: Like(search),
|
||||
});
|
||||
query = query
|
||||
.where({
|
||||
code: Like(`%${search}%`),
|
||||
})
|
||||
.orWhere({
|
||||
name: Like(`%${search}%`),
|
||||
})
|
||||
.orWhere({
|
||||
location: Like(`%${search}%`),
|
||||
});
|
||||
}
|
||||
|
||||
if (ids.length != 0) {
|
||||
|
|
|
@ -13,26 +13,20 @@ export default abstract class VehicleTypeService {
|
|||
count = 25,
|
||||
search = "",
|
||||
noLimit = false,
|
||||
ids = [],
|
||||
}: {
|
||||
offset?: number;
|
||||
count?: number;
|
||||
search?: string;
|
||||
noLimit?: boolean;
|
||||
ids?: Array<string>;
|
||||
}): Promise<[Array<vehicleType>, number]> {
|
||||
let query = dataSource.getRepository(vehicleType).createQueryBuilder("vehicleType");
|
||||
|
||||
if (search != "") {
|
||||
query = query.where({
|
||||
type: Like(search),
|
||||
type: Like(`%${search}%`),
|
||||
});
|
||||
}
|
||||
|
||||
if (ids.length != 0) {
|
||||
query = query.where({ id: In(ids) });
|
||||
}
|
||||
|
||||
if (!noLimit) {
|
||||
query = query.offset(offset).limit(count);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue