Giter Club home page Giter Club logo

lexoffice-analytics's Introduction

lexoffice Analytics

Save and visualize data from the lexoffice Public API.

This project contains a Rust workspace with the following components:

  • lexoffice-cli: User application which supports commands to fetch and save data from lexoffice. Data will be saved to a MongoDB Cluster, self-hosting with PostgreSQL may be supported in the future.
  • lexoffice-models: Contains types for stored data and functions for converting to/from lexoffice types
  • openapi: Library containing types from lexoffice API and functions for executing API calls. Generated by OpenAPI Generator using the OpenAPI specification in lexoffice-api.yml
  • Web App: May be implemented in the future to support visualizing or interacting with the stored data

lexoffice-cli

When running the CLI, the following environment variables are expected to be set:

  • DATABASE_URL: Connection string to your MongoDB instance (mongodb://[user]:[password]@[host]:[port]/[connection options])
  • LEXOFFICE_APIKEY: API Key for Lexoffice account (create one here)

Usage

The following subcommands are supported at the moment:

  • sync: Fetch vouchers from lexoffice and save them into MongoDB
  • help: Show help for usage of the CLI
$ lexoffice-cli sync <VOUCHER_TYPE> --from <FROM_DATE> --to <TO_DATE>

The argument VOUCHER_TYPE is optional and currently supports:

  • all
  • invoices

If VOUCHER_TYPE is not provided, all voucher types will be synced.

A specific date range can be provided with the optional arguments --from and --to in the format YYYY-MM-DD. If only one is provided, the maximum start/end date will be used for the other argument.

openapi

Re-generating the openapi Library Crate is only necessary after modifiying the OpenAPI spec (lexoffice-api.yml).

To do this, first install the required dependencies for Node.js (only once). Then the OpenAPI client can be generated using the generate script:

$ npm install
$ npm run generate

Run in Docker

For the current state of the CLI application, it's kind of pointless to run it in Docker, but the idea is that it could be extended, e.g. to expose an API to a Web App, from where synchronizing data could be triggered and the stored data could be visualized or even be edited/extended. However, running in Docker gives you the benefit to self-host your MongoDB instance.

For the db Service, you need to set the environment variables MONGO_INITDB_ROOT_USERNAME and MONGO_INITDB_ROOT_PASSWORD and then modify your MongoDB connection string (DATABASE_URL), containing the correct authentication credentials.

Then simply run docker-compose up db and interact with the MongoDB container by running commands from the cli service, e.g.: docker-compose run cli sync invoices.

lexoffice-analytics's People

Contributors

maikerlab avatar

Watchers

 avatar

lexoffice-analytics's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.