Skip to content

Commit

Permalink
Delete endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
essenciary committed Nov 8, 2024
1 parent e556d3f commit b982573
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "GenieBuilder"
uuid = "c9453c14-af8a-11ec-351d-c7c9a2035d70"
authors = ["Adrian Salceanu"]
version = "0.19.2"
version = "0.19.4"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand Down Expand Up @@ -34,7 +34,7 @@ Genie = "5.31"
GenieAutoReload = "2.2.4"
GenieCache = "2"
GenieCacheFileCache = "2"
GenieDevTools = "2.11"
GenieDevTools = "2.12"
GeniePackageManager = "1.1.0"
HTTP = "1"
Inflector = "1"
Expand All @@ -44,7 +44,7 @@ RemoteREPL = "0.2"
Scratch = "1.1"
SearchLight = "2.10"
SearchLightSQLite = "2.2.2"
Stipple = "0.28.17"
Stipple = "0.28.18"
StippleUI = "0.23"
TOML = "1"
ZipFile = "0.10.1"
Expand Down
22 changes: 22 additions & 0 deletions app/resources/applications/ApplicationsController.jl
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,28 @@ function save(app::Application)
end
end

"""
delete(app)
Deletes a file from an app
"""
function delete(app::Application)
if @isonline(app)
res = try
@async notify("started:delete", app.id) |> errormonitor

HTTP.request("GET", "$(apphost):$(app.port)$(GenieDevTools.defaultroute)/delete?path=$(params(:path, "."))")
catch ex
@error ex
@async notify("failed:delete", app.id, FAILSTATUS, ERROR_STATUS) |> errormonitor
end

@async notify("ended:delete", app.id) |> errormonitor

res |> json2json
end
end

"""
pages(app)
Expand Down
5 changes: 5 additions & 0 deletions routes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ function register_routes()
ApplicationsController.save(params(:appid) |> ApplicationsController.get)
end

# returns the contents of a file from an app
route("$api_route$app_route/delete") do
ApplicationsController.delete(params(:appid) |> ApplicationsController.get)
end

# returns the pages of an app
route("$api_route$app_route/pages") do
ApplicationsController.pages(params(:appid) |> ApplicationsController.get)
Expand Down

0 comments on commit b982573

Please sign in to comment.