Skip to content

Commit 5b579cb

Browse files
committed
chore: Generated Files.FileUploadRequest resource
Generated the `Files.FileDownloadRequest` resource using the command ```bash mix ash.gen.resource Edgehog.Files.FileUploadRequest \\ --default-actions read,destroy \\ --uuid-v7-primary-key id \\ --attribute url:string:required:public \\ --attribute source:string:public \\ --attribute compression:string:public \\ --attribute progress_enabled:boolean:public \\ --attribute status:string:public \\ --attribute progress_percentage:integer:public \\ --attribute response_code:integer:public \\ --attribute response_message:string:public \\ --relationship belongs_to:device:Edgehog.Devices.Device:required:public \\ --timestamps \\ --extend postgres,graphql ```` Signed-off-by: Osman Hadzic <osman.hadzic@secomind.com>
1 parent 712f460 commit 5b579cb

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#
2+
# This file is part of Edgehog.
3+
#
4+
# Copyright 2026 SECO Mind Srl
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
# SPDX-License-Identifier: Apache-2.0
19+
#
20+
21+
defmodule Edgehog.Files.FileUploadRequest do
22+
@moduledoc false
23+
use Ash.Resource,
24+
otp_app: :edgehog,
25+
domain: Edgehog.Files,
26+
extensions: [AshGraphql.Resource],
27+
data_layer: AshPostgres.DataLayer
28+
29+
graphql do
30+
type :file_upload_request
31+
end
32+
33+
actions do
34+
defaults [:read, :destroy]
35+
end
36+
37+
attributes do
38+
uuid_v7_primary_key :id
39+
40+
attribute :url, :string do
41+
allow_nil? false
42+
public? true
43+
end
44+
45+
attribute :source, :string do
46+
public? true
47+
end
48+
49+
attribute :compression, :string do
50+
public? true
51+
end
52+
53+
attribute :progress_enabled, :boolean do
54+
public? true
55+
end
56+
57+
attribute :status, :string do
58+
public? true
59+
end
60+
61+
attribute :progress_percentage, :integer do
62+
public? true
63+
end
64+
65+
attribute :response_code, :integer do
66+
public? true
67+
end
68+
69+
attribute :response_message, :string do
70+
public? true
71+
end
72+
73+
timestamps()
74+
end
75+
76+
relationships do
77+
belongs_to :device, Edgehog.Devices.Device do
78+
allow_nil? false
79+
public? true
80+
end
81+
end
82+
83+
postgres do
84+
table "file_upload_requests"
85+
repo Edgehog.Repo
86+
end
87+
end

backend/lib/edgehog/files/files.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,7 @@ defmodule Edgehog.Files do
9191
resource FileDownloadRequest do
9292
define :send_file_download_request, args: [:file_download_request]
9393
end
94+
95+
resource Edgehog.Files.FileUploadRequest
9496
end
9597
end

0 commit comments

Comments
 (0)