Skip to content

Commit

Permalink
Merge pull request #42 from HTBLA-Grieskirchen/dev
Browse files Browse the repository at this point in the history
Sprint 2 Package
  • Loading branch information
TimerErTim committed Dec 6, 2022
2 parents 98f85a0 + c6fb463 commit bb4a0ec
Show file tree
Hide file tree
Showing 113 changed files with 28,285 additions and 721 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
smoke-test:
name: "Integration tests on all platforms"
name: "Integration test"
uses: HTBLA-Grieskirchen/YAMS/.github/workflows/smoke_tests.yml@dev

unit-test:
Expand All @@ -22,6 +22,8 @@ jobs:
platform: [ ubuntu-20.04, windows-latest ]

runs-on: ${{ matrix.platform }}
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand Down Expand Up @@ -54,7 +56,7 @@ jobs:
working-directory: frontend
run: npm install

- name: Build the app
- name: Release Tauri application
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -64,3 +66,5 @@ jobs:
releaseBody: 'See the assets to download this version and install.'
releaseDraft: true
prerelease: false

iconPath: resources/logos/yams.png
18 changes: 5 additions & 13 deletions .github/workflows/smoke_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,13 @@ on:

jobs:
smoke-test:
name: "Integration tests on all platforms"
strategy:
matrix:
platform: [ ubuntu-20.04 ]
name: "Integration tests"

runs-on: ${{ matrix.platform }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3

- name: Setup node
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
Expand All @@ -40,8 +37,7 @@ jobs:
workspaces: frontend/src-tauri
cache-on-failure: true

- name: Install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
Expand All @@ -51,10 +47,6 @@ jobs:
run: npm install

# Here should be integration tests but setup is complicated and therefore priority set to low
- name: Test web build
working-directory: frontend
run: npm run test

- name: Build web application
working-directory: frontend
run: npm run build && npm run export
Expand All @@ -67,7 +59,7 @@ jobs:
working-directory: frontend/src-tauri
run: cargo test

- name: Build tauri application
- name: Build Tauri application
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup node
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
working-directory: frontend/src-tauri
run: cargo test

- name: Build tauri application
- name: Build Tauri application
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea/
node_modules
history.txt
71 changes: 70 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
![YAMS Banner](resources/banner.png)
![YAMS Banner](resources/logos/banner.png)

[![HTL Grieskirchen](https://img.shields.io/badge/Education-HTL%20Grieskirchen-ffffff?style=flat&logo=internetarchive&logoColor=ffffff)](https://htl-grieskirchen.net)
[![SurrealDB](https://img.shields.io/badge/built%20on-SurrealDB-9600ff?style=flat&logo=surrealdb&labelColor=ff00a0&logoColor=171a21)](https://surrealdb.com)
---

**Y**et **A**nother **M**anagement **S**oftware is a management system for patients, customers and their pets.
Expand All @@ -9,11 +10,79 @@ applications are shipped with an embedded version of the data storage system and

## Introduction

The software allows management of clients, their relationships, their pets, the treatment
of both the pets and the clients, the selling of products, the provision of seminars and events, and the billing
of all those actions.

The underlying persistence model is expected to be implemented with SurrealDB, but other than that is abstracted
enough to allow flexible usage of the same codebase. This project can run as desktop application, where the data files
are stored locally on the executing machine, or as web application connected to a remote database, all using the exact
same source code. The desktop application can be configured to also connect to a remote database. More on that in
the [frontend's README](frontend/README.md).

### Possible extensions

This project may be extended in the future by adding the following features:

- [ ] Authentication in frontend and backend (required for web application deployment)
- [ ] SurrealDB websocket support in web application (required for web application deployment)
- [ ] Deployment as web application
- [ ] Move SurrealDB file storage to file system (also in remote backend)
- [ ] Integrate appointment management into homepage as interactive calendar

## Installation

The latest versions can be seen and downloaded on the
[releases page](https://github.com/HTBLA-Grieskirchen/YAMS/releases).

Once an installer (`.deb` or `.msi`) is downloaded, the installation process can be started like any other software:
Installation through package manager (Linux) or installation by opening/double-clicking the file (Windows).
The `.AppImage` can directly be executed on Linux systems.

## Usage

Once installed, the local app can be configured using a `yamsconfig.json` file which is searched for in the
system's default config path. The web app can be configured upon deployment in the
[source file](frontend/src/config/config.json).

If required, the SurrealDB can be started as described in [this README](backend/README.md).

## License

This project is licensed under a custom, non-standard derivative of the
[Boost Software License](https://www.boost.org/users/license.html).
It can be found [here](LICENSE).

## Background

Our team consists of:

- [Daniel Ferihumer](https://github.com/FerihumerD180104)
- [Julian Bachinger](https://github.com/jbachinger18)
- [David Edthaler](https://github.com/EdtDavid)
- [David Rathmair](https://github.com/drathmair)
- [Dominik Wernsdorfer](https://github.com/domiiii1320)
- [Tim Peko](https://github.com/TimerErTim)

and we are in the senior year of the [HTBLA Grieskirchen](https://htl-grieskirchen.net) medicalinformatics branch.

This project is part of our classes and developed for a private client working in the medical field.

### Technologies

We decided to use the following technologies:

- [Backend](backend)
- Database - [SurrealDB](https://surrealdb.com)
- [Frontend](frontend)
- [Web UI](frontend/src)
- Language - [TypeScript](https://www.typescriptlang.org/)
- Framework - [Next.js](https://nextjs.org/)
- State Management - [MobX](https://mobx.js.org/)
- Design - [TailwindCSS](https://mobx.js.org/)
- [Desktop App](frontend/src-tauri)
- Language - [Rust](https://rust-lang.org)
- Framework - [Tauri](https://tauri.app)
- Storage - [embedded SurrealDB](https://crates.io/crates/surrealdb)


4 changes: 2 additions & 2 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Backend using SurrealDB
# Backend <img src="../resources/builton-surrealdb-light.svg" alt="using SurrealDB" height="35"/>

The backend is implemented using SurrealDB and its embedded or native Rest capabilities. This
The backend is implemented using [SurrealDB](https://surrealdb.com) and its embedded or native Rest capabilities. This
allows us to directly access the DB with authentication and saves us from having to write
a custom backend.

Expand Down
24 changes: 12 additions & 12 deletions backend/setup.sql
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ DEFINE FIELD description ON animal_type TYPE string ASSERT $after != NULL;

DEFINE TABLE city SCHEMAFULL;

DEFINE FIELD land ON city TYPE record(land) ASSERT $after != NULL;
DEFINE FIELD country ON city TYPE record(country) ASSERT $after != NULL;
DEFINE FIELD name ON city TYPE string ASSERT $after != NULL;
DEFINE FIELD plz ON city TYPE string ASSERT $after != NULL;

Expand Down Expand Up @@ -66,6 +66,15 @@ DEFINE FIELD extra ON client_file TYPE string;
DEFINE FIELD client ON client_file TYPE record(client) ASSERT $after != NULL;
DEFINE FIELD treatment ON client_file VALUE [];

-- ------------------------------
-- TABLE: country
-- ------------------------------

DEFINE TABLE country SCHEMAFULL;

DEFINE FIELD name ON country TYPE string ASSERT $after != NULL AND string::trim($after) != "";
DEFINE FIELD short ON country TYPE string ASSERT $after != NULL AND string::trim($after) != "" AND (count((SELECT id FROM country WHERE short = $after)) < 1 OR $after == $before);

-- ------------------------------
-- TABLE: event
-- ------------------------------
Expand Down Expand Up @@ -103,21 +112,12 @@ DEFINE FIELD data ON pdf TYPE string ASSERT $after != NULL;
DEFINE TABLE invoice SCHEMAFULL;

DEFINE FIELD sum ON invoice VALUE <future> { math::sum(<-paid_in.cost) };
DEFINE FIELD is_settled ON invoice TYPE bool ASSET $after != null;
DEFINE FIELD is_settled ON invoice TYPE bool ASSERT $after != null;
DEFINE FIELD issue_date ON invoice TYPE datetime ASSERT $after != NULL;
DEFINE FIELD number ON invoice TYPE int ASSERT $after != NULL;
DEFINE FIELD receipt ON invoice TYPE record(pdf);
DEFINE FIELD transaction_type ON invoice TYPE record(transaction_type) ASSERT $after != NULL;

-- ------------------------------
-- TABLE: land
-- ------------------------------

DEFINE TABLE land SCHEMAFULL;

DEFINE FIELD name ON land TYPE string ASSERT $after != NULL;
DEFINE FIELD short ON land TYPE string ASSERT $after != NULL;

-- ------------------------------
-- TABLE: paid
-- ------------------------------
Expand Down Expand Up @@ -278,7 +278,7 @@ BEGIN TRANSACTION;


-- ------------------------------
-- TABLE DATA: land
-- TABLE DATA: country
-- ------------------------------


Expand Down
15 changes: 14 additions & 1 deletion frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ To start the app in development mode with hot reloading run:

`cargo tauri dev`

This will start the web application in dev mode and opens a Tauri window to display it.
This will start the web application and opens a Tauri window to display it.

It is recommended to export a `YAMS_DEV=1` environment variable in order to start the app in development mode.
This makes the app use paths optimized for the development process.

### Building

Expand All @@ -78,5 +81,15 @@ This bundles everything into a single distributable binary for your host system.

### Usage

The configuration file can be found under the current OS's standard config path and is named `yamsconfig.json`. It can
be used to specify a remote database connection to use, even in the local desktop app. It may for example look like
this:

```json
{
"remoteDatabaseLocation": "http://127.0.0.1:8004/rpc"
}
```

If configured to use a centralized data storage, also make sure that this storage is set up as described in the
[backend README](../backend/README.md).
Loading

0 comments on commit bb4a0ec

Please sign in to comment.