-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/bounswe/bounswe2023group6 …
…into develop
- Loading branch information
Showing
15 changed files
with
776 additions
and
74 deletions.
There are no files selected for viewing
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
37 changes: 37 additions & 0 deletions
37
app/mobile/lib/data/models/dto/game/character_create_request.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,37 @@ | ||
import 'package:mobile/data/models/dto/base_dto_object.dart'; | ||
import 'package:mobile/utils/service_validation_util.dart'; | ||
|
||
class CharacterCreateRequest extends BaseDTOObject<CharacterCreateRequest> { | ||
String name; | ||
String description; | ||
|
||
|
||
CharacterCreateRequest({ | ||
required this.name, | ||
required this.description, | ||
|
||
}); | ||
|
||
@override | ||
void validate() { | ||
ValidationUtil.validate(name, ValidationPolicy.stringNotEmptyValidation()); | ||
ValidationUtil.validate( | ||
description, ValidationPolicy.stringNotEmptyValidation()); | ||
} | ||
|
||
factory CharacterCreateRequest.fromJson(Map<String, dynamic> json) => | ||
CharacterCreateRequest( | ||
name: json["name"], | ||
description: json["description"], | ||
); | ||
|
||
@override | ||
Map<String, dynamic> toJson() => { | ||
"name": name, | ||
"description": description, | ||
}; | ||
|
||
@override | ||
CharacterCreateRequest fromJson(Map<String, dynamic> json) => | ||
CharacterCreateRequest.fromJson(json); | ||
} |
61 changes: 61 additions & 0 deletions
61
app/mobile/lib/data/models/dto/lfg/lfg_create_dto_request.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,61 @@ | ||
import 'package:mobile/data/models/dto/base_dto_object.dart'; | ||
import 'package:mobile/utils/service_validation_util.dart'; | ||
|
||
class LFGCreateDTORequest extends BaseDTOObject<LFGCreateDTORequest> { | ||
String title; | ||
String description; | ||
String requiredPlatform; | ||
String requiredLanguage; | ||
bool micCamRequirement; | ||
int memberCapacity; | ||
int? gameId; | ||
List<String> tags; | ||
|
||
LFGCreateDTORequest({ | ||
required this.title, | ||
required this.description, | ||
required this.requiredPlatform, | ||
required this.requiredLanguage, | ||
required this.micCamRequirement, | ||
required this.memberCapacity, | ||
required this.gameId, | ||
required this.tags, | ||
}); | ||
|
||
@override | ||
void validate() { | ||
ValidationUtil.validate(title, ValidationPolicy.stringNotEmptyValidation()); | ||
ValidationUtil.validate( | ||
description, ValidationPolicy.stringNotEmptyValidation()); | ||
} | ||
|
||
factory LFGCreateDTORequest.fromJson(Map<String, dynamic> json) => | ||
LFGCreateDTORequest( | ||
title: json["title"], | ||
description: json["description"], | ||
requiredPlatform: json["requiredPlatform"], | ||
requiredLanguage: json["requiredLanguage"], | ||
micCamRequirement: json["micCamRequirement"], | ||
memberCapacity: json["memberCapacity"], | ||
gameId: json["gameId"], | ||
tags: json["tags"] != null | ||
? List<String>.from(json["tags"].map((x) => x)) | ||
: [], | ||
); | ||
|
||
@override | ||
Map<String, dynamic> toJson() => { | ||
"title": title, | ||
"description": description, | ||
"requiredPlatform": requiredPlatform, | ||
"requiredLanguage": requiredLanguage, | ||
"micCamRequirement": micCamRequirement, | ||
"memberCapacity": memberCapacity, | ||
"gameId": gameId, | ||
"tags": tags, | ||
}; | ||
|
||
@override | ||
LFGCreateDTORequest fromJson(Map<String, dynamic> json) => | ||
LFGCreateDTORequest.fromJson(json); | ||
} |
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,25 @@ | ||
import 'package:mobile/data/models/character_model.dart'; | ||
import 'package:mobile/data/models/dto/base_dto_object.dart'; | ||
import 'package:mobile/data/models/game_model.dart'; | ||
import 'package:mobile/data/models/lfg_model.dart'; | ||
|
||
class LFGDTOResponse extends BaseDTOObject<LFGDTOResponse> { | ||
LFG? lfg; | ||
|
||
LFGDTOResponse({ | ||
this.lfg, | ||
}); | ||
|
||
@override | ||
void validate() {} | ||
|
||
factory LFGDTOResponse.fromJson(Map<String, dynamic> json) => | ||
LFGDTOResponse(lfg: LFG.fromJson(json)); | ||
|
||
@override | ||
Map<String, dynamic> toJson() => lfg!.toJson(); | ||
|
||
@override | ||
LFGDTOResponse fromJson(Map<String, dynamic> json) => | ||
LFGDTOResponse.fromJson(json); | ||
} |
33 changes: 33 additions & 0 deletions
33
app/mobile/lib/data/models/dto/lfg/mutliple_lfg_dto_request.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,33 @@ | ||
import 'package:mobile/data/models/dto/base_dto_object.dart'; | ||
import 'package:mobile/data/models/dto/game/game_response.dart'; | ||
import 'package:mobile/data/models/dto/lfg/lfg_response.dart'; | ||
|
||
class MultipleLFGAsDTO extends BaseDTOObject<MultipleLFGAsDTO> { | ||
List<LFGDTOResponse>? lfgs; | ||
|
||
MultipleLFGAsDTO({ | ||
this.lfgs, | ||
}); | ||
|
||
@override | ||
void validate() { | ||
for (var lfg in lfgs!) { | ||
lfg.validate(); | ||
} | ||
} | ||
|
||
factory MultipleLFGAsDTO.fromJson(Map<String, dynamic> json) => | ||
MultipleLFGAsDTO( | ||
lfgs: List<LFGDTOResponse>.from( | ||
json["response"].map((x) => LFGDTOResponse.fromJson(x))), | ||
); | ||
|
||
@override | ||
Map<String, dynamic> toJson() => { | ||
"response": List<dynamic>.from(lfgs!.map((x) => x.toJson())), | ||
}; | ||
|
||
@override | ||
MultipleLFGAsDTO fromJson(Map<String, dynamic> json) => | ||
MultipleLFGAsDTO.fromJson(json); | ||
} |
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
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
Oops, something went wrong.