Compare commits

...

26 commits

Author SHA1 Message Date
Frank Denzer
fdabfcf741 Merge branch 'backend'
# Conflicts:
#	.gitignore
#	db_scripts/create.sql
2023-07-16 19:32:47 +02:00
Frank Denzer
b3274f1a2a amend gitignore for server 2023-07-16 15:19:20 +02:00
Frank Denzer
8f6c4ac81a start server project 2023-07-16 15:15:47 +02:00
Frank Denzer
70818931aa fix readme 2023-07-15 16:18:38 +02:00
Frank Denzer
3bfab0bcae fix readme 2023-07-15 16:17:58 +02:00
Frank Denzer
f3aac41876 add readme content: branches 2023-07-15 16:09:26 +02:00
Frank Denzer
220025e109 add readme content: branches 2023-07-15 16:09:03 +02:00
7388527c43 merged a simple logic for the basket 2023-07-04 22:07:00 +02:00
f0415a22da added default locale 2023-06-27 00:48:14 +02:00
496a1f2857 changed Readme 2023-06-26 18:05:46 +02:00
e0b571a808 added settings 2023-06-26 17:42:09 +02:00
e0aa77fb96 added settings.dart 2023-06-26 17:43:33 +02:00
2f84e61ba1 edited Readme 2023-06-26 17:08:32 +02:00
df255d71b8 product categories and other improvements 2023-06-25 21:11:10 +02:00
000f141b5a prototype for shopping tab 2023-06-25 19:10:29 +02:00
4da346f6d7 added prototype for editing baskets 2023-06-25 18:11:26 +02:00
0ee26fedb0 added a prototype for a basket 2023-06-25 15:11:23 +02:00
7c9d449c63 added Pfand to sample data 2023-06-25 14:01:19 +02:00
4bbd70464f restructured sample data again 2023-06-25 12:04:17 +02:00
26d0735bcf Trash-Filter aktualisiert 2023-06-23 14:43:54 +02:00
ee0c6190a5 Datei zum Löschen der Tabellen angelegt 2023-06-23 13:10:33 +02:00
f0bb37c38c Tippfehler korrigiert 2023-06-23 12:34:37 +02:00
3bf0ec4ff8 Merge pull request 'fix inconsistency' (#1) from fdenzer-patch-1 into db_scripts
Reviewed-on: #1
2023-06-23 10:51:13 +02:00
9f9bf7205b fix inconsistency 2023-06-23 10:48:27 +02:00
d711eef20d Umstellung auf Sqlite
* Anpassung des Erstellungsscripts
* Beschreibung des Zugriffs und Einlesen der Datei (momentan noch nicht funktional)
2023-06-16 14:07:02 +02:00
793d3e02e1 Aufsetzen von MariaDB 2023-06-16 12:18:13 +02:00
16 changed files with 532 additions and 170 deletions

2
.gitignore vendored
View file

@ -1,2 +1,4 @@
.idea .idea
db/* db/*
backend/target/*

View file

@ -14,3 +14,21 @@ A few resources to get you started if this is your first Flutter project:
For help getting started with Flutter development, view the For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials, [online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference. samples, guidance on mobile development, and a full API reference.
## toDo
- Einstellungen
- darkmode
- Secure Storage: https://pub.dev/packages/flutter_secure_storage
- Einkauf
- Finance
- Einkaufskorb editieren
- nur 1 Monat lang möglich
- Speichern des veränderten Warenkorbs
- redesign (statefull)
- farbliche Hervorhebungen
- ausstehende Beträge für monatliche Aufladungen
- eventuell muss sample data angepasst werden
- pre-Release:
- semanticLabels, Screenreader-Support
- Error-Management (throws)

View file

@ -1,32 +1,75 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'sample_data.dart'; import 'sample_data.dart';
/* todo:
- Flag für Ansicht/Bearbeitung
- individuelle Icons je nach Kategorie
- Pfand
- Gesamtpreis
*/
class ShowBasket extends StatelessWidget { class ShowBasket extends StatelessWidget {
ShowBasket({super.key}); final Basket basket;
final bool editable;
const ShowBasket(this.basket, {this.editable = false, super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column(
children: [
Expanded(
child: getBasket(basket),
),
const Divider(),
ListTile(
leading: const Icon(
Icons.euro,
),
title: const Text(
'Kosten:',
),
subtitle: Text(
'${basket.price}',
),
trailing: editable
? Row(
mainAxisSize: MainAxisSize.min,
children: [
FloatingActionButton(
backgroundColor: Colors.redAccent.shade100,
child: const Icon(Icons.remove_shopping_cart),
onPressed: () {}),
const SizedBox(
width: 10,
),
FloatingActionButton(
child: const Icon(Icons.shopping_cart_checkout),
onPressed: () {}),
],
)
: null),
],
);
}
ListView getBasket(Basket basket) {
return ListView.builder( return ListView.builder(
itemCount: null, itemCount: basket.purchases.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
if (index < SampleData().basket.purchases.length) {
return Card( return Card(
child: ListTile( child: ListTile(
leading: const Icon(Icons.abc), leading: Text(
title: Text(SampleData().basket.purchases[index].product.name), basket.purchases.keys.elementAt(index).category.icon,
//trailing: Text(), style: const TextStyle(fontSize: 24),
), ),
title: Text(basket.purchases.keys.elementAt(index).name),
subtitle: Text(
'${basket.purchases.values.elementAt(index)} ${basket.purchases.keys.elementAt(index).unit}'),
trailing: editable
? SizedBox(
width: 100,
child: TextField(
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.digitsOnly
]),
)
: null),
); );
} else {
return null;
}
}, },
); );
} }

View file

@ -4,22 +4,13 @@ import 'package:intl/date_symbol_data_local.dart';
import 'basket.dart'; import 'basket.dart';
import 'sample_data.dart'; import 'sample_data.dart';
/*
todo:
- Einkauf und Settings
- Warenkorb
- Aufladungen?
- farbliche Hervorhebungen
- semanticLabels, Screenreader
- monatliche Aufladung: ausstehende Beträge
*/
class Finance extends StatelessWidget { class Finance extends StatelessWidget {
const Finance({super.key}); const Finance({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
initializeDateFormatting('de_DE'); initializeDateFormatting('de_DE');
Intl.defaultLocale = 'de_DE';
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
@ -38,50 +29,26 @@ class Finance extends StatelessWidget {
), ),
), ),
body: ListView.builder( body: ListView.builder(
itemCount: null, itemCount: SampleData().transactions.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
if (index < SampleData().transactions.length) {
return Card( return Card(
child: ListTile( child: ListTile(
leading: getIcon(SampleData().transactions[index].type), leading: getIcon(SampleData().transactions[index].type),
title: Text( title:
gettitle(SampleData().transactions[index].type)), Text(gettitle(SampleData().transactions[index].type)),
subtitle: getSubtitle(index), subtitle: getSubtitle(SampleData().transactions[index]),
trailing: SampleData().transactions[index].type == trailing: getTrailing(context, index),
TransaktionArt.einkauf onTap: (SampleData().transactions[index].basket != null)
? PopupMenuButton( ? () {
onSelected: (value) {},
itemBuilder: (BuildContext context) =>
<PopupMenuEntry<String>>[
const PopupMenuItem<String>(
value: 'Option',
child: ListTile(
leading: Icon(Icons.manage_history),
title: Text('Warenkorb bearbeiten')),
),
const PopupMenuItem<String>(
value: 'Option',
child: ListTile(
leading:
Icon(Icons.remove_shopping_cart),
title: Text('Einkauf stornieren')),
),
],
)
: null,
onTap: () {
if (SampleData().transactions[index].type ==
TransaktionArt.einkauf) {
showBottomSheet( showBottomSheet(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return ShowBasket(); return ShowBasket(SampleData()
.transactions[index]
.basket!);
}); });
} }
})); : null));
} else {
return null;
}
})); }));
} }
@ -94,17 +61,18 @@ class Finance extends StatelessWidget {
case TransaktionArt.korrektur: case TransaktionArt.korrektur:
return 'Korrektur'; return 'Korrektur';
case TransaktionArt.monatlBeitrag: case TransaktionArt.monatlBeitrag:
return 'monatlicher Beitrag'; return 'Monatlicher Beitrag';
default:
return 'Ein Error ist aufgetreten';
} }
} }
Text getSubtitle(int index) { Text getSubtitle(Transaction transaction) {
String text = '${SampleData().transactions[index].amount / 100}'; String text = '${transaction.amount / 100}';
text += ''; text += '';
text += DateFormat("EEEE, dd. MMMM yyyy HH:mm", 'de_DE') text += DateFormat("EEEE, dd. MMMM yyyy HH:mm").format(transaction.date);
.format(SampleData().transactions[index].date); if (transaction.description != null) {
if (SampleData().transactions[index].description != null) { (text += '\n${transaction.description}');
(text += '\n${SampleData().transactions[index].description}');
} }
return Text(text); return Text(text);
@ -116,10 +84,28 @@ class Finance extends StatelessWidget {
return const Icon(Icons.savings); return const Icon(Icons.savings);
case TransaktionArt.einkauf: case TransaktionArt.einkauf:
return const Icon(Icons.shopping_basket); return const Icon(Icons.shopping_basket);
case TransaktionArt.korrektur:
return const Icon(Icons.priority_high);
case TransaktionArt.monatlBeitrag: case TransaktionArt.monatlBeitrag:
return const Icon(Icons.payment); return const Icon(Icons.payment);
default:
return const Icon(Icons.priority_high);
}
}
getTrailing(BuildContext context, int index) {
if (SampleData().transactions[index].type == TransaktionArt.einkauf) {
return IconButton(
icon: const Icon(Icons.manage_history),
onPressed: () {
showBottomSheet(
context: context,
builder: (BuildContext context) {
return ShowBasket(SampleData().transactions[index].basket!,
editable: true);
});
},
);
} else {
return null;
} }
} }
} }

View file

@ -1,4 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mitgliederladen/shopping.dart';
import 'package:mitgliederladen/settings.dart';
import 'finance.dart'; import 'finance.dart';
void main() { void main() {
@ -17,17 +19,19 @@ class MyApp extends StatelessWidget {
//darkgreen:5f7c61, mediumgreen: 66906a, lightgreen: 9cbe96, yellow: f5de64 //darkgreen:5f7c61, mediumgreen: 66906a, lightgreen: 9cbe96, yellow: f5de64
useMaterial3: true, useMaterial3: true,
brightness: Brightness.light, brightness: Brightness.light,
textTheme: Typography.englishLike2021,
colorScheme: ColorScheme.fromSeed( colorScheme: ColorScheme.fromSeed(
brightness: Brightness.light, brightness: Brightness.light,
seedColor: const Color(0xff5f7c61))), seedColor: const Color(0xff5f7c61))),
darkTheme: ThemeData( darkTheme: ThemeData(
useMaterial3: true, useMaterial3: true,
brightness: Brightness.dark, brightness: Brightness.dark,
textTheme: Typography.englishLike2021,
colorScheme: ColorScheme.fromSeed( colorScheme: ColorScheme.fromSeed(
brightness: Brightness.dark, brightness: Brightness.dark,
seedColor: const Color(0xff5f7c61), seedColor: const Color(0xff5f7c61),
)), )),
themeMode: ThemeMode.dark, themeMode: ThemeMode.system,
home: const MyHomePage(), home: const MyHomePage(),
); );
} }
@ -76,21 +80,9 @@ class _MyHomePageState extends State<MyHomePage> {
], ],
), ),
body: <Widget>[ body: <Widget>[
Container( const Shopping(),
color: Colors.red, const Finance(),
alignment: Alignment.center, const Settings()
child: Text('Page $test'),
),
Finance(),
ListView(children: const <Widget>[
ListTile(
leading: Icon(Icons.dark_mode),
title: Text(
'Hier könnten Einstellungen zu Darkmode mit shared_preferences und riverpod sein',
maxLines: 2,
),
)
])
][currentPageIndex], ][currentPageIndex],
); );
} }

View file

@ -1,17 +1,15 @@
final now = DateTime.now(); import 'package:uuid/uuid.dart';
final DateTime now = DateTime.now();
enum TransaktionArt { monatlBeitrag, aufladung, einkauf, korrektur } enum TransaktionArt { monatlBeitrag, aufladung, einkauf, korrektur }
enum Unit { stueck, menge } enum Unit { stueck, menge }
enum Category { class Category {
obstUndGemuese, final String name;
brotCerealienUndAufstriche, final String icon;
getraenke, const Category({required this.name, required this.icon});
drogerieUndHaushalt,
kochenUndBacken,
oeleSossenUndGewuerze,
suessesUndKnabbereien
} }
class Transaction { class Transaction {
@ -19,84 +17,207 @@ class Transaction {
int amount; int amount;
TransaktionArt type; TransaktionArt type;
DateTime date; DateTime date;
Basket? basket;
String? description; String? description;
Transaction(this.type, this.amount, this.date, [this.description]); Transaction(
{required this.type,
required this.amount,
required this.date,
this.description,
this.basket});
} }
class Product { class Product {
final int id = 0; final int id = 0;
final String name; final String name;
final Unit unit; final Unit unit; //pro Kg oder Stück
final double price; //pro Kilogramm oder Stück final double price;
final double vat; final double vat;
final Category category; final Category category;
const Product(this.name, this.unit, this.price, this.vat, this.category); const Product(this.name, this.unit, this.price, this.vat, this.category);
} }
class Purchase {
Product product;
int amount;
Purchase(this.product, this.amount);
}
class Basket { class Basket {
List<Purchase> purchases; Map<Product, int> purchases;
int price; double price;
Basket(this.purchases, this.price); String guid;
Basket(this.purchases, this.price) : guid = const Uuid().v4();
void addItem(Product product, int quantity) {
if (purchases.containsKey(product)) {
purchases.update(
product, (existingQuantity) => existingQuantity + quantity);
} else {
purchases[product] = quantity;
}
}
void removeItem(Product product) {
purchases.remove(product);
}
} }
//sample data
class SampleData { class SampleData {
final List<Transaction> transactions = [ static const List<Category> categories = [
Transaction(TransaktionArt.monatlBeitrag, 0, now), Category(name: 'Obst und Gemüse', icon: '🍒'),
Transaction(TransaktionArt.aufladung, 2042, now), Category(name: 'Kochen und Backen', icon: '🍝'),
Transaction( Category(name: 'Brot, Cerealien & Aufstriche', icon: '🍞'),
TransaktionArt.einkauf, -2442, now.subtract(const Duration(days: 2))), Category(name: 'Getränke und Pfand', icon: '🫖'),
Transaction(TransaktionArt.korrektur, 2332, Category(name: 'Drogerie und Haushalt', icon: '🧼'),
now.subtract(const Duration(hours: 5)), 'Korrektur des Warenkorbs'), Category(name: 'Öl, Soßen und Gewürze', icon: '🫚'),
Transaction(TransaktionArt.monatlBeitrag, 0, now), Category(name: 'Süßes und Knabbereien', icon: '🍪')
Transaction(TransaktionArt.aufladung, 2042, now),
Transaction(
TransaktionArt.einkauf, -2442, now.subtract(const Duration(days: 2))),
Transaction(TransaktionArt.korrektur, 2332,
now.subtract(const Duration(hours: 5)), 'Korrektur des Warenkorbs'),
Transaction(TransaktionArt.monatlBeitrag, 0, now),
Transaction(TransaktionArt.aufladung, 2042, now),
Transaction(
TransaktionArt.einkauf, -2442, now.subtract(const Duration(days: 2))),
Transaction(TransaktionArt.korrektur, 2332,
now.subtract(const Duration(hours: 5)), 'Korrektur des Warenkorbs'),
Transaction(TransaktionArt.monatlBeitrag, 0, now),
Transaction(TransaktionArt.aufladung, 2042, now),
Transaction(
TransaktionArt.einkauf, -2442, now.subtract(const Duration(days: 2))),
Transaction(TransaktionArt.korrektur, 2332,
now.subtract(const Duration(hours: 5)), 'Korrektur des Warenkorbs'),
Transaction(TransaktionArt.monatlBeitrag, 0, now),
Transaction(TransaktionArt.aufladung, 2042, now),
Transaction(
TransaktionArt.einkauf, -2442, now.subtract(const Duration(days: 2))),
Transaction(TransaktionArt.korrektur, 2332,
now.subtract(const Duration(hours: 5)), 'Korrektur des Warenkorbs')
]; ];
static const List<Product> products = [ static List<Product> products = [
Product('Apfel', Unit.stueck, 0.23, 7, Category.obstUndGemuese), Product('Apfel', Unit.stueck, 0.23, 7, categories[0]),
Product('Mehl', Unit.menge, 0.003, 19, Category.kochenUndBacken), Product('Mehl', Unit.menge, 0.003, 19, categories[1]),
Product('Brot', Unit.stueck, 1.23, 7, Category.brotCerealienUndAufstriche), Product('Brot', Unit.stueck, 1.23, 7, categories[2]),
Product('Milch', Unit.stueck, 2.23, 3, Category.getraenke), Product('Milch', Unit.stueck, 2.23, 3, categories[3]),
Product('Zahnpasta', Unit.stueck, 0.23, 7, Category.drogerieUndHaushalt), Product('Zahnpasta', Unit.stueck, 0.23, 7, categories[4]),
Product('Pfeffer', Unit.stueck, 0.23, 7, Category.oeleSossenUndGewuerze), Product('Pfeffer', Unit.stueck, 0.23, 7, categories[5]),
Product('Schokolade', Unit.menge, 0.23, 7, Category.suessesUndKnabbereien) Product('Schokolade', Unit.menge, 0.23, 7, categories[6]),
Product('Flaschenpfand', Unit.stueck, -0.15, 0, categories[3])
]; ];
Basket basket = Basket([ //such a basket can not exist later. It is for testing purposes
Purchase(products[0], 20), // when scrolling through a long basket
Purchase(products[1], 2200), static Basket basket = Basket({
Purchase(products[2], 2), products[0]: 20,
Purchase(products[3], 1), products[1]: 2200,
Purchase(products[4], 1), products[2]: 2,
Purchase(products[5], 2), products[3]: 1,
Purchase(products[6], 202) products[4]: 1,
], 304); products[5]: 2,
products[6]: 222,
products[0]: 20,
products[1]: 2200,
products[2]: 2,
products[3]: 1,
products[4]: 1,
products[5]: 2,
products[6]: 222
}, 27.9);
static Basket basket2 = Basket({
products[0]: 22,
products[1]: 2241,
products[3]: 2,
products[4]: 4,
products[6]: 2,
products[7]: 5,
}, 34);
static Basket basket3 = Basket({
products[0]: 2,
products[1]: 21,
products[3]: 4,
products[4]: 1,
products[6]: 5,
}, -1);
List<Transaction> transactions = [
Transaction(
type: TransaktionArt.monatlBeitrag,
amount: 0,
date: now,
),
Transaction(
type: TransaktionArt.aufladung,
amount: 2042,
date: now,
),
Transaction(
type: TransaktionArt.einkauf,
amount: -2442,
date: now.subtract(const Duration(days: 2)),
basket: basket),
Transaction(
type: TransaktionArt.korrektur,
amount: 2332,
date: now.subtract(const Duration(hours: 5)),
description: 'Korrektur des Warenkorbs',
basket: basket3,
),
Transaction(
type: TransaktionArt.monatlBeitrag,
amount: 0,
date: now,
),
Transaction(
type: TransaktionArt.aufladung,
amount: 2042,
date: now,
),
Transaction(
type: TransaktionArt.einkauf,
amount: -2442,
date: now.subtract(const Duration(days: 2)),
basket: basket2),
Transaction(
type: TransaktionArt.korrektur,
amount: 2332,
date: now.subtract(const Duration(hours: 5)),
description: 'Korrektur des FinanzAK'),
Transaction(
type: TransaktionArt.monatlBeitrag,
amount: 0,
date: now,
),
Transaction(
type: TransaktionArt.aufladung,
amount: 2042,
date: now,
),
Transaction(
type: TransaktionArt.einkauf,
amount: -2442,
date: now.subtract(const Duration(days: 2)),
basket: basket,
),
Transaction(
type: TransaktionArt.korrektur,
amount: 2332,
date: now.subtract(const Duration(hours: 5)),
description: 'Korrektur des Warenkorbs'),
Transaction(
type: TransaktionArt.monatlBeitrag,
amount: 0,
date: now,
),
Transaction(
type: TransaktionArt.aufladung,
amount: 2042,
date: now,
),
Transaction(
type: TransaktionArt.einkauf,
amount: -2442,
date: now.subtract(const Duration(days: 2)),
basket: basket),
Transaction(
type: TransaktionArt.korrektur,
amount: 2332,
date: now.subtract(const Duration(hours: 5)),
description: 'Korrektur des Warenkorbs'),
Transaction(
type: TransaktionArt.monatlBeitrag,
amount: 0,
date: now,
),
Transaction(
type: TransaktionArt.aufladung,
amount: 2042,
date: now,
),
Transaction(
type: TransaktionArt.einkauf,
amount: -2442,
date: now.subtract(const Duration(days: 2)),
basket: basket2),
Transaction(
type: TransaktionArt.korrektur,
amount: 2332,
date: now.subtract(const Duration(hours: 5)),
description: 'Korrektur des Warenkorbs'),
];
} }

View file

@ -0,0 +1,19 @@
import 'package:flutter/material.dart';
class Settings extends StatelessWidget {
const Settings({super.key});
@override
Widget build(BuildContext context) {
//Hier in dem Return kann der Inhalt des Setting Tabs angepasst werden
return ListView(children: const <Widget>[
ListTile(
leading: Icon(Icons.dark_mode),
title: Text(
'Hier könnten Einstellungen zu Darkmode sein',
maxLines: 2,
),
)
]);
}
}

View file

@ -0,0 +1,41 @@
import 'package:flutter/material.dart';
import 'package:mitgliederladen/sample_data.dart';
class Shopping extends StatelessWidget {
const Shopping({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.shopping_cart),
onPressed: () {},
),
body: GridView.builder(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2),
itemCount: SampleData.categories.length,
itemBuilder: ((context, index) {
return Card(
child: Column(children: [
Expanded(
child: FittedBox(
fit: BoxFit.scaleDown,
child: Text(
SampleData.categories[index].icon,
style: const TextStyle(fontSize: 400),
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
SampleData.categories[index].name,
style: Theme.of(context).textTheme.labelLarge,
),
),
]),
);
})));
}
}

View file

@ -41,6 +41,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.17.1" version: "1.17.1"
crypto:
dependency: transitive
description:
name: crypto
sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
url: "https://pub.dev"
source: hosted
version: "3.0.3"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
@ -184,6 +192,22 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.5.1" version: "0.5.1"
typed_data:
dependency: transitive
description:
name: typed_data
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
url: "https://pub.dev"
source: hosted
version: "1.3.2"
uuid:
dependency: "direct main"
description:
name: uuid
sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313"
url: "https://pub.dev"
source: hosted
version: "3.0.7"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:

View file

@ -36,6 +36,7 @@ dependencies:
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2 cupertino_icons: ^1.0.2
intl: ^0.18.1 intl: ^0.18.1
uuid: ^3.0.7
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

View file

@ -1,2 +1,36 @@
# Mitgliederladen # Mitgliederladen
## Development branches
backend
: Server component, using Rust/SQL, offering API (via HTTP/2?)
db_scripts
: SQL scripts
main
: frontend client as flutter app
## Tech used
### Backend
- Database connection using Rust-lang and SQLx
- RESTful (Level 2, JSON over RPC) API using Rust-lang (and probably (actix web framework)[https://actix.rs] plus (utoipa\[sic! 🍺 beer-branded punny name\])[https://github.com/juhaku/utoipa]
## Frontend
- Google Flutter using Dart.
Target platforms?
- probably Android[^1], iOS[^2].
- Debug target could be desktop for fastest deployment. Production targets: Perhaps desktop and/or web, if wanted.
[1]: via APK? Via Play Store or F-Droid? Then Registration as Play store developer (for charity or one time purchase with credit card?) needed.
[2]: Registration as Apple developer for charity needed.

7
db_scripts/drop.sql Normal file
View file

@ -0,0 +1,7 @@
DROP TABLE IF EXISTS mitglied;
DROP TABLE IF EXISTS transaktion_art;
DROP TABLE IF EXISTS transaktion;
DROP TABLE IF EXISTS monatlicher_beitrag;
DROP TABLE IF EXISTS mwst;
DROP TABLE IF EXISTS einheit;
DROP TABLE IF EXISTS artikel;

21
server/.gitignore vendored Normal file
View file

@ -0,0 +1,21 @@
Cargo.lock
target/
guide/build/
/gh-pages
*.so
*.out
*.pyc
*.pid
*.sock
*~
.DS_Store
# These are backup files generated by rustfmt
**/*.rs.bk
# Configuration directory generated by CLion
.idea
# Configuration directory generated by VSCode
.vscode

10
server/Cargo.toml Normal file
View file

@ -0,0 +1,10 @@
[package]
name = "server"
version = "1.0.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
actix-web ="4"
utoipa = { version = "3", features = ["actix_extras"] }

15
server/readme.md Normal file
View file

@ -0,0 +1,15 @@
# installation
## windows (step 1)
choco install -y
## Linux, macos (alernate step 1)
use apt, pacman, curl, brew or whatever.
## Always (steps 2 and so on)
- `rustup-init.sh` (Windows: rustup-init.ex, e.g. %AppData%\Local\Temp\chocolatey\rustup.install\1.25.1\rustup-init.exe)
- select a good match in the dialog of this CLI installer

28
server/src/main.rs Normal file
View file

@ -0,0 +1,28 @@
use actix_web::{get, post, web, App, HttpResponse, HttpServer, Responder};
#[get("/")]
async fn hello() -> impl Responder {
HttpResponse::Ok().body("Hello world!")
}
#[post("/echo")]
async fn echo(req_body: String) -> impl Responder {
HttpResponse::Ok().body(req_body)
}
async fn manual_hello() -> impl Responder {
HttpResponse::Ok().body("Hey there!")
}
#[actix_web::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| {
App::new()
.service(hello)
.service(echo)
.route("/hey", web::get().to(manual_hello))
})
.bind(("127.0.0.1", 8080))?
.run()
.await
}