2017-09-15 20:05:03 +00:00
|
|
|
import 'dart:async';
|
|
|
|
import 'package:angel_framework/angel_framework.dart';
|
2018-12-03 13:41:14 +00:00
|
|
|
import 'package:angel_orm/angel_orm.dart';
|
2019-04-08 16:58:41 +00:00
|
|
|
import 'package:angel_orm_test/src/models/car.dart';
|
2017-09-15 20:05:03 +00:00
|
|
|
|
|
|
|
@Expose('/api/cars')
|
|
|
|
class CarController extends Controller {
|
|
|
|
@Expose('/luxury')
|
2018-12-03 13:41:14 +00:00
|
|
|
Future<List<Car>> getLuxuryCars(QueryExecutor connection) {
|
2017-09-15 20:05:03 +00:00
|
|
|
var query = new CarQuery();
|
|
|
|
query.where
|
|
|
|
..familyFriendly.equals(false)
|
|
|
|
..createdAt.year.greaterThanOrEqualTo(2014)
|
|
|
|
..make.isIn(['Ferrari', 'Lamborghini', 'Mustang', 'Lexus']);
|
|
|
|
return query.get(connection);
|
|
|
|
}
|
|
|
|
}
|