Reorganizing & Renaming

This commit is contained in:
Jens Reinemuth 2024-10-28 16:17:09 +01:00
parent 102f8de792
commit 263faa1756
34 changed files with 4537 additions and 1311 deletions

2
.env
View file

@ -1,2 +1,2 @@
BASEROW_TOKEN="TFxO7vzBLVRCu9I3VMoHmTuCvSu8aCDi"
BASEROW_IDS='{"massnahmen": 328253, "massnahmenkombination": 328217, "organismen": 328255, "foerderprogramme": 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, "baumarten": 342622, "aenderungfactsheet": 330946}'

View file

@ -1,5 +1,5 @@
import 'package:ambito/src/domain/entity/baumarten/baumarten.dart';
import 'package:ambito/src/domain/entity/massnahme/massnahme.dart';
import 'package:ambito/src/domain/entity/entities.dart';
import 'package:ambito/src/domain/entity/funding_program/funding_program.dart';
import 'package:ambito/src/packages/ambito_api/base.dart';
import 'package:ambito/src/pages/loading/loading_page.dart';
import 'package:flutter/foundation.dart';
@ -27,7 +27,13 @@ void main() async {
const dir = Isar.sqliteInMemory;
const engine = kIsWeb ? IsarEngine.sqlite : IsarEngine.isar;
isar = Isar.open(
schemas: [BaumartenSchema, MassnahmeSchema],
schemas: [
BaumartenSchema,
FundingProgramSchema,
MeasureSchema,
MeasureCombinationSchema,
OrganismSchema
],
directory: dir,
engine: engine,
inspector: true,
@ -35,7 +41,10 @@ void main() async {
await Future.wait([
BaseApi().getContent('baumarten'),
BaseApi().getContent('massnahmen'),
BaseApi().getContent('measure'),
BaseApi().getContent('measure_combination'),
BaseApi().getContent('organism'),
BaseApi().getContent('funding_program'),
]);
runApp(const Ambito());

View file

@ -1,5 +1,15 @@
import 'package:isar/isar.dart';
import 'package:json_annotation/json_annotation.dart';
class BaseEntity {}
mixin EntityWithId {
late int id;
}
mixin EntityWithIdAndName {
late int id;
@JsonKey(name: 'Name')
@Index(unique: true, hash: true)
String? name;
}

View file

@ -1,10 +1,7 @@
import 'package:ambito/src/domain/entity/id_value/id_value.dart';
import 'package:ambito/src/domain/entity/id_value_color/id_value_color.dart';
import 'package:ambito/src/domain/entity/entities.dart';
import 'package:isar/isar.dart';
import 'package:json_annotation/json_annotation.dart';
import '../base_entity.dart';
part 'baumarten.g.dart';
@JsonSerializable(explicitToJson: true)

View file

@ -2,10 +2,13 @@ library ambito_entities;
export 'base_entity.dart';
export 'baumarten/baumarten.dart';
export 'file/file_part.dart';
export 'file/thumbnail.dart';
export 'file/thumbnails.dart';
export 'id_value/id_value.dart';
export 'id_value_color/id_value_color.dart';
export 'id_value_mix/id_value_mix.dart';
export 'massnahme/massnahme.dart';
export 'general/file/file_part.dart';
export 'general/file/thumbnail.dart';
export 'general/file/thumbnails.dart';
export 'general/id_value/id_value.dart';
export 'general/id_value_color/id_value_color.dart';
export 'general/id_value_mix/id_value_mix.dart';
export 'general/month/month.dart';
export 'measure/measure.dart';
export 'measure_combination/measure_combination.dart';
export 'organism/organism.dart';

View file

@ -0,0 +1,29 @@
import 'package:ambito/src/domain/entity/entities.dart';
import 'package:isar/isar.dart';
import 'package:json_annotation/json_annotation.dart';
part 'funding_program.g.dart';
@JsonSerializable(explicitToJson: true)
@collection
class FundingProgram extends BaseEntity with EntityWithIdAndName {
FundingProgram();
@JsonKey(name: 'Maßnahmen_Main')
List<IdValue>? measures;
@JsonKey(name: 'Höhe der Förderung')
String? fundingAmount;
@JsonKey(name: 'Berechnungsgrundlage')
IdValueColor? calculationBase;
@JsonKey(name: 'Förderfrequenz')
IdValueColor? fundingFrequency;
@JsonKey(name: 'De-Minimis-Pflichtig')
bool? deminimis;
@JsonKey(name: 'Region/Bundesland')
List<IdValueColor>? regions;
factory FundingProgram.fromJson(Map<String, dynamic> json) =>
_$FundingProgramFromJson(json);
Map<String, dynamic> toJson() => _$FundingProgramToJson(this);
}

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
import 'package:ambito/src/domain/entity/file/thumbnails.dart';
import 'package:ambito/src/domain/entity/entities.dart';
import 'package:isar/isar.dart';
import 'package:json_annotation/json_annotation.dart';

View file

@ -1,4 +1,4 @@
import 'package:ambito/src/domain/entity/file/thumbnail.dart';
import 'package:ambito/src/domain/entity/entities.dart';
import 'package:isar/isar.dart';
import 'package:json_annotation/json_annotation.dart';

View file

@ -1,4 +1,4 @@
import 'package:ambito/src/domain/entity/id_value_color/id_value_color.dart';
import 'package:ambito/src/domain/entity/entities.dart';
import 'package:isar/isar.dart';
import 'package:json_annotation/json_annotation.dart';

View file

@ -1,22 +1,15 @@
import 'package:ambito/src/domain/entity/base_entity.dart';
import 'package:ambito/src/domain/entity/id_value/id_value.dart';
import 'package:ambito/src/domain/entity/id_value_color/id_value_color.dart';
import 'package:ambito/src/domain/entity/entities.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:isar/isar.dart';
import 'package:json_annotation/json_annotation.dart';
import '../file/file_part.dart';
import '../file/thumbnail.dart';
import '../file/thumbnails.dart';
import '../id_value_mix/id_value_mix.dart';
part 'massnahme.g.dart';
part 'measure.g.dart';
@JsonSerializable(explicitToJson: true)
@collection
class Massnahme extends BaseEntity with EntityWithId {
Massnahme();
class Measure extends BaseEntity with EntityWithId {
Measure();
@JsonKey(name: 'order')
String? orderString;
@ -146,20 +139,19 @@ class Massnahme extends BaseEntity with EntityWithId {
@JsonKey(name: "12 Quellen - Verwendet in Maßnahmendatenblatt")
List<IdValue>? sourcesUsedInDataSheet;
factory Massnahme.fromJson(Map<String, dynamic> json) =>
_$MassnahmeFromJson(json);
factory Measure.fromJson(Map<String, dynamic> json) =>
_$MeasureFromJson(json);
Map<String, dynamic> toJson() => _$MassnahmeToJson(this);
Map<String, dynamic> toJson() => _$MeasureToJson(this);
}
extension MassnahmenExtension on Massnahme {
extension MeasureExtension on Measure {
CachedNetworkImage? getThumbnail() {
CachedNetworkImage? image;
if (files != null && files!.isNotEmpty) {
if (files![0].thumbnails?.cardCover?.url != null) {
image = CachedNetworkImage(
imageUrl:files![0].thumbnails!.cardCover!.url!,
imageUrl: files![0].thumbnails!.cardCover!.url!,
placeholder: (context, url) => const CircularProgressIndicator(),
errorWidget: (context, url, error) => const Icon(Icons.error),
);
@ -167,5 +159,4 @@ extension MassnahmenExtension on Massnahme {
}
return image;
}
}
}

View file

@ -0,0 +1,24 @@
import 'package:ambito/src/domain/entity/entities.dart';
import 'package:isar/isar.dart';
import 'package:json_annotation/json_annotation.dart';
part 'measure_combination.g.dart';
@collection
@JsonSerializable(explicitToJson: true)
class MeasureCombination extends BaseEntity with EntityWithIdAndName {
MeasureCombination();
@Index()
@JsonKey(name: 'Aktiv')
bool? active;
@JsonKey(name: 'Maßnahmenkombination')
List<IdValue>? combinations;
@JsonKey(name: 'Anmerkungen')
String? notices;
factory MeasureCombination.fromJson(Map<String, dynamic> json) =>
_$MeasureCombinationFromJson(json);
Map<String, dynamic> toJson() => _$MeasureCombinationToJson(this);
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,19 @@
import 'package:ambito/src/domain/entity/entities.dart';
import 'package:isar/isar.dart';
import 'package:json_annotation/json_annotation.dart';
part 'organism.g.dart';
@JsonSerializable(explicitToJson: true)
@collection
class Organism extends BaseEntity with EntityWithIdAndName {
Organism();
@JsonKey(name: 'Maßnahmen')
List<IdValue>? measures;
factory Organism.fromJson(Map<String, dynamic> json) =>
_$OrganismFromJson(json);
Map<String, dynamic> toJson() => _$OrganismToJson(this);
}

View file

@ -0,0 +1,719 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'organism.dart';
// **************************************************************************
// _IsarCollectionGenerator
// **************************************************************************
// coverage:ignore-file
// ignore_for_file: duplicate_ignore, invalid_use_of_protected_member, lines_longer_than_80_chars, constant_identifier_names, avoid_js_rounded_ints, no_leading_underscores_for_local_identifiers, require_trailing_commas, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_in_if_null_operators, library_private_types_in_public_api, prefer_const_constructors
// ignore_for_file: type=lint
extension GetOrganismCollection on Isar {
IsarCollection<int, Organism> get organisms => this.collection();
}
const OrganismSchema = IsarGeneratedSchema(
schema: IsarSchema(
name: 'Organism',
idName: 'id',
embedded: false,
properties: [
IsarPropertySchema(
name: 'measures',
type: IsarType.objectList,
target: 'IdValue',
),
IsarPropertySchema(
name: 'name',
type: IsarType.string,
),
],
indexes: [
IsarIndexSchema(
name: 'name',
properties: [
"name",
],
unique: true,
hash: true,
),
],
),
converter: IsarObjectConverter<int, Organism>(
serialize: serializeOrganism,
deserialize: deserializeOrganism,
deserializeProperty: deserializeOrganismProp,
),
embeddedSchemas: [IdValueSchema],
);
@isarProtected
int serializeOrganism(IsarWriter writer, Organism object) {
{
final list = object.measures;
if (list == null) {
IsarCore.writeNull(writer, 1);
} else {
final listWriter = IsarCore.beginList(writer, 1, list.length);
for (var i = 0; i < list.length; i++) {
{
final value = list[i];
final objectWriter = IsarCore.beginObject(listWriter, i);
serializeIdValue(objectWriter, value);
IsarCore.endObject(listWriter, objectWriter);
}
}
IsarCore.endList(writer, listWriter);
}
}
{
final value = object.name;
if (value == null) {
IsarCore.writeNull(writer, 2);
} else {
IsarCore.writeString(writer, 2, value);
}
}
return object.id;
}
@isarProtected
Organism deserializeOrganism(IsarReader reader) {
final object = Organism();
{
final length = IsarCore.readList(reader, 1, IsarCore.readerPtrPtr);
{
final reader = IsarCore.readerPtr;
if (reader.isNull) {
object.measures = null;
} else {
final list = List<IdValue>.filled(length, IdValue(), growable: true);
for (var i = 0; i < length; i++) {
{
final objectReader = IsarCore.readObject(reader, i);
if (objectReader.isNull) {
list[i] = IdValue();
} else {
final embedded = deserializeIdValue(objectReader);
IsarCore.freeReader(objectReader);
list[i] = embedded;
}
}
}
IsarCore.freeReader(reader);
object.measures = list;
}
}
}
object.id = IsarCore.readId(reader);
object.name = IsarCore.readString(reader, 2);
return object;
}
@isarProtected
dynamic deserializeOrganismProp(IsarReader reader, int property) {
switch (property) {
case 1:
{
final length = IsarCore.readList(reader, 1, IsarCore.readerPtrPtr);
{
final reader = IsarCore.readerPtr;
if (reader.isNull) {
return null;
} else {
final list =
List<IdValue>.filled(length, IdValue(), growable: true);
for (var i = 0; i < length; i++) {
{
final objectReader = IsarCore.readObject(reader, i);
if (objectReader.isNull) {
list[i] = IdValue();
} else {
final embedded = deserializeIdValue(objectReader);
IsarCore.freeReader(objectReader);
list[i] = embedded;
}
}
}
IsarCore.freeReader(reader);
return list;
}
}
}
case 0:
return IsarCore.readId(reader);
case 2:
return IsarCore.readString(reader, 2);
default:
throw ArgumentError('Unknown property: $property');
}
}
sealed class _OrganismUpdate {
bool call({
required int id,
String? name,
});
}
class _OrganismUpdateImpl implements _OrganismUpdate {
const _OrganismUpdateImpl(this.collection);
final IsarCollection<int, Organism> collection;
@override
bool call({
required int id,
Object? name = ignore,
}) {
return collection.updateProperties([
id
], {
if (name != ignore) 2: name as String?,
}) >
0;
}
}
sealed class _OrganismUpdateAll {
int call({
required List<int> id,
String? name,
});
}
class _OrganismUpdateAllImpl implements _OrganismUpdateAll {
const _OrganismUpdateAllImpl(this.collection);
final IsarCollection<int, Organism> collection;
@override
int call({
required List<int> id,
Object? name = ignore,
}) {
return collection.updateProperties(id, {
if (name != ignore) 2: name as String?,
});
}
}
extension OrganismUpdate on IsarCollection<int, Organism> {
_OrganismUpdate get update => _OrganismUpdateImpl(this);
_OrganismUpdateAll get updateAll => _OrganismUpdateAllImpl(this);
}
sealed class _OrganismQueryUpdate {
int call({
String? name,
});
}
class _OrganismQueryUpdateImpl implements _OrganismQueryUpdate {
const _OrganismQueryUpdateImpl(this.query, {this.limit});
final IsarQuery<Organism> query;
final int? limit;
@override
int call({
Object? name = ignore,
}) {
return query.updateProperties(limit: limit, {
if (name != ignore) 2: name as String?,
});
}
}
extension OrganismQueryUpdate on IsarQuery<Organism> {
_OrganismQueryUpdate get updateFirst =>
_OrganismQueryUpdateImpl(this, limit: 1);
_OrganismQueryUpdate get updateAll => _OrganismQueryUpdateImpl(this);
}
class _OrganismQueryBuilderUpdateImpl implements _OrganismQueryUpdate {
const _OrganismQueryBuilderUpdateImpl(this.query, {this.limit});
final QueryBuilder<Organism, Organism, QOperations> query;
final int? limit;
@override
int call({
Object? name = ignore,
}) {
final q = query.build();
try {
return q.updateProperties(limit: limit, {
if (name != ignore) 2: name as String?,
});
} finally {
q.close();
}
}
}
extension OrganismQueryBuilderUpdate
on QueryBuilder<Organism, Organism, QOperations> {
_OrganismQueryUpdate get updateFirst =>
_OrganismQueryBuilderUpdateImpl(this, limit: 1);
_OrganismQueryUpdate get updateAll => _OrganismQueryBuilderUpdateImpl(this);
}
extension OrganismQueryFilter
on QueryBuilder<Organism, Organism, QFilterCondition> {
QueryBuilder<Organism, Organism, QAfterFilterCondition> measuresIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const IsNullCondition(property: 1));
});
}
QueryBuilder<Organism, Organism, QAfterFilterCondition> measuresIsNotNull() {
return QueryBuilder.apply(not(), (query) {
return query.addFilterCondition(const IsNullCondition(property: 1));
});
}
QueryBuilder<Organism, Organism, QAfterFilterCondition> measuresIsEmpty() {
return not().group(
(q) => q.measuresIsNull().or().measuresIsNotEmpty(),
);
}
QueryBuilder<Organism, Organism, QAfterFilterCondition> measuresIsNotEmpty() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
const GreaterOrEqualCondition(property: 1, value: null),
);
});
}
QueryBuilder<Organism, Organism, QAfterFilterCondition> idEqualTo(
int value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
EqualCondition(
property: 0,
value: value,
),
);
});
}
QueryBuilder<Organism, Organism, QAfterFilterCondition> idGreaterThan(
int value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterCondition(
property: 0,
value: value,
),
);
});
}
QueryBuilder<Organism, Organism, QAfterFilterCondition>
idGreaterThanOrEqualTo(
int value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterOrEqualCondition(
property: 0,
value: value,
),
);
});
}
QueryBuilder<Organism, Organism, QAfterFilterCondition> idLessThan(
int value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessCondition(
property: 0,
value: value,
),
);
});
}
QueryBuilder<Organism, Organism, QAfterFilterCondition> idLessThanOrEqualTo(
int value,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessOrEqualCondition(
property: 0,
value: value,
),
);
});
}
QueryBuilder<Organism, Organism, QAfterFilterCondition> idBetween(
int lower,
int upper,
) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
BetweenCondition(
property: 0,
lower: lower,
upper: upper,
),
);
});
}
QueryBuilder<Organism, Organism, QAfterFilterCondition> nameIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const IsNullCondition(property: 2));
});
}
QueryBuilder<Organism, Organism, QAfterFilterCondition> nameIsNotNull() {
return QueryBuilder.apply(not(), (query) {
return query.addFilterCondition(const IsNullCondition(property: 2));
});
}
QueryBuilder<Organism, Organism, QAfterFilterCondition> nameEqualTo(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
EqualCondition(
property: 2,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<Organism, Organism, QAfterFilterCondition> nameGreaterThan(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterCondition(
property: 2,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<Organism, Organism, QAfterFilterCondition>
nameGreaterThanOrEqualTo(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
GreaterOrEqualCondition(
property: 2,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<Organism, Organism, QAfterFilterCondition> nameLessThan(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessCondition(
property: 2,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<Organism, Organism, QAfterFilterCondition> nameLessThanOrEqualTo(
String? value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
LessOrEqualCondition(
property: 2,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<Organism, Organism, QAfterFilterCondition> nameBetween(
String? lower,
String? upper, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
BetweenCondition(
property: 2,
lower: lower,
upper: upper,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<Organism, Organism, QAfterFilterCondition> nameStartsWith(
String value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
StartsWithCondition(
property: 2,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<Organism, Organism, QAfterFilterCondition> nameEndsWith(
String value, {
bool caseSensitive = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
EndsWithCondition(
property: 2,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<Organism, Organism, QAfterFilterCondition> nameContains(
String value,
{bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
ContainsCondition(
property: 2,
value: value,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<Organism, Organism, QAfterFilterCondition> nameMatches(
String pattern,
{bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
MatchesCondition(
property: 2,
wildcard: pattern,
caseSensitive: caseSensitive,
),
);
});
}
QueryBuilder<Organism, Organism, QAfterFilterCondition> nameIsEmpty() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
const EqualCondition(
property: 2,
value: '',
),
);
});
}
QueryBuilder<Organism, Organism, QAfterFilterCondition> nameIsNotEmpty() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(
const GreaterCondition(
property: 2,
value: '',
),
);
});
}
}
extension OrganismQueryObject
on QueryBuilder<Organism, Organism, QFilterCondition> {}
extension OrganismQuerySortBy on QueryBuilder<Organism, Organism, QSortBy> {
QueryBuilder<Organism, Organism, QAfterSortBy> sortById() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(0);
});
}
QueryBuilder<Organism, Organism, QAfterSortBy> sortByIdDesc() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(0, sort: Sort.desc);
});
}
QueryBuilder<Organism, Organism, QAfterSortBy> sortByName(
{bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(
2,
caseSensitive: caseSensitive,
);
});
}
QueryBuilder<Organism, Organism, QAfterSortBy> sortByNameDesc(
{bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(
2,
sort: Sort.desc,
caseSensitive: caseSensitive,
);
});
}
}
extension OrganismQuerySortThenBy
on QueryBuilder<Organism, Organism, QSortThenBy> {
QueryBuilder<Organism, Organism, QAfterSortBy> thenById() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(0);
});
}
QueryBuilder<Organism, Organism, QAfterSortBy> thenByIdDesc() {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(0, sort: Sort.desc);
});
}
QueryBuilder<Organism, Organism, QAfterSortBy> thenByName(
{bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(2, caseSensitive: caseSensitive);
});
}
QueryBuilder<Organism, Organism, QAfterSortBy> thenByNameDesc(
{bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addSortBy(2, sort: Sort.desc, caseSensitive: caseSensitive);
});
}
}
extension OrganismQueryWhereDistinct
on QueryBuilder<Organism, Organism, QDistinct> {
QueryBuilder<Organism, Organism, QAfterDistinct> distinctByName(
{bool caseSensitive = true}) {
return QueryBuilder.apply(this, (query) {
return query.addDistinctBy(2, caseSensitive: caseSensitive);
});
}
}
extension OrganismQueryProperty1
on QueryBuilder<Organism, Organism, QProperty> {
QueryBuilder<Organism, List<IdValue>?, QAfterProperty> measuresProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(1);
});
}
QueryBuilder<Organism, int, QAfterProperty> idProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(0);
});
}
QueryBuilder<Organism, String?, QAfterProperty> nameProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(2);
});
}
}
extension OrganismQueryProperty2<R>
on QueryBuilder<Organism, R, QAfterProperty> {
QueryBuilder<Organism, (R, List<IdValue>?), QAfterProperty>
measuresProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(1);
});
}
QueryBuilder<Organism, (R, int), QAfterProperty> idProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(0);
});
}
QueryBuilder<Organism, (R, String?), QAfterProperty> nameProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(2);
});
}
}
extension OrganismQueryProperty3<R1, R2>
on QueryBuilder<Organism, (R1, R2), QAfterProperty> {
QueryBuilder<Organism, (R1, R2, List<IdValue>?), QOperations>
measuresProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(1);
});
}
QueryBuilder<Organism, (R1, R2, int), QOperations> idProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(0);
});
}
QueryBuilder<Organism, (R1, R2, String?), QOperations> nameProperty() {
return QueryBuilder.apply(this, (query) {
return query.addProperty(2);
});
}
}
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Organism _$OrganismFromJson(Map<String, dynamic> json) => Organism()
..id = (json['id'] as num).toInt()
..name = json['Name'] as String?
..measures = (json['Maßnahmen'] as List<dynamic>?)
?.map((e) => IdValue.fromJson(e as Map<String, dynamic>))
.toList();
Map<String, dynamic> _$OrganismToJson(Organism instance) => <String, dynamic>{
'id': instance.id,
'Name': instance.name,
'Maßnahmen': instance.measures?.map((e) => e.toJson()).toList(),
};

View file

@ -1,30 +1,12 @@
import 'dart:convert';
import 'package:ambito/src/domain/entity/entities.dart';
import 'package:ambito/src/domain/entity/funding_program/funding_program.dart';
import 'package:ambito/src/packages/ambito_api/restclient.dart';
import 'package:ambito/src/packages/ambito_db/repositories/funding_program_repository.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import '../ambito_db/repositories/baumarten_repository.dart';
import '../ambito_db/repositories/massnahme_repository.dart';
Map<String, int> tables = {
'massnahmen': 328253,
'massnahmenkombination': 328217,
'organismen': 328255,
'foerderprogramme': 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,
};
import '../ambito_db/base_db.dart';
class BaseApi {
Map tables = {};
@ -47,9 +29,26 @@ class BaseApi {
BaumartenRepository().put(Baumarten.fromJson(baumart));
}
break;
case 'massnahmen':
for (var massnahme in json['results']) {
MassnahmeRepository().put(Massnahme.fromJson(massnahme));
case 'measure':
for (var measure in json['results']) {
MeasureRepository().put(Measure.fromJson(measure));
}
break;
case 'measure_combination':
for (var measure_combination in json['results']) {
MeasureCombinationRepository()
.put(MeasureCombination.fromJson(measure_combination));
}
break;
case 'organism':
for (var organism in json['results']) {
OrganismRepository().put(Organism.fromJson(organism));
}
break;
case 'funding_program':
for (var fundingProgram in json['results']) {
FundingProgramRepository()
.put(FundingProgram.fromJson(fundingProgram));
}
break;
}

View file

@ -3,6 +3,11 @@ 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';
abstract class BaseDB {
abstract IsarCollection collection;

View file

@ -0,0 +1,9 @@
import 'package:ambito/src/domain/entity/funding_program/funding_program.dart';
import 'package:ambito/src/packages/ambito_db/base_db.dart';
import 'package:isar/isar.dart';
import '../../../../main.dart';
class FundingProgramRepository extends BaseDB {
IsarCollection collection = isar.fundingPrograms;
}

View file

@ -0,0 +1,9 @@
import 'package:ambito/src/domain/entity/entities.dart';
import 'package:ambito/src/packages/ambito_db/base_db.dart';
import 'package:isar/isar.dart';
import '../../../../main.dart';
class MeasureCombinationRepository extends BaseDB {
IsarCollection collection = isar.measureCombinations;
}

View file

@ -4,6 +4,6 @@ import 'package:isar/isar.dart';
import '../../../../main.dart';
class MassnahmeRepository extends BaseDB {
IsarCollection collection = isar.massnahmes;
class MeasureRepository extends BaseDB {
IsarCollection collection = isar.measures;
}

View file

@ -0,0 +1,9 @@
import 'package:ambito/src/domain/entity/entities.dart';
import 'package:ambito/src/packages/ambito_db/base_db.dart';
import 'package:isar/isar.dart';
import '../../../../main.dart';
class OrganismRepository extends BaseDB {
IsarCollection collection = isar.organisms;
}

View file

@ -1,6 +1,5 @@
import 'package:ambito/src/domain/entity/massnahme/massnahme.dart';
import 'package:ambito/src/extensions/extensions.dart';
import 'package:ambito/src/packages/ambito_db/repositories/massnahme_repository.dart';
import 'package:ambito/src/packages/ambito_db/repositories/measure_repository.dart';
import 'package:ambito/src/widgets/form/fields/field_dropdown.dart';
import 'package:ambito/src/widgets/form/fields/field_monthsrangepicker.dart';
import 'package:ambito/src/widgets/form/form_widget.dart';
@ -11,6 +10,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import '../../../main.dart';
import '../../domain/entity/entities.dart';
class ActionsPage extends StatefulWidget {
const ActionsPage({super.key});
@ -37,7 +37,7 @@ class ActionsPageState extends State<ActionsPage> {
@override
void initState() {
super.initState();
massnahmen = MassnahmeRepository().getAll();
massnahmen = MeasureRepository().getAll();
effort = [];
effect = [];
type = {};
@ -229,7 +229,7 @@ class ActionsPageState extends State<ActionsPage> {
return FormWidget(type: FormWidgetType.vertical, fields: fields);
}
Widget getCard(BuildContext context, Massnahme massnahme) {
Widget getCard(BuildContext context, Measure massnahme) {
final Map<String, Color> actionGroupColors = {
'Baulelemente': const Color(0xffFFD269),
'Begrünung': const Color(0xff40DD74),

View file

@ -186,10 +186,10 @@ packages:
dependency: transitive
description:
name: convert
sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592"
sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68
url: "https://pub.dev"
source: hosted
version: "3.1.1"
version: "3.1.2"
country_flags:
dependency: "direct main"
description:
@ -202,10 +202,10 @@ packages:
dependency: transitive
description:
name: crypto
sha256: ec30d999af904f33454ba22ed9a86162b35e52b44ac4807d1d93c288041d7d27
sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855"
url: "https://pub.dev"
source: hosted
version: "3.0.5"
version: "3.0.6"
cupertino_icons:
dependency: "direct main"
description:
@ -298,10 +298,10 @@ packages:
dependency: transitive
description:
name: fixnum
sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1"
sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be
url: "https://pub.dev"
source: hosted
version: "1.1.0"
version: "1.1.1"
flutter:
dependency: "direct main"
description: flutter
@ -630,10 +630,10 @@ packages:
dependency: transitive
description:
name: logging
sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340"
sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61
url: "https://pub.dev"
source: hosted
version: "1.2.0"
version: "1.3.0"
macros:
dependency: transitive
description:
@ -774,10 +774,10 @@ packages:
dependency: transitive
description:
name: permission_handler_android
sha256: "76e4ab092c1b240d31177bb64d2b0bea43f43d0e23541ec866151b9f7b2490fa"
sha256: "71bbecfee799e65aff7c744761a57e817e73b738fedf62ab7afd5593da21f9f1"
url: "https://pub.dev"
source: hosted
version: "12.0.12"
version: "12.0.13"
permission_handler_apple:
dependency: transitive
description:
@ -822,10 +822,10 @@ packages:
dependency: transitive
description:
name: platform
sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65"
sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984"
url: "https://pub.dev"
source: hosted
version: "3.1.5"
version: "3.1.6"
plugin_platform_interface:
dependency: transitive
description:
@ -1019,26 +1019,26 @@ packages:
dependency: transitive
description:
name: syncfusion_flutter_core
sha256: becd190595cba56feac5ec17b805b35df9f006171c131c209f79b5c58fc780eb
sha256: dde81d3a318d914e26b6882051c486b0f5e4fa13e7bc3661741de78f0397fe64
url: "https://pub.dev"
source: hosted
version: "27.1.53"
version: "27.1.56"
syncfusion_flutter_datepicker:
dependency: "direct main"
description:
name: syncfusion_flutter_datepicker
sha256: "5638805bea1c70a6d46dea9d39ef67f0085176e1c15cf57f7036cf67c1568816"
sha256: e4d42b03b69e80b5936f44d420f9577542f8b156ba5ee78a05e28b23ed63c850
url: "https://pub.dev"
source: hosted
version: "27.1.53"
version: "27.1.56"
syncfusion_localizations:
dependency: "direct main"
description:
name: syncfusion_localizations
sha256: "742cd5df17f6438628655b7a16d1ee87624166a9dd0362cb818d9f6968ffbc10"
sha256: "6dbc2eab1d70fad7b8501c44198bef4d36748cc6860252dfd4c8cfe2f3b10e7b"
url: "https://pub.dev"
source: hosted
version: "27.1.53"
version: "27.1.56"
synchronized:
dependency: transitive
description:
@ -1083,10 +1083,10 @@ packages:
dependency: transitive
description:
name: typed_data
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006
url: "https://pub.dev"
source: hosted
version: "1.3.2"
version: "1.4.0"
unicode:
dependency: transitive
description: