@@ -35,7 +35,7 @@ class Forum {
3535 }
3636
3737 factory Forum .fromServerRow (List <dynamic > row) {
38- final ms = ((row[3 ] as num ). toDouble ( ) * 1000 ).toInt ();
38+ final ms = ((double . tryParse ( row[3 ]. toString ()) ?? 0 ) * 1000 ).toInt ();
3939 return Forum (
4040 id: row[0 ].toString (),
4141 name: row[1 ] as String ,
@@ -67,12 +67,16 @@ class PendingForumApproval {
6767 final String creatorUid;
6868 final String forumName;
6969 final String introduction;
70+ final String type; // "create" "edit"
71+ final int ? originalFid;
7072
7173 const PendingForumApproval ({
7274 required this .queueId,
7375 required this .creatorUid,
7476 required this .forumName,
7577 required this .introduction,
78+ this .type = 'create' ,
79+ this .originalFid,
7680 });
7781
7882 factory PendingForumApproval .fromQueueEntry (
@@ -84,6 +88,8 @@ class PendingForumApproval {
8488 creatorUid: json['creater' ].toString (),
8589 forumName: json['forumname' ] as String ? ?? '' ,
8690 introduction: json['introduction' ] as String ? ?? '' ,
91+ type: json['type' ] as String ? ?? 'create' ,
92+ originalFid: json['fid' ] is int ? json['fid' ] as int : null ,
8793 );
8894 }
8995}
@@ -118,6 +124,20 @@ class ForumMember {
118124 );
119125 }
120126
127+ /// [row] = [fid, uid, role, join_time]
128+ factory ForumMember .fromServerRow (List <dynamic > row) {
129+ final ms = ((double .tryParse (row[3 ].toString ()) ?? 0 ) * 1000 ).toInt ();
130+ final joinTime = DateTime .fromMillisecondsSinceEpoch (ms);
131+ return ForumMember (
132+ forumId: row[0 ].toString (),
133+ accountUid: row[1 ].toString (),
134+ role: (row[2 ] as num ).toInt (),
135+ joinedAt: joinTime,
136+ createdAt: joinTime,
137+ updatedAt: joinTime,
138+ );
139+ }
140+
121141 Map <String , dynamic > toJson () {
122142 return {
123143 'forum_id' : forumId,
@@ -165,7 +185,7 @@ class ForumPost {
165185 }
166186
167187 factory ForumPost .fromServerRow (String forumId, List <dynamic > row) {
168- final ms = ((row[4 ] as num ). toDouble ( ) * 1000 ).toInt ();
188+ final ms = ((double . tryParse ( row[4 ]. toString ()) ?? 0 ) * 1000 ).toInt ();
169189 return ForumPost (
170190 id: row[0 ].toString (),
171191 forumId: forumId,
0 commit comments