dasmerlon / tief-gang-list Goto Github PK
View Code? Open in Web Editor NEWGuest management software for events in the Tiefgang Hackspace
License: MIT License
Guest management software for events in the Tiefgang Hackspace
License: MIT License
We decided to refactor our python module setup
Database models should be all reimported to app.models
.
Models will then be used in combination with that module:
E.g. user = models.User()
The goes same for schemas. This allows us to easily see which kind of class we're working with, since they're all named similarily.
The current crud setup looked good to me.
We currently call stuff like this: crud.user.get
.
We might think about using some kind of class abstraction lateron, which implements crud
operations for us. This makes the code more generic and decreases boilerplate code, but also makes code a bit less clear, which is why we'll do this at a later stage.
Example for base class: https://github.com/tiangolo/full-stack-fastapi-postgresql/blob/master/%7B%7Bcookiecutter.project_slug%7D%7D/backend/app/app/crud/base.py
Let's create a small convenience commandline interface.
typer seems to be a reasonable choice for this.
It's fairly straight forward and looks really convenient.
I would propose to have several subcommands:
poetry run python ./main run
Just start the web serverpoetry run python ./main createdb
Create the database, enable extensions and create the schemapoetry run python ./main dropdb
Drop the databaseWe can add other functionalities lateron :)
The Justfile
should get shortcuts for those:
createdb
dropdb
resetdb
, which is basically a creatdb + dropdbIt would be a good idea to take a look at some database technologies:
We probably should add some kind of authentication, we need to think about our planned features/views and whether we want to gate some things.
Add a seed
subcommand to cli
.
This should then call a function which creates some seed data.
I.e. a Guest, an Event and a Registration for that guest + event.
Since this will be outside of a request, the Sqlalchemy-fastapi middleware won't work and we have to create a session manually. This can be done using the scoped_session + sessionmaker functions as can be seen over here:
https://github.com/Nukesor/ultimate-poll-bot/blob/main/pollbot/db.py#L22
Setup react router once #27 is merged.
This is the next step in having a full single page application (SPA).
https://reactrouter.com/en/main/start/tutorial
While at it, we might introduce a router to our backend as well to hide all routes behind a /api/*
scope
So, we should have a simple base-layout with:
Everything should be responsive, so the sidebar navigation should convert into something as soon as the screen get's too small
The Backend dependencies need to be bumped once again :)
Pydantic v2 is out and a few other dependencies got updates that need manual bumps.
Resources:
--outdate
functionAdd the basic Create, Read, Update, Delete endpoints for all models.
Add basic forms to create and edit new Events.
Those should be on a separate page, as this should work on mobile as well.
As discussed, the idea is to track how many people there're currently on-site.
Though, we don't want to track this on a per-guest basis, as we don't want to track our guest.
The idea would be to have a new table.
We then create a new row each time a guest enters or leaves the bunker.
Each row must be associated with an event.
That way, we'll have a good understanding when guests arrive and leave over the course of an event.
I'm not sure how this table should be named though :D
guest_count
count
people_count
"Count" seems a bit misleading, as there's no row with the "total" count.
We rather calculate the current count based on all rows for an events.
Something with arrival
would be misleading as well, as this table contains both, arrivals and departure.
We need a word that describes both departures and arrivals :D
There's no easy way for us to enforce SQLite's foreign key checks with the sqlalchemy fastapi middleware library we're using.
Hence, we should just use a database that's designed for this stuff :D
Let's switch to postgres.
In code:
Out of code:
# Install and start postgres
sudo pacman -S postgresql
sudo systemctl enable --now postgresql
# Login as postgres user
sudo su postgres
# Use the createuser helper to create a new database user
# Make sure it has the same name as your linux user
createuser merlon --superuser
# We make your user a supersuer, since you have to create,
# modify and drop databases during development.
# I also adivise to use no password, as we don't save
# anything important in that database anyway.
That should be it :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.