feat:#74 added security and refactored api endpoint

This commit is contained in:
masterElmar
2023-11-20 17:10:52 +01:00
parent ef9247c300
commit 426e25bf3e
5 changed files with 27 additions and 29 deletions

View File

@@ -42,11 +42,8 @@ func GetAllModulesDistinct(app *pocketbase.PocketBase, c echo.Context) error {
}
}
// GetModuleByName returns a module by its name
// If the module does not exist, an error is returned
// If the module exists, the module is returned
// Module is a struct that exists in database as events
func GetModuleByName(app *pocketbase.PocketBase, module model.Module) (model.Module, error) {
func GetModuleByUUID(app *pocketbase.PocketBase, uuid string) (model.Module, error) {
module, err := db.FindModuleByUUID(app, uuid)
events, err := db.FindAllEventsByModule(app, module)
if err != nil || len(events) == 0 {