update service generation

This commit is contained in:
Thomas Fransolet 2023-12-22 15:41:51 +01:00
parent 0ffe261e86
commit 6b65bcbf66
14 changed files with 171 additions and 108 deletions

View File

@ -61,8 +61,8 @@ class _ImageInputContainerState extends State<ImageInputContainer> {
child: Padding(
padding: EdgeInsets.only(left: widget.isSmall ? 5 : 10, top: 10, bottom: 10),
child: Container(
width: size.width *0.08,
height: size.width *0.08,
width: 90,
height: 90,
child: InkWell(
onTap: () async {
ResourceDTO? result = await showSelectResourceModal(

View File

@ -184,18 +184,21 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
//print(configurationDTO.languages);
},
),
/*MultiSelectContainer(
label: "Langues :",
initialValue: configurationDTO.languages != null ? configurationDTO.languages: [],
values: languages,
isMultiple: true,
isAtLeastOne: true,
onChanged: (value) {
var tempOutput = new List<String>.from(value);
configurationDTO.languages = tempOutput;
//print(configurationDTO.languages);
ImageInputContainer(
label: "Image loader :",
fontSize: 20,
initialValue: configurationDTO.loaderImageId,
color: kPrimaryColor,
onChanged: (ResourceDTO resource) {
if(resource.id == null) {
configurationDTO.loaderImageId = null;
configurationDTO.loaderImageUrl = null;
} else {
configurationDTO.loaderImageId = resource.id;
configurationDTO.loaderImageUrl = resource.url;
}
},
),*/
),
],
),
Column(
@ -282,7 +285,7 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
),
),
ImageInputContainer(
label: "Image :",
label: "Image fond d'écran :",
fontSize: 20,
initialValue: configurationDTO.imageId,
color: kPrimaryColor,
@ -296,6 +299,14 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
}
},
),
StringInputContainer(
label: "Ville météo :",
fontSize: 20,
initialValue: configurationDTO.weatherCity,
onChanged: (value) {
configurationDTO.weatherCity = value;
},
),
])
],
),

View File

@ -22,21 +22,21 @@ void showNewConfiguration(AppContext appContext, ValueChanged<bool> isImport, Bu
),
content: SingleChildScrollView(
child: SizedBox(
width: size.width*0.3,
width: size.width*0.35,
height: size.height*0.3,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Nouvelle visite", style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w400)),
Column(
children: [
StringInputContainer(
Center(child: Text("Nouvelle configuration", style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w400))),
Center(
child: StringInputContainer(
label: "Nom :",
initialValue: configurationDTO.label,
onChanged: (value) {
configurationDTO.label = value;
},
),
],
),
Text("ou"),
Column(
@ -138,6 +138,10 @@ String filePicker() {
void create(ConfigurationDTO configurationDTO, AppContext appContext, context) async {
if (configurationDTO.label != null) {
configurationDTO.dateCreation = DateTime.now();
configurationDTO.isMobile = false;
configurationDTO.isTablet = false;
configurationDTO.isOffline = false;
configurationDTO.instanceId = (appContext.getContext() as ManagerAppContext).instanceId;
await (appContext.getContext() as ManagerAppContext).clientAPI!.configurationApi!.configurationCreate(configurationDTO);
ManagerAppContext managerAppContext = appContext.getContext();

View File

@ -83,13 +83,10 @@ getElementForResource(dynamic resourceDTO, AppContext appContext) {
}
);*/
//return Text("Fichier audio - aucune visualisation possible");
break;
case ResourceType.Video:
return Text("Vidéo locale - aucune visualisation possible");
break;
case ResourceType.VideoUrl:
return Text(resourceDTO.url);
break;
}
}

View File

@ -122,7 +122,7 @@ class _ResourceBodyGridState extends State<ResourceBodyGrid> {
Expanded(
child: GridView.builder(
shrinkWrap: true,
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 6),
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 9),
itemCount: data.length,
itemBuilder: (BuildContext context, int index) {
return

View File

@ -1805,9 +1805,15 @@ components:
nullable: true
items:
type: string
pinCode:
type: integer
format: int32
loaderImageId:
type: string
nullable: true
loaderImageUrl:
type: string
nullable: true
weatherCity:
type: string
nullable: true
TranslationDTO:
type: object
additionalProperties: false

View File

@ -22,7 +22,9 @@ Name | Type | Description | Notes
**isOffline** | **bool** | | [optional]
**instanceId** | **String** | | [optional]
**sectionIds** | **List<String>** | | [optional] [default to const []]
**pinCode** | **int** | | [optional]
**loaderImageId** | **String** | | [optional]
**loaderImageUrl** | **String** | | [optional]
**weatherCity** | **String** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -22,7 +22,9 @@ Name | Type | Description | Notes
**isOffline** | **bool** | | [optional]
**instanceId** | **String** | | [optional]
**sectionIds** | **List<String>** | | [optional] [default to const []]
**pinCode** | **int** | | [optional]
**loaderImageId** | **String** | | [optional]
**loaderImageUrl** | **String** | | [optional]
**weatherCity** | **String** | | [optional]
**sections** | [**List<SectionDTO>**](SectionDTO.md) | | [optional] [default to const []]
**resources** | [**List<ResourceDTO>**](ResourceDTO.md) | | [optional] [default to const []]

View File

@ -27,7 +27,9 @@ class ConfigurationDTO {
this.isOffline,
this.instanceId,
this.sectionIds = const [],
this.pinCode,
this.loaderImageId,
this.loaderImageUrl,
this.weatherCity,
});
String? id;
@ -82,13 +84,11 @@ class ConfigurationDTO {
List<String>? sectionIds;
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
int? pinCode;
String? loaderImageId;
String? loaderImageUrl;
String? weatherCity;
@override
bool operator ==(Object other) => identical(this, other) || other is ConfigurationDTO &&
@ -106,7 +106,9 @@ class ConfigurationDTO {
other.isOffline == isOffline &&
other.instanceId == instanceId &&
other.sectionIds == sectionIds &&
other.pinCode == pinCode;
other.loaderImageId == loaderImageId &&
other.loaderImageUrl == loaderImageUrl &&
other.weatherCity == weatherCity;
@override
int get hashCode =>
@ -125,10 +127,12 @@ class ConfigurationDTO {
(isOffline == null ? 0 : isOffline!.hashCode) +
(instanceId == null ? 0 : instanceId!.hashCode) +
(sectionIds == null ? 0 : sectionIds!.hashCode) +
(pinCode == null ? 0 : pinCode!.hashCode);
(loaderImageId == null ? 0 : loaderImageId!.hashCode) +
(loaderImageUrl == null ? 0 : loaderImageUrl!.hashCode) +
(weatherCity == null ? 0 : weatherCity!.hashCode);
@override
String toString() => 'ConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, instanceId=$instanceId, sectionIds=$sectionIds, pinCode=$pinCode]';
String toString() => 'ConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, instanceId=$instanceId, sectionIds=$sectionIds, loaderImageId=$loaderImageId, loaderImageUrl=$loaderImageUrl, weatherCity=$weatherCity]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@ -202,10 +206,20 @@ class ConfigurationDTO {
} else {
json[r'sectionIds'] = null;
}
if (this.pinCode != null) {
json[r'pinCode'] = this.pinCode;
if (this.loaderImageId != null) {
json[r'loaderImageId'] = this.loaderImageId;
} else {
json[r'pinCode'] = null;
json[r'loaderImageId'] = null;
}
if (this.loaderImageUrl != null) {
json[r'loaderImageUrl'] = this.loaderImageUrl;
} else {
json[r'loaderImageUrl'] = null;
}
if (this.weatherCity != null) {
json[r'weatherCity'] = this.weatherCity;
} else {
json[r'weatherCity'] = null;
}
return json;
}
@ -247,7 +261,9 @@ class ConfigurationDTO {
sectionIds: json[r'sectionIds'] is List
? (json[r'sectionIds'] as List).cast<String>()
: const [],
pinCode: mapValueOfType<int>(json, r'pinCode'),
loaderImageId: mapValueOfType<String>(json, r'loaderImageId'),
loaderImageUrl: mapValueOfType<String>(json, r'loaderImageUrl'),
weatherCity: mapValueOfType<String>(json, r'weatherCity'),
);
}
return null;

View File

@ -27,7 +27,9 @@ class ExportConfigurationDTO {
this.isOffline,
this.instanceId,
this.sectionIds = const [],
this.pinCode,
this.loaderImageId,
this.loaderImageUrl,
this.weatherCity,
this.sections = const [],
this.resources = const [],
});
@ -84,13 +86,11 @@ class ExportConfigurationDTO {
List<String>? sectionIds;
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
int? pinCode;
String? loaderImageId;
String? loaderImageUrl;
String? weatherCity;
List<SectionDTO>? sections;
@ -112,7 +112,9 @@ class ExportConfigurationDTO {
other.isOffline == isOffline &&
other.instanceId == instanceId &&
other.sectionIds == sectionIds &&
other.pinCode == pinCode &&
other.loaderImageId == loaderImageId &&
other.loaderImageUrl == loaderImageUrl &&
other.weatherCity == weatherCity &&
other.sections == sections &&
other.resources == resources;
@ -133,12 +135,14 @@ class ExportConfigurationDTO {
(isOffline == null ? 0 : isOffline!.hashCode) +
(instanceId == null ? 0 : instanceId!.hashCode) +
(sectionIds == null ? 0 : sectionIds!.hashCode) +
(pinCode == null ? 0 : pinCode!.hashCode) +
(loaderImageId == null ? 0 : loaderImageId!.hashCode) +
(loaderImageUrl == null ? 0 : loaderImageUrl!.hashCode) +
(weatherCity == null ? 0 : weatherCity!.hashCode) +
(sections == null ? 0 : sections!.hashCode) +
(resources == null ? 0 : resources!.hashCode);
@override
String toString() => 'ExportConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, instanceId=$instanceId, sectionIds=$sectionIds, pinCode=$pinCode, sections=$sections, resources=$resources]';
String toString() => 'ExportConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, instanceId=$instanceId, sectionIds=$sectionIds, loaderImageId=$loaderImageId, loaderImageUrl=$loaderImageUrl, weatherCity=$weatherCity, sections=$sections, resources=$resources]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@ -212,10 +216,20 @@ class ExportConfigurationDTO {
} else {
json[r'sectionIds'] = null;
}
if (this.pinCode != null) {
json[r'pinCode'] = this.pinCode;
if (this.loaderImageId != null) {
json[r'loaderImageId'] = this.loaderImageId;
} else {
json[r'pinCode'] = null;
json[r'loaderImageId'] = null;
}
if (this.loaderImageUrl != null) {
json[r'loaderImageUrl'] = this.loaderImageUrl;
} else {
json[r'loaderImageUrl'] = null;
}
if (this.weatherCity != null) {
json[r'weatherCity'] = this.weatherCity;
} else {
json[r'weatherCity'] = null;
}
if (this.sections != null) {
json[r'sections'] = this.sections;
@ -267,7 +281,9 @@ class ExportConfigurationDTO {
sectionIds: json[r'sectionIds'] is List
? (json[r'sectionIds'] as List).cast<String>()
: const [],
pinCode: mapValueOfType<int>(json, r'pinCode'),
loaderImageId: mapValueOfType<String>(json, r'loaderImageId'),
loaderImageUrl: mapValueOfType<String>(json, r'loaderImageUrl'),
weatherCity: mapValueOfType<String>(json, r'weatherCity'),
sections: SectionDTO.listFromJson(json[r'sections']),
resources: ResourceDTO.listFromJson(json[r'resources']),
);

View File

@ -18,7 +18,6 @@ class ImageDTO {
this.resourceId,
this.source_,
this.order,
this.type,
});
List<TranslationDTO>? title;
@ -37,22 +36,13 @@ class ImageDTO {
///
int? order;
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
ResourceType? type;
@override
bool operator ==(Object other) => identical(this, other) || other is ImageDTO &&
other.title == title &&
other.description == description &&
other.resourceId == resourceId &&
other.source_ == source_ &&
other.order == order &&
other.type == type;
other.order == order;
@override
int get hashCode =>
@ -61,11 +51,10 @@ class ImageDTO {
(description == null ? 0 : description!.hashCode) +
(resourceId == null ? 0 : resourceId!.hashCode) +
(source_ == null ? 0 : source_!.hashCode) +
(order == null ? 0 : order!.hashCode) +
(type == null ? 0 : type!.hashCode);
(order == null ? 0 : order!.hashCode);
@override
String toString() => 'ImageDTO[title=$title, description=$description, resourceId=$resourceId, source_=$source_, order=$order, type=$type]';
String toString() => 'ImageDTO[title=$title, description=$description, resourceId=$resourceId, source_=$source_, order=$order]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@ -94,11 +83,6 @@ class ImageDTO {
} else {
json[r'order'] = null;
}
if (this.type != null) {
json[r'type'] = this.type;
} else {
json[r'type'] = null;
}
return json;
}
@ -126,7 +110,6 @@ class ImageDTO {
resourceId: mapValueOfType<String>(json, r'resourceId'),
source_: mapValueOfType<String>(json, r'source'),
order: mapValueOfType<int>(json, r'order'),
type: ResourceType.fromJson(json[r'type']),
);
}
return null;

View File

@ -40,7 +40,7 @@ class MapTypeApp {
static MapTypeApp? fromJson(dynamic value) => MapTypeAppTypeTransformer().decode(value);
static List<MapTypeApp>? listFromJson(dynamic json, {bool growable = false,}) {
static List<MapTypeApp> listFromJson(dynamic json, {bool growable = false,}) {
final result = <MapTypeApp>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
@ -72,14 +72,27 @@ class MapTypeAppTypeTransformer {
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
/// and users are still using an old app with the old code.
MapTypeApp? decode(dynamic data, {bool allowNull = true}) {
if (data != null) {
switch (data.toString()) {
case r'None': return MapTypeApp.none;
case r'Normal': return MapTypeApp.normal;
case r'Satellite': return MapTypeApp.satellite;
case r'Terrain': return MapTypeApp.terrain;
case r'Hybrid': return MapTypeApp.hybrid;
default:
if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data');
}
}
}
if (data != null) {
if(data.runtimeType == String) {
switch (data.toString()) {
case "none": return MapTypeApp.none;
case "normal": return MapTypeApp.normal;
case "satellite": return MapTypeApp.satellite;
case "terrain": return MapTypeApp.terrain;
case "hybrid": return MapTypeApp.hybrid;
case r'None': return MapTypeApp.none;
case r'Normal': return MapTypeApp.normal;
case r'Satellite': return MapTypeApp.satellite;
case r'Terrain': return MapTypeApp.terrain;
case r'Hybrid': return MapTypeApp.hybrid;
default:
if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data');
@ -100,6 +113,7 @@ class MapTypeAppTypeTransformer {
}
}
}
}
return null;
}

View File

@ -10,7 +10,7 @@
part of openapi.api;
/// 0 = Map 1 = Slider 2 = Video 3 = Web 4 = Menu 5 = Quizz 6 = Article
/// 0 = Map 1 = Slider 2 = Video 3 = Web 4 = Menu 5 = Quizz 6 = Article 7 = PDF 8 = Puzzle 9 = Agenda
class SectionType {
/// Instantiate a new enum with the provided [value].
const SectionType._(this.value);
@ -30,6 +30,9 @@ class SectionType {
static const Menu = SectionType._(4);
static const Quizz = SectionType._(5);
static const Article = SectionType._(6);
static const Pdf = SectionType._(7);
static const Puzzle = SectionType._(8);
static const Agenda = SectionType._(9);
/// List of all possible values in this [enum][SectionType].
static const values = <SectionType>[
@ -39,12 +42,15 @@ class SectionType {
Web,
Menu,
Quizz,
Article
Article,
Pdf,
Puzzle,
Agenda
];
static SectionType? fromJson(dynamic value) => SectionTypeTypeTransformer().decode(value);
static List<SectionType>? listFromJson(dynamic json, {bool growable = false,}) {
static List<SectionType> listFromJson(dynamic json, {bool growable = false,}) {
final result = <SectionType>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
@ -86,6 +92,9 @@ class SectionTypeTypeTransformer {
case r'Menu': return SectionType.Menu;
case r'Quizz': return SectionType.Quizz;
case r'Article': return SectionType.Article;
case r'PDF': return SectionType.Pdf;
case r'Puzzle': return SectionType.Puzzle;
case r'Agenda': return SectionType.Agenda;
default:
if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data');
@ -101,6 +110,9 @@ class SectionTypeTypeTransformer {
case 4: return SectionType.Menu;
case 5: return SectionType.Quizz;
case 6: return SectionType.Article;
case 7: return SectionType.Pdf;
case 8: return SectionType.Puzzle;
case 9: return SectionType.Agenda;
default:
if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data');