miniweb/docs/readme.md
2024-06-01 21:07:08 +02:00

39 lines
1.8 KiB
Markdown

# Documentation for Miniweb
## Rear
### The Repository Concept
The idea is, that whatever datasource you have, you implement the AdminRepository Trait to make it usable in the Administration overview.
Your Repository Implementation can then be used to either instance multiple different datasources compatible to your implementation, or just to a specific one.
Adjusting the List, View and Edit Forms of the admin on the other hand is done with using the namespacing of the templates.
Finally, expanding the Administration with new urls should be possible as well, to adjust the admin to your projects' needs.
You can see an AdminRepository like a ModelAdmin in Django, however without the automatic binding to an internal ORM.
The goal later on is also to provide Macros for major ORMs to quickly create such Repositories
The idea is to have a backend platform to build on, without binding you to a specific solution overall.
However, obviously, the chosen libraries of tokio, axum and minijinja, and the primary ORM with sea-orm most likely will work best.
### Writing an Admin Repository
To implement an Admin Repository, you can look at the empty_repository example.
the AdminRepository trait requires you to implement:
- an associated type Key, that implements PrimaryKeyType
- *key_from_string*, which transforms a String into your Key
- *info* for the Registry (producing an instance of RepositoryInformation)
- *list* your repository items, with optional pagination
- *create* a new entry into your repository (data is json serialized)
- *get* a single entry of your repository
- *update* an entry in your repository partially (patch)
- *replace* an entry in your repository (put)
- *delete* a single entry in your repository