Baumarten -> TreeType

This commit is contained in:
Jens Reinemuth 2024-10-28 16:25:45 +01:00
parent 263faa1756
commit c4174a248d
9 changed files with 983 additions and 898 deletions

2
.env
View file

@ -1,2 +1,2 @@
BASEROW_TOKEN="TFxO7vzBLVRCu9I3VMoHmTuCvSu8aCDi"
BASEROW_IDS='{"measure": 328253, "measure_combination": 328217, "organism": 328255, "funding_program": 328256, "factsheet": 328273, "standortansprueche": 328188, "referenzumsetzung": 328465, "betriebsverzeichnis": 328472, "erfahrungsbericht": 330802, "genehmigungspflicht": 330806, "dienstleister": 330824, "ansprechperson": 330832, "material": 330836, "quellen": 334231, "baumarten": 342622, "aenderungfactsheet": 330946}'
BASEROW_IDS='{"measure": 328253, "measure_combination": 328217, "organism": 328255, "funding_program": 328256, "factsheet": 328273, "standortansprueche": 328188, "referenzumsetzung": 328465, "betriebsverzeichnis": 328472, "erfahrungsbericht": 330802, "genehmigungspflicht": 330806, "dienstleister": 330824, "ansprechperson": 330832, "material": 330836, "quellen": 334231, "tree_type": 342622, "aenderungfactsheet": 330946}'

View file

@ -28,11 +28,11 @@ void main() async {
const engine = kIsWeb ? IsarEngine.sqlite : IsarEngine.isar;
isar = Isar.open(
schemas: [
BaumartenSchema,
FundingProgramSchema,
MeasureSchema,
MeasureCombinationSchema,
OrganismSchema
OrganismSchema,
TreeTypeSchema,
],
directory: dir,
engine: engine,
@ -40,7 +40,7 @@ void main() async {
);
await Future.wait([
BaseApi().getContent('baumarten'),
BaseApi().getContent('tree_type'),
BaseApi().getContent('measure'),
BaseApi().getContent('measure_combination'),
BaseApi().getContent('organism'),

View file

@ -1,7 +1,6 @@
library ambito_entities;
export 'base_entity.dart';
export 'baumarten/baumarten.dart';
export 'general/file/file_part.dart';
export 'general/file/thumbnail.dart';
export 'general/file/thumbnails.dart';
@ -12,3 +11,4 @@ export 'general/month/month.dart';
export 'measure/measure.dart';
export 'measure_combination/measure_combination.dart';
export 'organism/organism.dart';
export 'tree_type//tree_type.dart';

View file

@ -31,7 +31,22 @@ const FundingProgramSchema = IsarGeneratedSchema(
),
IsarPropertySchema(
name: 'calculationBase',
type: IsarType.string,
type: IsarType.object,
target: 'IdValueColor',
),
IsarPropertySchema(
name: 'fundingFrequency',
type: IsarType.object,
target: 'IdValueColor',
),
IsarPropertySchema(
name: 'deminimis',
type: IsarType.bool,
),
IsarPropertySchema(
name: 'regions',
type: IsarType.objectList,
target: 'IdValueColor',
),
IsarPropertySchema(
name: 'name',
@ -54,7 +69,7 @@ const FundingProgramSchema = IsarGeneratedSchema(
deserialize: deserializeFundingProgram,
deserializeProperty: deserializeFundingProgramProp,
),
embeddedSchemas: [IdValueSchema],
embeddedSchemas: [IdValueSchema, IdValueColorSchema],
);
@isarProtected
@ -89,15 +104,52 @@ int serializeFundingProgram(IsarWriter writer, FundingProgram object) {
if (value == null) {
IsarCore.writeNull(writer, 3);
} else {
IsarCore.writeString(writer, 3, value);
final objectWriter = IsarCore.beginObject(writer, 3);
serializeIdValueColor(objectWriter, value);
IsarCore.endObject(writer, objectWriter);
}
}
{
final value = object.fundingFrequency;
if (value == null) {
IsarCore.writeNull(writer, 4);
} else {
final objectWriter = IsarCore.beginObject(writer, 4);
serializeIdValueColor(objectWriter, value);
IsarCore.endObject(writer, objectWriter);
}
}
{
final value = object.deminimis;
if (value == null) {
IsarCore.writeNull(writer, 5);
} else {
IsarCore.writeBool(writer, 5, value);
}
}
{
final list = object.regions;
if (list == null) {
IsarCore.writeNull(writer, 6);
} else {
final listWriter = IsarCore.beginList(writer, 6, list.length);
for (var i = 0; i < list.length; i++) {
{
final value = list[i];
final objectWriter = IsarCore.beginObject(listWriter, i);
serializeIdValueColor(objectWriter, value);
IsarCore.endObject(listWriter, objectWriter);
}
}
IsarCore.endList(writer, listWriter);
}
}
{
final value = object.name;
if (value == null) {
IsarCore.writeNull(writer, 4);
IsarCore.writeNull(writer, 7);
} else {
IsarCore.writeString(writer, 4, value);
IsarCore.writeString(writer, 7, value);
}
}
return object.id;
@ -132,9 +184,61 @@ FundingProgram deserializeFundingProgram(IsarReader reader) {
}
}
object.fundingAmount = IsarCore.readString(reader, 2);
object.calculationBase = IsarCore.readString(reader, 3);
{
final objectReader = IsarCore.readObject(reader, 3);
if (objectReader.isNull) {
object.calculationBase = null;
} else {
final embedded = deserializeIdValueColor(objectReader);
IsarCore.freeReader(objectReader);
object.calculationBase = embedded;
}
}
{
final objectReader = IsarCore.readObject(reader, 4);
if (objectReader.isNull) {
object.fundingFrequency = null;
} else {
final embedded = deserializeIdValueColor(objectReader);
IsarCore.freeReader(objectReader);
object.fundingFrequency = embedded;
}
}
{
if (IsarCore.readNull(reader, 5)) {
object.deminimis = null;
} else {
object.deminimis = IsarCore.readBool(reader, 5);
}
}
{
final length = IsarCore.readList(reader, 6, IsarCore.readerPtrPtr);
{
final reader = IsarCore.readerPtr;
if (reader.isNull) {
object.regions = null;
} else {
final list =
List<IdValueColor>.filled(length, IdValueColor(), growable: true);
for (var i = 0; i < length; i++) {
{
final objectReader = IsarCore.readObject(reader, i);
if (objectReader.isNull) {
list[i] = IdValueColor();
} else {
final embedded = deserializeIdValueColor(objectReader);
IsarCore.freeReader(objectReader);
list[i] = embedded;
}
}
}
IsarCore.freeReader(reader);
object.regions = list;
}
}
}
object.id = IsarCore.readId(reader);
object.name = IsarCore.readString(reader, 4);
object.name = IsarCore.readString(reader, 7);
return object;
}
@ -171,11 +275,66 @@ dynamic deserializeFundingProgramProp(IsarReader reader, int property) {
case 2:
return IsarCore.readString(reader, 2);
case 3:
return IsarCore.readString(reader, 3);
{
final objectReader = IsarCore.readObject(reader, 3);
if (objectReader.isNull) {
return null;
} else {
final embedded = deserializeIdValueColor(objectReader);
IsarCore.freeReader(objectReader);
return embedded;
}
}
case 4:
{
final objectReader = IsarCore.readObject(reader, 4);
if (objectReader.isNull) {
return null;
} else {
final embedded = deserializeIdValueColor(objectReader);
IsarCore.freeReader(objectReader);
return embedded;
}
}
case 5:
{
if (IsarCore.readNull(reader, 5)) {
return null;
} else {
return IsarCore.readBool(reader, 5);
}
}
case 6:
{
final length = IsarCore.readList(reader, 6, IsarCore.readerPtrPtr);
{
final reader = IsarCore.readerPtr;
if (reader.isNull) {
return null;
} else {
final list = List<IdValueColor>.filled(length, IdValueColor(),
growable: true);
for (var i = 0; i < length; i++) {
{
final objectReader = IsarCore.readObject(reader, i);
if (objectReader.isNull) {
list[i] = IdValueColor();
} else {
final embedded = deserializeIdValueColor(objectReader);
IsarCore.freeReader(objectReader);
list[i] = embedded;
}
}
}
IsarCore.freeReader(reader);
return list;
}
}
}
case 0:
return IsarCore.readId(reader);
case 4:
return IsarCore.readString(reader, 4);
case 7:
return IsarCore.readString(reader, 7);
default:
throw ArgumentError('Unknown property: $property');
}
@ -185,7 +344,7 @@ sealed class _FundingProgramUpdate {
bool call({
required int id,
String? fundingAmount,
String? calculationBase,
bool? deminimis,
String? name,
});
}
@ -199,15 +358,15 @@ class _FundingProgramUpdateImpl implements _FundingProgramUpdate {
bool call({
required int id,
Object? fundingAmount = ignore,
Object? calculationBase = ignore,
Object? deminimis = ignore,
Object? name = ignore,
}) {
return collection.updateProperties([
id
], {
if (fundingAmount != ignore) 2: fundingAmount as String?,
if (calculationBase != ignore) 3: calculationBase as String?,
if (name != ignore) 4: name as String?,
if (deminimis != ignore) 5: deminimis as bool?,
if (name != ignore) 7: name as String?,
}) >
0;
}
@ -217,7 +376,7 @@ sealed class _FundingProgramUpdateAll {
int call({
required List<int> id,
String? fundingAmount,
String? calculationBase,
bool? deminimis,
String? name,
});
}
@ -231,13 +390,13 @@ class _FundingProgramUpdateAllImpl implements _FundingProgramUpdateAll {
int call({
required List<int> id,
Object? fundingAmount = ignore,
Object? calculationBase = ignore,
Object? deminimis = ignore,
Object? name = ignore,
}) {
return collection.updateProperties(id, {
if (fundingAmount != ignore) 2: fundingAmount as String?,
if (calculationBase != ignore) 3: calculationBase as String?,
if (name != ignore) 4: name as String?,
if (deminimis != ignore) 5: deminimis as bool?,
if (name != ignore) 7: name as String?,
});
}
}
@ -251,7 +410,7 @@ extension FundingProgramUpdate on IsarCollection<int, FundingProgram> {
sealed class _FundingProgramQueryUpdate {
int call({
String? fundingAmount,
String? calculationBase,
bool? deminimis,
String? name,
});
}
@ -265,13 +424,13 @@ class _FundingProgramQueryUpdateImpl implements _FundingProgramQueryUpdate {
@override
int call({
Object? fundingAmount = ignore,
Object? calculationBase = ignore,
Object? deminimis = ignore,
Object? name = ignore,
}) {
return query.updateProperties(limit: limit, {
if (fundingAmount != ignore) 2: fundingAmount as String?,
if (calculationBase != ignore) 3: calculationBase as String?,
if (name != ignore) 4: name as String?,
if (deminimis != ignore) 5: deminimis as bool?,
if (name != ignore) 7: name as String?,
});
}
}
@ -294,15 +453,15 @@ class _FundingProgramQueryBuilderUpdateImpl
@override
int call({
Object? fundingAmount = ignore,
Object? calculationBase = ignore,
Object? deminimis = ignore,
Object? name = ignore,
}) {
final q = query.build();
try {
return q.updateProperties(limit: limit, {
if (fundingAmount != ignore) 2: fundingAmount as String?,
if (calculationBase != ignore) 3: calculationBase as String?,
if (name != ignore) 4: name as String?,
if (deminimis != ignore) 5: deminimis as bool?,
if (name != ignore) 7: name as String?,
});
} finally {
q.close();
@ -560,181 +719,73 @@ extension FundingProgramQueryFilter
}
QueryBuilder<FundingProgram, FundingProgram, QAfterFilterCondition>
calculationBaseEqualTo(
String? value, {
bool caseSensitive = true,
}) {
fundingFrequencyIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const IsNullCondition(property: 4));
});
}
QueryBuilder<FundingProgram, FundingProgram, QAfterFilterCondition>
fundingFrequencyIsNotNull() {
return QueryBuilder.apply(not(), (query) {
return query.addFilterCondition(const IsNullCondition(property: 4));
});
}
QueryBuilder<FundingProgram, FundingProgram, QAfterFilterCondition>
deminimisIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const IsNullCondition(property: 5));
});
}
QueryBuilder<FundingProgram, FundingProgram, QAfterFilterCondition>
deminimisIsNotNull() {
return QueryBuilder.apply(not(), (query) {
return query.addFilterCondition(const IsNullCondition(property: 5));
});
}
QueryBuilder<FundingProgram, FundingProgram, QAfterFilterCondition>
deminimisEqualTo(
bool? value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
EqualCondition(
property: 3,
property: 5,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<FundingProgram, FundingProgram, QAfterFilterCondition>
calculationBaseGreaterThan(
String? value, {
bool caseSensitive = true,
}) {
regionsIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterCondition(
property: 3,
value: value,
caseSensitive: caseSensitive,
),
);
return query.addFilterCondition(const IsNullCondition(property: 6));
});
}
QueryBuilder<FundingProgram, FundingProgram, QAfterFilterCondition>
calculationBaseGreaterThanOrEqualTo(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterOrEqualCondition(
property: 3,
value: value,
caseSensitive: caseSensitive,
),
);
regionsIsNotNull() {
return QueryBuilder.apply(not(), (query) {
return query.addFilterCondition(const IsNullCondition(property: 6));
});
}
QueryBuilder<FundingProgram, FundingProgram, QAfterFilterCondition>
calculationBaseLessThan(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessCondition(
property: 3,
value: value,
caseSensitive: caseSensitive,
),
);
});
regionsIsEmpty() {
return not().group(
(q) => q.regionsIsNull().or().regionsIsNotEmpty(),
);
}
QueryBuilder<FundingProgram, FundingProgram, QAfterFilterCondition>
calculationBaseLessThanOrEqualTo(
String? value, {
bool caseSensitive = true,
}) {
regionsIsNotEmpty() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessOrEqualCondition(
property: 3,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<FundingProgram, FundingProgram, QAfterFilterCondition>
calculationBaseBetween(
String? lower,
String? upper, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
BetweenCondition(
property: 3,
lower: lower,
upper: upper,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<FundingProgram, FundingProgram, QAfterFilterCondition>
calculationBaseStartsWith(
String value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
StartsWithCondition(
property: 3,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<FundingProgram, FundingProgram, QAfterFilterCondition>
calculationBaseEndsWith(
String value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
EndsWithCondition(
property: 3,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<FundingProgram, FundingProgram, QAfterFilterCondition>
calculationBaseContains(String value, {bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
ContainsCondition(
property: 3,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<FundingProgram, FundingProgram, QAfterFilterCondition>
calculationBaseMatches(String pattern, {bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
MatchesCondition(
property: 3,
wildcard: pattern,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<FundingProgram, FundingProgram, QAfterFilterCondition>
calculationBaseIsEmpty() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
const EqualCondition(
property: 3,
value: '',
),
);
});
}
QueryBuilder<FundingProgram, FundingProgram, QAfterFilterCondition>
calculationBaseIsNotEmpty() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
const GreaterCondition(
property: 3,
value: '',
),
const GreaterOrEqualCondition(property: 6, value: null),
);
});
}
@ -826,14 +877,14 @@ extension FundingProgramQueryFilter
QueryBuilder<FundingProgram, FundingProgram, QAfterFilterCondition>
nameIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const IsNullCondition(property: 4));
return query.addFilterCondition(const IsNullCondition(property: 7));
});
}
QueryBuilder<FundingProgram, FundingProgram, QAfterFilterCondition>
nameIsNotNull() {
return QueryBuilder.apply(not(), (query) {
return query.addFilterCondition(const IsNullCondition(property: 4));
return query.addFilterCondition(const IsNullCondition(property: 7));
});
}
@ -845,7 +896,7 @@ extension FundingProgramQueryFilter
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
EqualCondition(
property: 4,
property: 7,
value: value,
caseSensitive: caseSensitive,
),
@ -861,7 +912,7 @@ extension FundingProgramQueryFilter
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterCondition(
property: 4,
property: 7,
value: value,
caseSensitive: caseSensitive,
),
@ -877,7 +928,7 @@ extension FundingProgramQueryFilter
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterOrEqualCondition(
property: 4,
property: 7,
value: value,
caseSensitive: caseSensitive,
),
@ -893,7 +944,7 @@ extension FundingProgramQueryFilter
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessCondition(
property: 4,
property: 7,
value: value,
caseSensitive: caseSensitive,
),
@ -909,7 +960,7 @@ extension FundingProgramQueryFilter
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessOrEqualCondition(
property: 4,
property: 7,
value: value,
caseSensitive: caseSensitive,
),
@ -926,7 +977,7 @@ extension FundingProgramQueryFilter
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
BetweenCondition(
property: 4,
property: 7,
lower: lower,
upper: upper,
caseSensitive: caseSensitive,
@ -943,7 +994,7 @@ extension FundingProgramQueryFilter
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
StartsWithCondition(
property: 4,
property: 7,
value: value,
caseSensitive: caseSensitive,
),
@ -959,7 +1010,7 @@ extension FundingProgramQueryFilter
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
EndsWithCondition(
property: 4,
property: 7,
value: value,
caseSensitive: caseSensitive,
),
@ -972,7 +1023,7 @@ extension FundingProgramQueryFilter
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
ContainsCondition(
property: 4,
property: 7,
value: value,
caseSensitive: caseSensitive,
),
@ -985,7 +1036,7 @@ extension FundingProgramQueryFilter
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
MatchesCondition(
property: 4,
property: 7,
wildcard: pattern,
caseSensitive: caseSensitive,
),
@ -998,7 +1049,7 @@ extension FundingProgramQueryFilter
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
const EqualCondition(
property: 4,
property: 7,
value: '',
),
);
@ -1010,7 +1061,7 @@ extension FundingProgramQueryFilter
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
const GreaterCondition(
property: 4,
property: 7,
value: '',
),
);
@ -1019,7 +1070,21 @@ extension FundingProgramQueryFilter
}
extension FundingProgramQueryObject
on QueryBuilder<FundingProgram, FundingProgram, QFilterCondition> {}
on QueryBuilder<FundingProgram, FundingProgram, QFilterCondition> {
QueryBuilder<FundingProgram, FundingProgram, QAfterFilterCondition>
calculationBase(FilterQuery<IdValueColor> q) {
return QueryBuilder.apply(this, (query) {
return query.object(q, 3);
});
}
QueryBuilder<FundingProgram, FundingProgram, QAfterFilterCondition>
fundingFrequency(FilterQuery<IdValueColor> q) {
return QueryBuilder.apply(this, (query) {
return query.object(q, 4);
});
}
}
extension FundingProgramQuerySortBy
on QueryBuilder<FundingProgram, FundingProgram, QSortBy> {
@ -1044,24 +1109,16 @@ extension FundingProgramQuerySortBy
});
}
QueryBuilder<FundingProgram, FundingProgram, QAfterSortBy>
sortByCalculationBase({bool caseSensitive = true}) {
QueryBuilder<FundingProgram, FundingProgram, QAfterSortBy> sortByDeminimis() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(
3,
caseSensitive: caseSensitive,
);
return query.addSortBy(5);
});
}
QueryBuilder<FundingProgram, FundingProgram, QAfterSortBy>
sortByCalculationBaseDesc({bool caseSensitive = true}) {
sortByDeminimisDesc() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(
3,
sort: Sort.desc,
caseSensitive: caseSensitive,
);
return query.addSortBy(5, sort: Sort.desc);
});
}
@ -1081,7 +1138,7 @@ extension FundingProgramQuerySortBy
{bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(
4,
7,
caseSensitive: caseSensitive,
);
});
@ -1091,7 +1148,7 @@ extension FundingProgramQuerySortBy
{bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(
4,
7,
sort: Sort.desc,
caseSensitive: caseSensitive,
);
@ -1115,17 +1172,16 @@ extension FundingProgramQuerySortThenBy
});
}
QueryBuilder<FundingProgram, FundingProgram, QAfterSortBy>
thenByCalculationBase({bool caseSensitive = true}) {
QueryBuilder<FundingProgram, FundingProgram, QAfterSortBy> thenByDeminimis() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(3, caseSensitive: caseSensitive);
return query.addSortBy(5);
});
}
QueryBuilder<FundingProgram, FundingProgram, QAfterSortBy>
thenByCalculationBaseDesc({bool caseSensitive = true}) {
thenByDeminimisDesc() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(3, sort: Sort.desc, caseSensitive: caseSensitive);
return query.addSortBy(5, sort: Sort.desc);
});
}
@ -1144,14 +1200,14 @@ extension FundingProgramQuerySortThenBy
QueryBuilder<FundingProgram, FundingProgram, QAfterSortBy> thenByName(
{bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(4, caseSensitive: caseSensitive);
return query.addSortBy(7, caseSensitive: caseSensitive);
});
}
QueryBuilder<FundingProgram, FundingProgram, QAfterSortBy> thenByNameDesc(
{bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(4, sort: Sort.desc, caseSensitive: caseSensitive);
return query.addSortBy(7, sort: Sort.desc, caseSensitive: caseSensitive);
});
}
}
@ -1166,16 +1222,16 @@ extension FundingProgramQueryWhereDistinct
}
QueryBuilder<FundingProgram, FundingProgram, QAfterDistinct>
distinctByCalculationBase({bool caseSensitive = true}) {
distinctByDeminimis() {
return QueryBuilder.apply(this, (query) {
return query.addDistinctBy(3, caseSensitive: caseSensitive);
return query.addDistinctBy(5);
});
}
QueryBuilder<FundingProgram, FundingProgram, QAfterDistinct> distinctByName(
{bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addDistinctBy(4, caseSensitive: caseSensitive);
return query.addDistinctBy(7, caseSensitive: caseSensitive);
});
}
}
@ -1196,13 +1252,33 @@ extension FundingProgramQueryProperty1
});
}
QueryBuilder<FundingProgram, String?, QAfterProperty>
QueryBuilder<FundingProgram, IdValueColor?, QAfterProperty>
calculationBaseProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(3);
});
}
QueryBuilder<FundingProgram, IdValueColor?, QAfterProperty>
fundingFrequencyProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(4);
});
}
QueryBuilder<FundingProgram, bool?, QAfterProperty> deminimisProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(5);
});
}
QueryBuilder<FundingProgram, List<IdValueColor>?, QAfterProperty>
regionsProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(6);
});
}
QueryBuilder<FundingProgram, int, QAfterProperty> idProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(0);
@ -1211,7 +1287,7 @@ extension FundingProgramQueryProperty1
QueryBuilder<FundingProgram, String?, QAfterProperty> nameProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(4);
return query.addProperty(7);
});
}
}
@ -1232,13 +1308,33 @@ extension FundingProgramQueryProperty2<R>
});
}
QueryBuilder<FundingProgram, (R, String?), QAfterProperty>
QueryBuilder<FundingProgram, (R, IdValueColor?), QAfterProperty>
calculationBaseProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(3);
});
}
QueryBuilder<FundingProgram, (R, IdValueColor?), QAfterProperty>
fundingFrequencyProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(4);
});
}
QueryBuilder<FundingProgram, (R, bool?), QAfterProperty> deminimisProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(5);
});
}
QueryBuilder<FundingProgram, (R, List<IdValueColor>?), QAfterProperty>
regionsProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(6);
});
}
QueryBuilder<FundingProgram, (R, int), QAfterProperty> idProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(0);
@ -1247,7 +1343,7 @@ extension FundingProgramQueryProperty2<R>
QueryBuilder<FundingProgram, (R, String?), QAfterProperty> nameProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(4);
return query.addProperty(7);
});
}
}
@ -1268,13 +1364,34 @@ extension FundingProgramQueryProperty3<R1, R2>
});
}
QueryBuilder<FundingProgram, (R1, R2, String?), QOperations>
QueryBuilder<FundingProgram, (R1, R2, IdValueColor?), QOperations>
calculationBaseProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(3);
});
}
QueryBuilder<FundingProgram, (R1, R2, IdValueColor?), QOperations>
fundingFrequencyProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(4);
});
}
QueryBuilder<FundingProgram, (R1, R2, bool?), QOperations>
deminimisProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(5);
});
}
QueryBuilder<FundingProgram, (R1, R2, List<IdValueColor>?), QOperations>
regionsProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(6);
});
}
QueryBuilder<FundingProgram, (R1, R2, int), QOperations> idProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(0);
@ -1283,7 +1400,7 @@ extension FundingProgramQueryProperty3<R1, R2>
QueryBuilder<FundingProgram, (R1, R2, String?), QOperations> nameProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(4);
return query.addProperty(7);
});
}
}
@ -1300,7 +1417,18 @@ FundingProgram _$FundingProgramFromJson(Map<String, dynamic> json) =>
?.map((e) => IdValue.fromJson(e as Map<String, dynamic>))
.toList()
..fundingAmount = json['Höhe der Förderung'] as String?
..calculationBase = json['Berechnungsgrundlage'] as String?;
..calculationBase = json['Berechnungsgrundlage'] == null
? null
: IdValueColor.fromJson(
json['Berechnungsgrundlage'] as Map<String, dynamic>)
..fundingFrequency = json['Förderfrequenz'] == null
? null
: IdValueColor.fromJson(
json['Förderfrequenz'] as Map<String, dynamic>)
..deminimis = json['De-Minimis-Pflichtig'] as bool?
..regions = (json['Region/Bundesland'] as List<dynamic>?)
?.map((e) => IdValueColor.fromJson(e as Map<String, dynamic>))
.toList();
Map<String, dynamic> _$FundingProgramToJson(FundingProgram instance) =>
<String, dynamic>{
@ -1308,5 +1436,8 @@ Map<String, dynamic> _$FundingProgramToJson(FundingProgram instance) =>
'Name': instance.name,
'Maßnahmen_Main': instance.measures?.map((e) => e.toJson()).toList(),
'Höhe der Förderung': instance.fundingAmount,
'Berechnungsgrundlage': instance.calculationBase,
'Berechnungsgrundlage': instance.calculationBase?.toJson(),
'Förderfrequenz': instance.fundingFrequency?.toJson(),
'De-Minimis-Pflichtig': instance.deminimis,
'Region/Bundesland': instance.regions?.map((e) => e.toJson()).toList(),
};

View file

@ -2,12 +2,12 @@ import 'package:ambito/src/domain/entity/entities.dart';
import 'package:isar/isar.dart';
import 'package:json_annotation/json_annotation.dart';
part 'baumarten.g.dart';
part 'tree_type.g.dart';
@JsonSerializable(explicitToJson: true)
@collection
class Baumarten extends BaseEntity with EntityWithId {
Baumarten();
class TreeType extends BaseEntity with EntityWithId {
TreeType();
@JsonKey(name: 'order')
String? orderString;
@ -74,8 +74,8 @@ class Baumarten extends BaseEntity with EntityWithId {
@JsonKey(name: 'Heimisch')
bool? local;
factory Baumarten.fromJson(Map<String, dynamic> json) =>
_$BaumartenFromJson(json);
factory TreeType.fromJson(Map<String, dynamic> json) =>
_$TreeTypeFromJson(json);
Map<String, dynamic> toJson() => _$BaumartenToJson(this);
Map<String, dynamic> toJson() => _$TreeTypeToJson(this);
}

View file

@ -24,9 +24,9 @@ class BaseApi {
if (response.statusCode == 200) {
var json = _jsonDecoded(response.body);
switch (table) {
case 'baumarten':
for (var baumart in json['results']) {
BaumartenRepository().put(Baumarten.fromJson(baumart));
case 'tree_type':
for (var treeType in json['results']) {
TreeTypeRepository().put(TreeType.fromJson(treeType));
}
break;
case 'measure':
@ -35,9 +35,9 @@ class BaseApi {
}
break;
case 'measure_combination':
for (var measure_combination in json['results']) {
for (var measureCombination in json['results']) {
MeasureCombinationRepository()
.put(MeasureCombination.fromJson(measure_combination));
.put(MeasureCombination.fromJson(measureCombination));
}
break;
case 'organism':

View file

@ -3,10 +3,10 @@ import 'package:isar/isar.dart';
import '../../../main.dart';
export 'repositories/baumarten_repository.dart';
export 'repositories/measure_combination_repository.dart';
export 'repositories/measure_repository.dart';
export 'repositories/organism_repository.dart';
export 'repositories/tree_type_repository.dart';
abstract class BaseDB {
abstract IsarCollection collection;

View file

@ -4,6 +4,6 @@ import 'package:isar/isar.dart';
import '../../../../main.dart';
import '../base_db.dart';
class BaumartenRepository extends BaseDB {
IsarCollection collection = isar.baumartens;
class TreeTypeRepository extends BaseDB {
IsarCollection collection = isar.treeTypes;
}