This repository has been archived on 2022-02-10. You can view files and clone it, but cannot push or open issues or pull requests.
titama-backend/lib/common/messages.dart

58 lines
1 KiB
Dart
Raw Normal View History

2016-06-13 17:13:02 +02:00
library titama.messages;
2016-06-18 23:37:42 +02:00
import 'package:rpc/rpc.dart';
2016-06-13 17:13:02 +02:00
class Course {
2016-06-18 23:37:42 +02:00
@ApiProperty(required: true)
2016-06-13 17:13:02 +02:00
String title;
2016-06-18 23:37:42 +02:00
@ApiProperty(required: true)
2016-06-13 17:13:02 +02:00
String time;
2016-06-18 23:37:42 +02:00
@ApiProperty(required: true)
2016-06-13 17:13:02 +02:00
String day;
2016-06-18 23:37:42 +02:00
@ApiProperty(defaultValue: "")
2016-06-13 17:13:02 +02:00
String kind;
2016-06-18 23:37:42 +02:00
@ApiProperty(defaultValue: "")
2016-06-13 17:13:02 +02:00
String place;
2016-06-18 23:37:42 +02:00
@ApiProperty(defaultValue: "")
2016-06-13 17:13:02 +02:00
String prof;
2016-06-18 23:37:42 +02:00
@ApiProperty(defaultValue: "")
2016-06-13 17:13:02 +02:00
String turnin;
2016-06-18 23:37:42 +02:00
@ApiProperty()
2016-06-13 17:13:02 +02:00
int id;
Course();
2016-06-18 23:40:50 +02:00
String toString() => title.isEmpty ? 'notitle' : title;
2016-06-25 10:42:43 +02:00
Map toJson() {
Map map = new Map();
map["title"] = title;
map["time"] = time;
map["day"] = day;
map["kind"] = kind;
map["place"] = place;
map["prof"] = prof;
map["turnin"] = turnin;
map["id"] = id;
return map;
}
2016-07-17 23:41:24 +02:00
Course.fromJson(Map courseData) {
title = courseData["title"];
time = courseData["time"];
day = courseData["day"];
kind = courseData["kind"];
place = courseData["place"];
prof = courseData["prof"];
turnin = courseData["turnin"];
id = courseData["id"];
}
2016-06-13 17:13:02 +02:00
}