mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-08-06 03:39:15 +02:00
fix:#65 reworked path param upgrade
This commit is contained in:
@@ -24,24 +24,17 @@ import (
|
||||
"htwkalender/data-manager/service/db"
|
||||
)
|
||||
|
||||
func CreateIndividualFeed(requestBody []byte, app *pocketbase.PocketBase) (string, error) {
|
||||
var modules []model.FeedCollection
|
||||
|
||||
err := json.Unmarshal(requestBody, &modules)
|
||||
if err != nil {
|
||||
return "", apis.NewNotFoundError("Could not parse request body", err)
|
||||
}
|
||||
|
||||
func CreateIndividualFeed(modules []model.FeedCollection, pb *pocketbase.PocketBase) (string, error) {
|
||||
var icalFeed model.Feed
|
||||
jsonModules, _ := json.Marshal(modules)
|
||||
icalFeed.Modules = string(jsonModules)
|
||||
|
||||
collection, dbError := app.FindCollectionByNameOrId("feeds")
|
||||
collection, dbError := pb.FindCollectionByNameOrId("feeds")
|
||||
if dbError != nil {
|
||||
return "", apis.NewNotFoundError("Collection could not be found", dbError)
|
||||
}
|
||||
|
||||
record, err := db.SaveFeed(icalFeed, collection, app)
|
||||
record, err := db.SaveFeed(icalFeed, collection, pb)
|
||||
if err != nil {
|
||||
return "", apis.NewNotFoundError("Could not save feed", err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user