-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'frontend' into 596-fe-add-review-feature-to-workspace-page
- Loading branch information
Showing
35 changed files
with
1,951 additions
and
623 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
project/FrontEnd/collaborative_science_platform/lib/exceptions/question_exceptions.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class PostQuestionError implements Exception { | ||
String message; | ||
PostQuestionError({this.message = "Post Question Error"}); | ||
} | ||
|
||
class PostAnswerError implements Exception { | ||
String message; | ||
PostAnswerError({this.message = "Post Answer Error"}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 10 additions & 16 deletions
26
project/FrontEnd/collaborative_science_platform/lib/models/annotation.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,19 @@ | ||
import 'package:collaborative_science_platform/models/basic_user.dart'; | ||
|
||
class Annotation { | ||
int annotationID; | ||
String annotationType; | ||
String annotationVisibilityType; | ||
BasicUser owner; | ||
Object annotationLocation; | ||
int? annotationID; | ||
// String annotationType; | ||
// String annotationVisibilityType; | ||
// BasicUser owner; | ||
// Object annotationLocation; | ||
String annotationContent; | ||
String annotationAuthor; | ||
int startOffset; | ||
int endOffset; | ||
DateTime createdAt; | ||
DateTime updatedAt; | ||
|
||
Annotation({ | ||
required this.annotationID, | ||
required this.annotationType, | ||
required this.annotationVisibilityType, | ||
required this.owner, | ||
required this.annotationLocation, | ||
this.annotationID, | ||
required this.startOffset, | ||
required this.endOffset, | ||
required this.createdAt, | ||
required this.updatedAt, | ||
required this.annotationContent, | ||
required this.annotationAuthor, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 46 additions & 13 deletions
59
project/FrontEnd/collaborative_science_platform/lib/models/node_details_page/question.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,64 @@ | ||
import 'package:collaborative_science_platform/models/user.dart'; | ||
|
||
class Question { | ||
int id; | ||
String content; | ||
String createdAt; | ||
User? asker; | ||
String answer; | ||
User asker; | ||
String? answer; | ||
User? answerer; | ||
String answeredAt; | ||
Question({ | ||
required this.content, | ||
required this.createdAt, | ||
required this.answer, | ||
required this.answeredAt, | ||
required this.answerer, | ||
required this.asker, | ||
}); | ||
String? answeredAt; | ||
int? nodeId; | ||
bool isAnswered; | ||
Question( | ||
{required this.id, | ||
required this.content, | ||
required this.createdAt, | ||
required this.asker, | ||
required this.answer, | ||
required this.answerer, | ||
required this.answeredAt, | ||
required this.nodeId, | ||
required this.isAnswered}); | ||
factory Question.fromJson(Map<String, dynamic> jsonString) { | ||
return Question( | ||
id: jsonString['id'] ?? -1, | ||
content: jsonString['question_content'] ?? "", | ||
createdAt: jsonString['created_at'] ?? "", | ||
answer: jsonString['answer_content'] ?? "", | ||
answeredAt: jsonString['answered_at'] ?? "", | ||
answerer: jsonString['answerer'] == null | ||
? null | ||
: User.fromJsonforNodeDetailPage(jsonString['answerer']), | ||
asker: | ||
jsonString['asker'] == null ? null : User.fromJsonforNodeDetailPage(jsonString['asker']), | ||
asker: User.fromJsonforNodeDetailPage(jsonString['asker']), | ||
nodeId: jsonString['node_id'] ?? -1, | ||
isAnswered: jsonString['answer_content'] != null, | ||
); | ||
} | ||
|
||
factory Question.fromJsonforProfilePage(Map<String, dynamic> jsonString) { | ||
return Question( | ||
id: jsonString['id'] ?? -1, | ||
content: jsonString['question_content'] ?? "", | ||
createdAt: jsonString['ask_date'] ?? "", | ||
asker: User( | ||
id: jsonString['asker_id'], | ||
email: jsonString['asker_mail'], | ||
firstName: jsonString['asker_name'], | ||
lastName: jsonString['asker_surname'], | ||
), | ||
answer: jsonString.containsKey("answer_content") ? jsonString["answer_content"] : "", | ||
answerer: jsonString.containsKey("answerer") | ||
? User( | ||
id: jsonString['answerer_id'], | ||
email: jsonString['answerer_mail'], | ||
firstName: jsonString['answerer_name'], | ||
lastName: jsonString['answerer_surname'], | ||
) | ||
: null, | ||
answeredAt: jsonString.containsKey("answer_date") ? jsonString["answer_date"] as String : "", | ||
nodeId: jsonString['node_id'] ?? -1, | ||
isAnswered: jsonString['is_answered'] == 1, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
project/FrontEnd/collaborative_science_platform/lib/models/question.dart
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.