-
Andri Joos authored
(one commit, the api endpoints were broken after user was combined and the api endpoints needed to be rewritten anyways, so no point in fixing stuff that is going to be deleted)
b312a4b7
schedule.dart 796 B
import 'package:lib/lib.dart';
class ScheduleApiEndpoint extends ApiEndpoint {
static const String path = "/";
final String trigger;
ScheduleApiEndpoint({required this.trigger});
@override
Future<Map<String, dynamic>> handleDelete(context) {
throw ApiActionForbiddenException("DELETE", path);
}
@override
Future<Map<String, dynamic>> handleGet(context) {
throw ApiActionForbiddenException("GET", path);
}
@override
Future<Map<String, dynamic>> handlePost(context) async {
if(trigger != "schedule") {
throw ApiActionForbiddenException("POST", path);
}
return context.res.send(DateTime.now().toIso8601String());
}
@override
Future<Map<String, dynamic>> handlePut(context) {
throw ApiActionForbiddenException("PUT", path);
}
}