Car example

This commit is contained in:
thosakwe 2017-09-15 16:05:03 -04:00
parent d12c334c03
commit ff3e3b535b

View file

@ -0,0 +1,18 @@
import 'dart:async';
import 'package:angel_framework/angel_framework.dart';
import 'package:postgres/postgres.dart';
import '../models/car.dart';
import '../models/car.orm.g.dart';
@Expose('/api/cars')
class CarController extends Controller {
@Expose('/luxury')
Stream<Car> getLuxuryCars(PostgreSQLConnection connection) {
var query = new CarQuery();
query.where
..familyFriendly.equals(false)
..createdAt.year.greaterThanOrEqualTo(2014)
..make.isIn(['Ferrari', 'Lamborghini', 'Mustang', 'Lexus']);
return query.get(connection);
}
}