feat: synchro all
parent
394cf68976
commit
a9f140c1a9
|
|
@ -0,0 +1,26 @@
|
|||
import 'package:objectbox/objectbox.dart';
|
||||
import 'package:mobdr/objectbox.g.dart';
|
||||
|
||||
// ignore_for_file: public_member_api_docs
|
||||
|
||||
@Entity()
|
||||
class Concurrent {
|
||||
// specify the id
|
||||
@Id()
|
||||
int id = 0;
|
||||
|
||||
int id_concurrence_lien;
|
||||
int id_etab;
|
||||
String nom;
|
||||
|
||||
Concurrent(
|
||||
{this.id = 0,
|
||||
required this.id_concurrence_lien,
|
||||
required this.id_etab,
|
||||
required this.nom});
|
||||
|
||||
Concurrent.fromJson(Map<String, dynamic> json)
|
||||
: id_concurrence_lien = json['id_concurrence_lien'],
|
||||
id_etab = json['id_etab'],
|
||||
nom = json['nom'];
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
import 'package:objectbox/objectbox.dart';
|
||||
import 'package:mobdr/objectbox.g.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
// ignore_for_file: public_member_api_docs
|
||||
|
||||
@Entity()
|
||||
class Photo {
|
||||
// specify the id
|
||||
@Id()
|
||||
int id = 0;
|
||||
|
||||
int id_photo;
|
||||
int id_visite;
|
||||
int id_photo_typologie;
|
||||
String photo;
|
||||
DateTime date_photo;
|
||||
int id_photo_mp4;
|
||||
int photo_privee;
|
||||
int photo_principale;
|
||||
String photo_tag1;
|
||||
String photo_tag2;
|
||||
String photo_tag3;
|
||||
String photo_tag4;
|
||||
int uploaded;
|
||||
|
||||
Photo(
|
||||
this.id_photo,
|
||||
this.id_visite,
|
||||
this.id_photo_typologie,
|
||||
this.photo,
|
||||
this.id_photo_mp4,
|
||||
this.photo_privee,
|
||||
this.photo_principale,
|
||||
this.photo_tag1,
|
||||
this.photo_tag2,
|
||||
this.photo_tag3,
|
||||
this.photo_tag4,
|
||||
{this.id = 0,
|
||||
DateTime? date_photo,
|
||||
this.uploaded = 0})
|
||||
: date_photo = date_photo ?? DateTime.now();
|
||||
|
||||
String get dateFormat => DateFormat('dd.MM.yyyy hh:mm:ss').format(date_photo);
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
import 'package:objectbox/objectbox.dart';
|
||||
import 'package:mobdr/objectbox.g.dart';
|
||||
|
||||
// ignore_for_file: public_member_api_docs
|
||||
|
||||
@Entity()
|
||||
class Visite {
|
||||
// specify the id
|
||||
@Id()
|
||||
int id = 0;
|
||||
|
||||
int id_visite;
|
||||
String type_visite;
|
||||
String title;
|
||||
bool allDay;
|
||||
String start;
|
||||
int id_distrib_visite;
|
||||
int id_etab;
|
||||
int abandon;
|
||||
String end;
|
||||
|
||||
Visite(
|
||||
{this.id = 0,
|
||||
required this.id_visite,
|
||||
required this.type_visite,
|
||||
required this.title,
|
||||
required this.allDay,
|
||||
required this.start,
|
||||
required this.id_distrib_visite,
|
||||
required this.id_etab,
|
||||
required this.abandon,
|
||||
required this.end});
|
||||
|
||||
Visite.fromJson(Map<String, dynamic> json)
|
||||
: id_visite = json['id_visite'],
|
||||
type_visite = json['type_visite'],
|
||||
title = json['title'],
|
||||
allDay = json['allDay'],
|
||||
start = json['start'],
|
||||
id_distrib_visite = json['id_distrib_visite'],
|
||||
id_etab = json['id_etab'],
|
||||
abandon = json['abandon'],
|
||||
end = json['end'];
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
import 'package:objectbox/objectbox.dart';
|
||||
import 'package:mobdr/objectbox.g.dart';
|
||||
|
||||
// ignore_for_file: public_member_api_docs
|
||||
|
||||
@Entity()
|
||||
class VisiteTag {
|
||||
// specify the id
|
||||
@Id()
|
||||
int id = 0;
|
||||
|
||||
int id_visite_tag;
|
||||
int id_distrib;
|
||||
String libelle;
|
||||
String langage;
|
||||
|
||||
VisiteTag(
|
||||
{this.id = 0,
|
||||
required this.id_visite_tag,
|
||||
required this.id_distrib,
|
||||
required this.libelle,
|
||||
required this.langage});
|
||||
|
||||
VisiteTag.fromJson(Map<String, dynamic> json)
|
||||
: id_visite_tag = json['id_visite_tag'],
|
||||
id_distrib = json['id_distrib'],
|
||||
libelle = json['libelle'],
|
||||
langage = json['langage'];
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@ import 'package:crypto/crypto.dart';
|
|||
class ApiProvider {
|
||||
Dio dio = Dio();
|
||||
late Response response;
|
||||
late Response response2;
|
||||
String connErr = 'Please check your internet connection and try again';
|
||||
|
||||
Future<Response> getCrud(url, body) async {
|
||||
|
|
@ -201,20 +202,85 @@ class ApiProvider {
|
|||
}
|
||||
}
|
||||
|
||||
/// Synchronize stores
|
||||
/// Synchronize "stores & competing stores"
|
||||
Future<String> SyncEtablissements() async {
|
||||
try {
|
||||
var body = null;
|
||||
/// get "Etablissement" list
|
||||
response = await getCrud(
|
||||
ApiConstants.baseUrl +
|
||||
ApiConstants.externalEndpoint +
|
||||
ApiConstants.restEndpoint +
|
||||
'/mobDR/etablissement',
|
||||
body);
|
||||
null);
|
||||
|
||||
/// get "concurrent" list
|
||||
response2 = await getCrud(
|
||||
ApiConstants.baseUrl +
|
||||
ApiConstants.externalEndpoint +
|
||||
ApiConstants.restEndpoint +
|
||||
'/mobDR/etablissement/concurrent',
|
||||
null);
|
||||
|
||||
//await new Future.delayed(const Duration(seconds: 5));
|
||||
|
||||
if (response.statusCode == STATUS_OK) {
|
||||
/// create box etab
|
||||
/// fill box "etab"
|
||||
objectbox.addEtabs(response.data['boutiques']);
|
||||
}
|
||||
|
||||
if (response2.statusCode == STATUS_OK) {
|
||||
/// fill box "concurrence"
|
||||
objectbox.addConcurrents(response2.data['concurrents']);
|
||||
}
|
||||
|
||||
/// all ok
|
||||
if (response.statusCode == STATUS_OK &&
|
||||
response2.statusCode == STATUS_OK) {
|
||||
return 'OK';
|
||||
} else {
|
||||
return response.statusMessage ?? 'Unknow error ...';
|
||||
}
|
||||
} catch (ex) {
|
||||
return ex.toString(); // return ex.response!.data;
|
||||
}
|
||||
}
|
||||
|
||||
/// Synchronize "visites"
|
||||
Future<String> SyncVisites() async {
|
||||
try {
|
||||
var body = null;
|
||||
|
||||
/// get "Visite list"
|
||||
response = await getCrud(
|
||||
ApiConstants.baseUrl +
|
||||
ApiConstants.externalEndpoint +
|
||||
ApiConstants.restEndpoint +
|
||||
'/mobDR/visite/calendrier',
|
||||
{"id_utilisateur": 6, "start": 20230101, "end": 20230131});
|
||||
|
||||
/// get "Visite tags" list
|
||||
response2 = await getCrud(
|
||||
ApiConstants.baseUrl +
|
||||
ApiConstants.externalEndpoint +
|
||||
ApiConstants.restEndpoint +
|
||||
'/mobDR/visite/tag',
|
||||
body);
|
||||
|
||||
//await new Future.delayed(const Duration(seconds: 5));
|
||||
|
||||
if (response.statusCode == STATUS_OK) {
|
||||
/// fill box "visite"
|
||||
objectbox.addVisites(response.data['events']);
|
||||
}
|
||||
|
||||
if (response2.statusCode == STATUS_OK) {
|
||||
/// fill box "visiteTag"
|
||||
objectbox.addVisiteTags(response2.data['tags']);
|
||||
}
|
||||
|
||||
/// all ok
|
||||
if (response.statusCode == STATUS_OK &&
|
||||
response2.statusCode == STATUS_OK) {
|
||||
return 'OK';
|
||||
} else {
|
||||
return response.statusMessage ?? 'Unknow error ...';
|
||||
|
|
|
|||
|
|
@ -163,9 +163,210 @@
|
|||
}
|
||||
],
|
||||
"relations": []
|
||||
},
|
||||
{
|
||||
"id": "6:1805690312272107423",
|
||||
"lastPropertyId": "4:7447139022474751374",
|
||||
"name": "Concurrent",
|
||||
"properties": [
|
||||
{
|
||||
"id": "1:2904282721431628480",
|
||||
"name": "id",
|
||||
"type": 6,
|
||||
"flags": 1
|
||||
},
|
||||
{
|
||||
"id": "2:6658127353491083480",
|
||||
"name": "id_concurrence_lien",
|
||||
"type": 6
|
||||
},
|
||||
{
|
||||
"id": "3:2563846535684494722",
|
||||
"name": "id_etab",
|
||||
"type": 6
|
||||
},
|
||||
{
|
||||
"id": "4:7447139022474751374",
|
||||
"name": "nom",
|
||||
"type": 9
|
||||
}
|
||||
],
|
||||
"relations": []
|
||||
},
|
||||
{
|
||||
"id": "7:8290500625256822711",
|
||||
"lastPropertyId": "10:103801570610300983",
|
||||
"name": "Visite",
|
||||
"properties": [
|
||||
{
|
||||
"id": "1:4764888137112024855",
|
||||
"name": "id",
|
||||
"type": 6,
|
||||
"flags": 1
|
||||
},
|
||||
{
|
||||
"id": "2:5254234731633944539",
|
||||
"name": "id_visite",
|
||||
"type": 6
|
||||
},
|
||||
{
|
||||
"id": "3:8500424631546195124",
|
||||
"name": "type_visite",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "4:307259370424642142",
|
||||
"name": "title",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "5:3383534011872507610",
|
||||
"name": "allDay",
|
||||
"type": 1
|
||||
},
|
||||
{
|
||||
"id": "6:4582947574501853036",
|
||||
"name": "start",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "7:3559563062004847001",
|
||||
"name": "id_distrib_visite",
|
||||
"type": 6
|
||||
},
|
||||
{
|
||||
"id": "8:702894233960499092",
|
||||
"name": "id_etab",
|
||||
"type": 6
|
||||
},
|
||||
{
|
||||
"id": "9:5734787836187957444",
|
||||
"name": "abandon",
|
||||
"type": 6
|
||||
},
|
||||
{
|
||||
"id": "10:103801570610300983",
|
||||
"name": "end",
|
||||
"type": 9
|
||||
}
|
||||
],
|
||||
"relations": []
|
||||
},
|
||||
{
|
||||
"id": "8:637444607663700174",
|
||||
"lastPropertyId": "5:1603887098520719919",
|
||||
"name": "VisiteTag",
|
||||
"properties": [
|
||||
{
|
||||
"id": "1:6166685814637290118",
|
||||
"name": "id",
|
||||
"type": 6,
|
||||
"flags": 1
|
||||
},
|
||||
{
|
||||
"id": "2:2059771745036116529",
|
||||
"name": "id_visite_tag",
|
||||
"type": 6
|
||||
},
|
||||
{
|
||||
"id": "3:102253757473665009",
|
||||
"name": "id_distrib",
|
||||
"type": 6
|
||||
},
|
||||
{
|
||||
"id": "4:1526411175344533047",
|
||||
"name": "libelle",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "5:1603887098520719919",
|
||||
"name": "langage",
|
||||
"type": 9
|
||||
}
|
||||
],
|
||||
"relations": []
|
||||
},
|
||||
{
|
||||
"id": "9:6788844671665652158",
|
||||
"lastPropertyId": "14:4568092734700892012",
|
||||
"name": "Photo",
|
||||
"properties": [
|
||||
{
|
||||
"id": "1:2982072387377736709",
|
||||
"name": "id",
|
||||
"type": 6,
|
||||
"flags": 1
|
||||
},
|
||||
{
|
||||
"id": "2:7877546811840884522",
|
||||
"name": "id_photo",
|
||||
"type": 6
|
||||
},
|
||||
{
|
||||
"id": "3:1374846727562410311",
|
||||
"name": "id_visite",
|
||||
"type": 6
|
||||
},
|
||||
{
|
||||
"id": "4:374091471912277059",
|
||||
"name": "id_photo_typologie",
|
||||
"type": 6
|
||||
},
|
||||
{
|
||||
"id": "5:1940661113633121688",
|
||||
"name": "photo",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "6:234947897575384032",
|
||||
"name": "date_photo",
|
||||
"type": 10
|
||||
},
|
||||
{
|
||||
"id": "7:3602779209059248697",
|
||||
"name": "id_photo_mp4",
|
||||
"type": 6
|
||||
},
|
||||
{
|
||||
"id": "8:5116665990846416843",
|
||||
"name": "photo_privee",
|
||||
"type": 6
|
||||
},
|
||||
{
|
||||
"id": "9:1716626028602523655",
|
||||
"name": "photo_principale",
|
||||
"type": 6
|
||||
},
|
||||
{
|
||||
"id": "10:2757780641715705310",
|
||||
"name": "photo_tag1",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "11:6494338359539955476",
|
||||
"name": "photo_tag2",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "12:5293139139799032553",
|
||||
"name": "photo_tag3",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "13:2141346538986140281",
|
||||
"name": "photo_tag4",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "14:4568092734700892012",
|
||||
"name": "uploaded",
|
||||
"type": 6
|
||||
}
|
||||
],
|
||||
"relations": []
|
||||
}
|
||||
],
|
||||
"lastEntityId": "5:6220645616537106928",
|
||||
"lastEntityId": "9:6788844671665652158",
|
||||
"lastIndexId": "0:0",
|
||||
"lastRelationId": "0:0",
|
||||
"lastSequenceId": "0:0",
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
import 'package:mobdr/db/box_user.dart';
|
||||
import 'package:mobdr/db/box_log.dart';
|
||||
import 'package:mobdr/db/box_etab.dart';
|
||||
import 'package:mobdr/db/box_concurrent.dart';
|
||||
import 'package:mobdr/db/box_visite.dart';
|
||||
import 'package:mobdr/db/box_visite_tag.dart';
|
||||
import 'package:mobdr/db/box_photo.dart';
|
||||
import 'model.dart';
|
||||
import 'dart:convert';
|
||||
import 'objectbox.g.dart'; // created by `flutter pub run build_runner build`
|
||||
|
||||
/// Provides access to the ObjectBox Store throughout the app.
|
||||
|
|
@ -15,12 +18,24 @@ class ObjectBox {
|
|||
/// A Box of notes.
|
||||
late final Box<Note> noteBox;
|
||||
|
||||
/// A Box of user.
|
||||
/// A Box of "user"
|
||||
late final Box<User> userBox;
|
||||
|
||||
/// A Box of Etab.
|
||||
/// A Box of "Etablissement"
|
||||
late final Box<Etab> etabBox;
|
||||
|
||||
/// A Box of "Concurrent"
|
||||
late final Box<Concurrent> concurrentBox;
|
||||
|
||||
/// A Box of "Visite"
|
||||
late final Box<Visite> visiteBox;
|
||||
|
||||
/// A Box of "Visite tag"
|
||||
late final Box<VisiteTag> visiteTagBox;
|
||||
|
||||
/// A Box of "Photo"
|
||||
late final Box<Photo> photoBox;
|
||||
|
||||
/// A Box of log.
|
||||
late final Box<Log> logBox;
|
||||
|
||||
|
|
@ -28,6 +43,10 @@ class ObjectBox {
|
|||
noteBox = Box<Note>(store);
|
||||
userBox = Box<User>(store);
|
||||
etabBox = Box<Etab>(store);
|
||||
concurrentBox = Box<Concurrent>(store);
|
||||
visiteBox = Box<Visite>(store);
|
||||
visiteTagBox = Box<VisiteTag>(store);
|
||||
photoBox = Box<Photo>(store);
|
||||
logBox = Box<Log>(store);
|
||||
|
||||
// Add some demo data if the box is empty.
|
||||
|
|
@ -36,6 +55,8 @@ class ObjectBox {
|
|||
}
|
||||
|
||||
userBox.removeAll();
|
||||
etabBox.removeAll();
|
||||
concurrentBox.removeAll();
|
||||
|
||||
// Add some demo data if the box is empty.
|
||||
if (userBox.isEmpty()) {
|
||||
|
|
@ -113,8 +134,6 @@ class ObjectBox {
|
|||
photo: _photo));
|
||||
|
||||
static void _addUserInTx(Store store, _User) {
|
||||
// Perform ObjectBox operations that take longer than a few milliseconds
|
||||
// here. To keep it simple, this example just puts a single object.
|
||||
store.box<User>().put(_User);
|
||||
}
|
||||
|
||||
|
|
@ -125,25 +144,20 @@ class ObjectBox {
|
|||
return p!.photo;
|
||||
}
|
||||
|
||||
///
|
||||
/// /USER --------------------------------------------------------------------
|
||||
|
||||
/// ETAB ---------------------------------------------------------------------
|
||||
///
|
||||
|
||||
// A function that converts a response body into a List<Etab>.
|
||||
List<Etab> parseEtabs(List responseData) {
|
||||
final parsed = responseData.cast<Map<String, dynamic>>();
|
||||
|
||||
List<Etab> parseEtabs(List responseDataList) {
|
||||
final parsed = responseDataList.cast<Map<String, dynamic>>();
|
||||
return parsed.map<Etab>((json) => Etab.fromJson(json)).toList();
|
||||
}
|
||||
|
||||
Future<void> addEtabs(List<dynamic> _etabs) => store.runInTransactionAsync(
|
||||
TxMode.write, _addEtabsInTx, parseEtabs(_etabs));
|
||||
Future<void> addEtabs(List<dynamic> _listEtabs) =>
|
||||
store.runInTransactionAsync(
|
||||
TxMode.write, _addEtabsInTx, parseEtabs(_listEtabs));
|
||||
|
||||
static void _addEtabsInTx(Store store, _Etabs) {
|
||||
// Perform ObjectBox operations that take longer than a few milliseconds
|
||||
// here. To keep it simple, this example just puts multiple object.
|
||||
store.box<Etab>().putMany(_Etabs);
|
||||
}
|
||||
|
||||
|
|
@ -162,8 +176,6 @@ class ObjectBox {
|
|||
latitude: _latitude));
|
||||
|
||||
static void _addEtabInTx(Store store, _Etab) {
|
||||
// Perform ObjectBox operations that take longer than a few milliseconds
|
||||
// here. To keep it simple, this example just puts a single object.
|
||||
store.box<Etab>().put(_Etab);
|
||||
}
|
||||
|
||||
|
|
@ -177,8 +189,179 @@ class ObjectBox {
|
|||
return etabBox.count();
|
||||
}
|
||||
|
||||
/// CONCURRENT ---------------------------------------------------------------
|
||||
///
|
||||
/// /ETAB --------------------------------------------------------------------
|
||||
|
||||
// A function that converts a response body list into a List<Concurrent>.
|
||||
List<Concurrent> parseConcurrents(List responseDataList) {
|
||||
final parsed = responseDataList.cast<Map<String, dynamic>>();
|
||||
return parsed.map<Concurrent>((json) => Concurrent.fromJson(json)).toList();
|
||||
}
|
||||
|
||||
Future<void> addConcurrents(List<dynamic> _listConcurrents) =>
|
||||
store.runInTransactionAsync(TxMode.write, _addConcurrentsInTx,
|
||||
parseConcurrents(_listConcurrents));
|
||||
|
||||
static void _addConcurrentsInTx(Store store, _Concurrents) {
|
||||
store.box<Concurrent>().putMany(_Concurrents);
|
||||
}
|
||||
|
||||
Future<void> addConcurrent(int _id_concurrence_lien, int _id_etab, _nom) =>
|
||||
store.runInTransactionAsync(
|
||||
TxMode.write,
|
||||
_addConcurrentInTx,
|
||||
Concurrent(
|
||||
id_concurrence_lien: _id_concurrence_lien,
|
||||
id_etab: _id_etab,
|
||||
nom: _nom,
|
||||
));
|
||||
|
||||
static void _addConcurrentInTx(Store store, _Concurrent) {
|
||||
store.box<Concurrent>().put(_Concurrent);
|
||||
}
|
||||
|
||||
int getConcurrentCount() {
|
||||
return concurrentBox.count();
|
||||
}
|
||||
|
||||
/// VISITE ------------------------------------------------------------------
|
||||
///
|
||||
|
||||
// A function that converts a response body list into a List<Concurrent>.
|
||||
List<Visite> parseVisites(List responseDataList) {
|
||||
final parsed = responseDataList.cast<Map<String, dynamic>>();
|
||||
return parsed.map<Visite>((json) => Visite.fromJson(json)).toList();
|
||||
}
|
||||
|
||||
Future<void> addVisites(List<dynamic> _listVisites) =>
|
||||
store.runInTransactionAsync(
|
||||
TxMode.write, _addVisitesInTx, parseVisites(_listVisites));
|
||||
|
||||
static void _addVisitesInTx(Store store, _Visites) {
|
||||
store.box<Visite>().putMany(_Visites);
|
||||
}
|
||||
|
||||
Future<void> addVisite(
|
||||
int _id_visite,
|
||||
String _type_visite,
|
||||
String _title,
|
||||
bool _allDay,
|
||||
String _start,
|
||||
int _id_distrib_visite,
|
||||
int _id_etab,
|
||||
int _abandon,
|
||||
String _end) =>
|
||||
store.runInTransactionAsync(
|
||||
TxMode.write,
|
||||
_addVisiteInTx,
|
||||
Visite(
|
||||
id_visite: _id_visite,
|
||||
type_visite: _type_visite,
|
||||
title: _title,
|
||||
allDay: _allDay,
|
||||
start: _start,
|
||||
id_distrib_visite: _id_distrib_visite,
|
||||
id_etab: _id_etab,
|
||||
abandon: _abandon,
|
||||
end: _end));
|
||||
|
||||
static void _addVisiteInTx(Store store, _Visite) {
|
||||
store.box<Visite>().put(_Visite);
|
||||
}
|
||||
|
||||
int getVisiteCount() {
|
||||
return visiteBox.count();
|
||||
}
|
||||
|
||||
/// VISITE TAG ---------------------------------------------------------------
|
||||
///
|
||||
|
||||
// A function that converts a response body list into a List<Concurrent>.
|
||||
List<VisiteTag> parseVisiteTags(List responseDataList) {
|
||||
final parsed = responseDataList.cast<Map<String, dynamic>>();
|
||||
return parsed.map<VisiteTag>((json) => VisiteTag.fromJson(json)).toList();
|
||||
}
|
||||
|
||||
Future<void> addVisiteTags(List<dynamic> _listVisiteTags) =>
|
||||
store.runInTransactionAsync(
|
||||
TxMode.write, _addVisiteTagsInTx, parseVisiteTags(_listVisiteTags));
|
||||
|
||||
static void _addVisiteTagsInTx(Store store, _VisiteTags) {
|
||||
store.box<VisiteTag>().putMany(_VisiteTags);
|
||||
}
|
||||
|
||||
Future<void> addVisiteTag(
|
||||
int _id_visite_tag,
|
||||
int _id_distrib,
|
||||
String _libelle,
|
||||
String _langage,
|
||||
) =>
|
||||
store.runInTransactionAsync(
|
||||
TxMode.write,
|
||||
_addVisiteTagInTx,
|
||||
VisiteTag(
|
||||
id_visite_tag: _id_visite_tag,
|
||||
id_distrib: _id_distrib,
|
||||
libelle: _libelle,
|
||||
langage: _langage,
|
||||
));
|
||||
|
||||
static void _addVisiteTagInTx(Store store, _VisiteTag) {
|
||||
store.box<VisiteTag>().put(_VisiteTag);
|
||||
}
|
||||
|
||||
int getVisiteTagCount() {
|
||||
return visiteTagBox.count();
|
||||
}
|
||||
|
||||
/// PHOTO --------------------------------------------------------------------
|
||||
///
|
||||
Future<void> addPhoto(
|
||||
int id_photo,
|
||||
int id_visite,
|
||||
int id_photo_typologie,
|
||||
String photo,
|
||||
int id_photo_mp4,
|
||||
int photo_privee,
|
||||
int photo_principale,
|
||||
String photo_tag1,
|
||||
String photo_tag2,
|
||||
String photo_tag3,
|
||||
String photo_tag4) =>
|
||||
store.runInTransactionAsync(
|
||||
TxMode.write,
|
||||
_addPhotoInTx,
|
||||
Photo(
|
||||
id_photo,
|
||||
id_visite,
|
||||
id_photo_typologie,
|
||||
photo,
|
||||
id_photo_mp4,
|
||||
photo_privee,
|
||||
photo_principale,
|
||||
photo_tag1,
|
||||
photo_tag2,
|
||||
photo_tag3,
|
||||
photo_tag4));
|
||||
|
||||
static void _addPhotoInTx(Store store, _Photo) {
|
||||
// Perform ObjectBox operations that take longer than a few milliseconds
|
||||
// here. To keep it simple, this example just puts a single object.
|
||||
store.box<Photo>().put(_Photo);
|
||||
}
|
||||
|
||||
Stream<List<Photo>> getPhotos() {
|
||||
// Query for all photos, sorted by their date.
|
||||
// https://docs.objectbox.io/queries
|
||||
final builder =
|
||||
photoBox.query().order(Photo_.date_photo, flags: Order.descending);
|
||||
// Build and watch the query,
|
||||
// set triggerImmediately to emit the query immediately on listen.
|
||||
return builder
|
||||
.watch(triggerImmediately: true)
|
||||
// Map it to a list of notes to be used by a StreamBuilder.
|
||||
.map((query) => query.find());
|
||||
}
|
||||
|
||||
/// LOG ----------------------------------------------------------------------
|
||||
///
|
||||
|
|
@ -200,7 +383,7 @@ class ObjectBox {
|
|||
}
|
||||
|
||||
Stream<List<Log>> getLogs() {
|
||||
// Query for all notes, sorted by their date.
|
||||
// Query for all logs, sorted by their date.
|
||||
// https://docs.objectbox.io/queries
|
||||
final builder = logBox.query().order(Log_.date, flags: Order.descending);
|
||||
// Build and watch the query,
|
||||
|
|
@ -210,7 +393,4 @@ class ObjectBox {
|
|||
// Map it to a list of notes to be used by a StreamBuilder.
|
||||
.map((query) => query.find());
|
||||
}
|
||||
|
||||
///
|
||||
/// /LOG ---------------------------------------------------------------------
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,9 +14,13 @@ import 'package:objectbox/internal.dart'; // generated code can access "internal
|
|||
import 'package:objectbox/objectbox.dart';
|
||||
import 'package:objectbox_flutter_libs/objectbox_flutter_libs.dart';
|
||||
|
||||
import 'db/box_concurrent.dart';
|
||||
import 'db/box_etab.dart';
|
||||
import 'db/box_log.dart';
|
||||
import 'db/box_photo.dart';
|
||||
import 'db/box_user.dart';
|
||||
import 'db/box_visite.dart';
|
||||
import 'db/box_visite_tag.dart';
|
||||
import 'model.dart';
|
||||
|
||||
export 'package:objectbox/objectbox.dart'; // so that callers only have to import this file
|
||||
|
|
@ -182,6 +186,207 @@ final _entities = <ModelEntity>[
|
|||
flags: 0)
|
||||
],
|
||||
relations: <ModelRelation>[],
|
||||
backlinks: <ModelBacklink>[]),
|
||||
ModelEntity(
|
||||
id: const IdUid(6, 1805690312272107423),
|
||||
name: 'Concurrent',
|
||||
lastPropertyId: const IdUid(4, 7447139022474751374),
|
||||
flags: 0,
|
||||
properties: <ModelProperty>[
|
||||
ModelProperty(
|
||||
id: const IdUid(1, 2904282721431628480),
|
||||
name: 'id',
|
||||
type: 6,
|
||||
flags: 1),
|
||||
ModelProperty(
|
||||
id: const IdUid(2, 6658127353491083480),
|
||||
name: 'id_concurrence_lien',
|
||||
type: 6,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(3, 2563846535684494722),
|
||||
name: 'id_etab',
|
||||
type: 6,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(4, 7447139022474751374),
|
||||
name: 'nom',
|
||||
type: 9,
|
||||
flags: 0)
|
||||
],
|
||||
relations: <ModelRelation>[],
|
||||
backlinks: <ModelBacklink>[]),
|
||||
ModelEntity(
|
||||
id: const IdUid(7, 8290500625256822711),
|
||||
name: 'Visite',
|
||||
lastPropertyId: const IdUid(10, 103801570610300983),
|
||||
flags: 0,
|
||||
properties: <ModelProperty>[
|
||||
ModelProperty(
|
||||
id: const IdUid(1, 4764888137112024855),
|
||||
name: 'id',
|
||||
type: 6,
|
||||
flags: 1),
|
||||
ModelProperty(
|
||||
id: const IdUid(2, 5254234731633944539),
|
||||
name: 'id_visite',
|
||||
type: 6,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(3, 8500424631546195124),
|
||||
name: 'type_visite',
|
||||
type: 9,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(4, 307259370424642142),
|
||||
name: 'title',
|
||||
type: 9,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(5, 3383534011872507610),
|
||||
name: 'allDay',
|
||||
type: 1,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(6, 4582947574501853036),
|
||||
name: 'start',
|
||||
type: 9,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(7, 3559563062004847001),
|
||||
name: 'id_distrib_visite',
|
||||
type: 6,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(8, 702894233960499092),
|
||||
name: 'id_etab',
|
||||
type: 6,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(9, 5734787836187957444),
|
||||
name: 'abandon',
|
||||
type: 6,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(10, 103801570610300983),
|
||||
name: 'end',
|
||||
type: 9,
|
||||
flags: 0)
|
||||
],
|
||||
relations: <ModelRelation>[],
|
||||
backlinks: <ModelBacklink>[]),
|
||||
ModelEntity(
|
||||
id: const IdUid(8, 637444607663700174),
|
||||
name: 'VisiteTag',
|
||||
lastPropertyId: const IdUid(5, 1603887098520719919),
|
||||
flags: 0,
|
||||
properties: <ModelProperty>[
|
||||
ModelProperty(
|
||||
id: const IdUid(1, 6166685814637290118),
|
||||
name: 'id',
|
||||
type: 6,
|
||||
flags: 1),
|
||||
ModelProperty(
|
||||
id: const IdUid(2, 2059771745036116529),
|
||||
name: 'id_visite_tag',
|
||||
type: 6,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(3, 102253757473665009),
|
||||
name: 'id_distrib',
|
||||
type: 6,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(4, 1526411175344533047),
|
||||
name: 'libelle',
|
||||
type: 9,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(5, 1603887098520719919),
|
||||
name: 'langage',
|
||||
type: 9,
|
||||
flags: 0)
|
||||
],
|
||||
relations: <ModelRelation>[],
|
||||
backlinks: <ModelBacklink>[]),
|
||||
ModelEntity(
|
||||
id: const IdUid(9, 6788844671665652158),
|
||||
name: 'Photo',
|
||||
lastPropertyId: const IdUid(14, 4568092734700892012),
|
||||
flags: 0,
|
||||
properties: <ModelProperty>[
|
||||
ModelProperty(
|
||||
id: const IdUid(1, 2982072387377736709),
|
||||
name: 'id',
|
||||
type: 6,
|
||||
flags: 1),
|
||||
ModelProperty(
|
||||
id: const IdUid(2, 7877546811840884522),
|
||||
name: 'id_photo',
|
||||
type: 6,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(3, 1374846727562410311),
|
||||
name: 'id_visite',
|
||||
type: 6,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(4, 374091471912277059),
|
||||
name: 'id_photo_typologie',
|
||||
type: 6,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(5, 1940661113633121688),
|
||||
name: 'photo',
|
||||
type: 9,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(6, 234947897575384032),
|
||||
name: 'date_photo',
|
||||
type: 10,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(7, 3602779209059248697),
|
||||
name: 'id_photo_mp4',
|
||||
type: 6,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(8, 5116665990846416843),
|
||||
name: 'photo_privee',
|
||||
type: 6,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(9, 1716626028602523655),
|
||||
name: 'photo_principale',
|
||||
type: 6,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(10, 2757780641715705310),
|
||||
name: 'photo_tag1',
|
||||
type: 9,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(11, 6494338359539955476),
|
||||
name: 'photo_tag2',
|
||||
type: 9,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(12, 5293139139799032553),
|
||||
name: 'photo_tag3',
|
||||
type: 9,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(13, 2141346538986140281),
|
||||
name: 'photo_tag4',
|
||||
type: 9,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(14, 4568092734700892012),
|
||||
name: 'uploaded',
|
||||
type: 6,
|
||||
flags: 0)
|
||||
],
|
||||
relations: <ModelRelation>[],
|
||||
backlinks: <ModelBacklink>[])
|
||||
];
|
||||
|
||||
|
|
@ -205,7 +410,7 @@ Future<Store> openStore(
|
|||
ModelDefinition getObjectBoxModel() {
|
||||
final model = ModelInfo(
|
||||
entities: _entities,
|
||||
lastEntityId: const IdUid(5, 6220645616537106928),
|
||||
lastEntityId: const IdUid(9, 6788844671665652158),
|
||||
lastIndexId: const IdUid(0, 0),
|
||||
lastRelationId: const IdUid(0, 0),
|
||||
lastSequenceId: const IdUid(0, 0),
|
||||
|
|
@ -392,6 +597,191 @@ ModelDefinition getObjectBoxModel() {
|
|||
latitude: const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGet(buffer, rootOffset, 18, ''));
|
||||
|
||||
return object;
|
||||
}),
|
||||
Concurrent: EntityDefinition<Concurrent>(
|
||||
model: _entities[4],
|
||||
toOneRelations: (Concurrent object) => [],
|
||||
toManyRelations: (Concurrent object) => {},
|
||||
getId: (Concurrent object) => object.id,
|
||||
setId: (Concurrent object, int id) {
|
||||
object.id = id;
|
||||
},
|
||||
objectToFB: (Concurrent object, fb.Builder fbb) {
|
||||
final nomOffset = fbb.writeString(object.nom);
|
||||
fbb.startTable(5);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addInt64(1, object.id_concurrence_lien);
|
||||
fbb.addInt64(2, object.id_etab);
|
||||
fbb.addOffset(3, nomOffset);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
objectFromFB: (Store store, ByteData fbData) {
|
||||
final buffer = fb.BufferContext(fbData);
|
||||
final rootOffset = buffer.derefObject(0);
|
||||
|
||||
final object = Concurrent(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
id_concurrence_lien:
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 6, 0),
|
||||
id_etab:
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 8, 0),
|
||||
nom: const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGet(buffer, rootOffset, 10, ''));
|
||||
|
||||
return object;
|
||||
}),
|
||||
Visite: EntityDefinition<Visite>(
|
||||
model: _entities[5],
|
||||
toOneRelations: (Visite object) => [],
|
||||
toManyRelations: (Visite object) => {},
|
||||
getId: (Visite object) => object.id,
|
||||
setId: (Visite object, int id) {
|
||||
object.id = id;
|
||||
},
|
||||
objectToFB: (Visite object, fb.Builder fbb) {
|
||||
final type_visiteOffset = fbb.writeString(object.type_visite);
|
||||
final titleOffset = fbb.writeString(object.title);
|
||||
final startOffset = fbb.writeString(object.start);
|
||||
final endOffset = fbb.writeString(object.end);
|
||||
fbb.startTable(11);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addInt64(1, object.id_visite);
|
||||
fbb.addOffset(2, type_visiteOffset);
|
||||
fbb.addOffset(3, titleOffset);
|
||||
fbb.addBool(4, object.allDay);
|
||||
fbb.addOffset(5, startOffset);
|
||||
fbb.addInt64(6, object.id_distrib_visite);
|
||||
fbb.addInt64(7, object.id_etab);
|
||||
fbb.addInt64(8, object.abandon);
|
||||
fbb.addOffset(9, endOffset);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
objectFromFB: (Store store, ByteData fbData) {
|
||||
final buffer = fb.BufferContext(fbData);
|
||||
final rootOffset = buffer.derefObject(0);
|
||||
|
||||
final object = Visite(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
id_visite:
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 6, 0),
|
||||
type_visite: const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGet(buffer, rootOffset, 8, ''),
|
||||
title: const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGet(buffer, rootOffset, 10, ''),
|
||||
allDay: const fb.BoolReader()
|
||||
.vTableGet(buffer, rootOffset, 12, false),
|
||||
start: const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGet(buffer, rootOffset, 14, ''),
|
||||
id_distrib_visite:
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 16, 0),
|
||||
id_etab:
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 18, 0),
|
||||
abandon:
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 20, 0),
|
||||
end: const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGet(buffer, rootOffset, 22, ''));
|
||||
|
||||
return object;
|
||||
}),
|
||||
VisiteTag: EntityDefinition<VisiteTag>(
|
||||
model: _entities[6],
|
||||
toOneRelations: (VisiteTag object) => [],
|
||||
toManyRelations: (VisiteTag object) => {},
|
||||
getId: (VisiteTag object) => object.id,
|
||||
setId: (VisiteTag object, int id) {
|
||||
object.id = id;
|
||||
},
|
||||
objectToFB: (VisiteTag object, fb.Builder fbb) {
|
||||
final libelleOffset = fbb.writeString(object.libelle);
|
||||
final langageOffset = fbb.writeString(object.langage);
|
||||
fbb.startTable(6);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addInt64(1, object.id_visite_tag);
|
||||
fbb.addInt64(2, object.id_distrib);
|
||||
fbb.addOffset(3, libelleOffset);
|
||||
fbb.addOffset(4, langageOffset);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
objectFromFB: (Store store, ByteData fbData) {
|
||||
final buffer = fb.BufferContext(fbData);
|
||||
final rootOffset = buffer.derefObject(0);
|
||||
|
||||
final object = VisiteTag(
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
id_visite_tag:
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 6, 0),
|
||||
id_distrib:
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 8, 0),
|
||||
libelle: const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGet(buffer, rootOffset, 10, ''),
|
||||
langage: const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGet(buffer, rootOffset, 12, ''));
|
||||
|
||||
return object;
|
||||
}),
|
||||
Photo: EntityDefinition<Photo>(
|
||||
model: _entities[7],
|
||||
toOneRelations: (Photo object) => [],
|
||||
toManyRelations: (Photo object) => {},
|
||||
getId: (Photo object) => object.id,
|
||||
setId: (Photo object, int id) {
|
||||
object.id = id;
|
||||
},
|
||||
objectToFB: (Photo object, fb.Builder fbb) {
|
||||
final photoOffset = fbb.writeString(object.photo);
|
||||
final photo_tag1Offset = fbb.writeString(object.photo_tag1);
|
||||
final photo_tag2Offset = fbb.writeString(object.photo_tag2);
|
||||
final photo_tag3Offset = fbb.writeString(object.photo_tag3);
|
||||
final photo_tag4Offset = fbb.writeString(object.photo_tag4);
|
||||
fbb.startTable(15);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addInt64(1, object.id_photo);
|
||||
fbb.addInt64(2, object.id_visite);
|
||||
fbb.addInt64(3, object.id_photo_typologie);
|
||||
fbb.addOffset(4, photoOffset);
|
||||
fbb.addInt64(5, object.date_photo.millisecondsSinceEpoch);
|
||||
fbb.addInt64(6, object.id_photo_mp4);
|
||||
fbb.addInt64(7, object.photo_privee);
|
||||
fbb.addInt64(8, object.photo_principale);
|
||||
fbb.addOffset(9, photo_tag1Offset);
|
||||
fbb.addOffset(10, photo_tag2Offset);
|
||||
fbb.addOffset(11, photo_tag3Offset);
|
||||
fbb.addOffset(12, photo_tag4Offset);
|
||||
fbb.addInt64(13, object.uploaded);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
objectFromFB: (Store store, ByteData fbData) {
|
||||
final buffer = fb.BufferContext(fbData);
|
||||
final rootOffset = buffer.derefObject(0);
|
||||
|
||||
final object = Photo(
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 6, 0),
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 8, 0),
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 10, 0),
|
||||
const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGet(buffer, rootOffset, 12, ''),
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 16, 0),
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 18, 0),
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 20, 0),
|
||||
const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGet(buffer, rootOffset, 22, ''),
|
||||
const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGet(buffer, rootOffset, 24, ''),
|
||||
const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGet(buffer, rootOffset, 26, ''),
|
||||
const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGet(buffer, rootOffset, 28, ''),
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
date_photo: DateTime.fromMillisecondsSinceEpoch(
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 14, 0)),
|
||||
uploaded:
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 30, 0));
|
||||
|
||||
return object;
|
||||
})
|
||||
};
|
||||
|
|
@ -488,3 +878,140 @@ class Etab_ {
|
|||
static final url_photo_principale =
|
||||
QueryStringProperty<Etab>(_entities[3].properties[7]);
|
||||
}
|
||||
|
||||
/// [Concurrent] entity fields to define ObjectBox queries.
|
||||
class Concurrent_ {
|
||||
/// see [Concurrent.id]
|
||||
static final id =
|
||||
QueryIntegerProperty<Concurrent>(_entities[4].properties[0]);
|
||||
|
||||
/// see [Concurrent.id_concurrence_lien]
|
||||
static final id_concurrence_lien =
|
||||
QueryIntegerProperty<Concurrent>(_entities[4].properties[1]);
|
||||
|
||||
/// see [Concurrent.id_etab]
|
||||
static final id_etab =
|
||||
QueryIntegerProperty<Concurrent>(_entities[4].properties[2]);
|
||||
|
||||
/// see [Concurrent.nom]
|
||||
static final nom =
|
||||
QueryStringProperty<Concurrent>(_entities[4].properties[3]);
|
||||
}
|
||||
|
||||
/// [Visite] entity fields to define ObjectBox queries.
|
||||
class Visite_ {
|
||||
/// see [Visite.id]
|
||||
static final id = QueryIntegerProperty<Visite>(_entities[5].properties[0]);
|
||||
|
||||
/// see [Visite.id_visite]
|
||||
static final id_visite =
|
||||
QueryIntegerProperty<Visite>(_entities[5].properties[1]);
|
||||
|
||||
/// see [Visite.type_visite]
|
||||
static final type_visite =
|
||||
QueryStringProperty<Visite>(_entities[5].properties[2]);
|
||||
|
||||
/// see [Visite.title]
|
||||
static final title = QueryStringProperty<Visite>(_entities[5].properties[3]);
|
||||
|
||||
/// see [Visite.allDay]
|
||||
static final allDay =
|
||||
QueryBooleanProperty<Visite>(_entities[5].properties[4]);
|
||||
|
||||
/// see [Visite.start]
|
||||
static final start = QueryStringProperty<Visite>(_entities[5].properties[5]);
|
||||
|
||||
/// see [Visite.id_distrib_visite]
|
||||
static final id_distrib_visite =
|
||||
QueryIntegerProperty<Visite>(_entities[5].properties[6]);
|
||||
|
||||
/// see [Visite.id_etab]
|
||||
static final id_etab =
|
||||
QueryIntegerProperty<Visite>(_entities[5].properties[7]);
|
||||
|
||||
/// see [Visite.abandon]
|
||||
static final abandon =
|
||||
QueryIntegerProperty<Visite>(_entities[5].properties[8]);
|
||||
|
||||
/// see [Visite.end]
|
||||
static final end = QueryStringProperty<Visite>(_entities[5].properties[9]);
|
||||
}
|
||||
|
||||
/// [VisiteTag] entity fields to define ObjectBox queries.
|
||||
class VisiteTag_ {
|
||||
/// see [VisiteTag.id]
|
||||
static final id = QueryIntegerProperty<VisiteTag>(_entities[6].properties[0]);
|
||||
|
||||
/// see [VisiteTag.id_visite_tag]
|
||||
static final id_visite_tag =
|
||||
QueryIntegerProperty<VisiteTag>(_entities[6].properties[1]);
|
||||
|
||||
/// see [VisiteTag.id_distrib]
|
||||
static final id_distrib =
|
||||
QueryIntegerProperty<VisiteTag>(_entities[6].properties[2]);
|
||||
|
||||
/// see [VisiteTag.libelle]
|
||||
static final libelle =
|
||||
QueryStringProperty<VisiteTag>(_entities[6].properties[3]);
|
||||
|
||||
/// see [VisiteTag.langage]
|
||||
static final langage =
|
||||
QueryStringProperty<VisiteTag>(_entities[6].properties[4]);
|
||||
}
|
||||
|
||||
/// [Photo] entity fields to define ObjectBox queries.
|
||||
class Photo_ {
|
||||
/// see [Photo.id]
|
||||
static final id = QueryIntegerProperty<Photo>(_entities[7].properties[0]);
|
||||
|
||||
/// see [Photo.id_photo]
|
||||
static final id_photo =
|
||||
QueryIntegerProperty<Photo>(_entities[7].properties[1]);
|
||||
|
||||
/// see [Photo.id_visite]
|
||||
static final id_visite =
|
||||
QueryIntegerProperty<Photo>(_entities[7].properties[2]);
|
||||
|
||||
/// see [Photo.id_photo_typologie]
|
||||
static final id_photo_typologie =
|
||||
QueryIntegerProperty<Photo>(_entities[7].properties[3]);
|
||||
|
||||
/// see [Photo.photo]
|
||||
static final photo = QueryStringProperty<Photo>(_entities[7].properties[4]);
|
||||
|
||||
/// see [Photo.date_photo]
|
||||
static final date_photo =
|
||||
QueryIntegerProperty<Photo>(_entities[7].properties[5]);
|
||||
|
||||
/// see [Photo.id_photo_mp4]
|
||||
static final id_photo_mp4 =
|
||||
QueryIntegerProperty<Photo>(_entities[7].properties[6]);
|
||||
|
||||
/// see [Photo.photo_privee]
|
||||
static final photo_privee =
|
||||
QueryIntegerProperty<Photo>(_entities[7].properties[7]);
|
||||
|
||||
/// see [Photo.photo_principale]
|
||||
static final photo_principale =
|
||||
QueryIntegerProperty<Photo>(_entities[7].properties[8]);
|
||||
|
||||
/// see [Photo.photo_tag1]
|
||||
static final photo_tag1 =
|
||||
QueryStringProperty<Photo>(_entities[7].properties[9]);
|
||||
|
||||
/// see [Photo.photo_tag2]
|
||||
static final photo_tag2 =
|
||||
QueryStringProperty<Photo>(_entities[7].properties[10]);
|
||||
|
||||
/// see [Photo.photo_tag3]
|
||||
static final photo_tag3 =
|
||||
QueryStringProperty<Photo>(_entities[7].properties[11]);
|
||||
|
||||
/// see [Photo.photo_tag4]
|
||||
static final photo_tag4 =
|
||||
QueryStringProperty<Photo>(_entities[7].properties[12]);
|
||||
|
||||
/// see [Photo.uploaded]
|
||||
static final uploaded =
|
||||
QueryIntegerProperty<Photo>(_entities[7].properties[13]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -210,13 +210,19 @@ class _TabSyncPageState extends State<TabSyncPage>
|
|||
child: Icon(Icons.chevron_right),
|
||||
onPressed: () async {
|
||||
///FRED
|
||||
print("Nombre étab avant:" + objectbox.getEtabCount().toString());
|
||||
var apiResponse = await _apiProvider.SyncEtablissements();
|
||||
if (apiResponse == 'OK') {
|
||||
print("getEtablissement:" + apiResponse);
|
||||
print("Nombre étab apres" + objectbox.getEtabCount().toString());
|
||||
var apiResponseEtabs = await _apiProvider.SyncEtablissements();
|
||||
var apiResponseVisites = await _apiProvider.SyncVisites();
|
||||
|
||||
if (apiResponseEtabs == 'OK') {
|
||||
print("Sync Etabs OK");
|
||||
} else {
|
||||
print("getEtablissement Error:" + apiResponse);
|
||||
print("SyncEtablissements Error:" + apiResponseEtabs);
|
||||
}
|
||||
|
||||
if (apiResponseVisites == 'OK') {
|
||||
print("Sync Visites OK");
|
||||
} else {
|
||||
print("SyncVisites Error:" + apiResponseEtabs);
|
||||
}
|
||||
|
||||
///
|
||||
|
|
|
|||
Loading…
Reference in New Issue