Skip to content

Commit 941f8dc

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 941f8dc

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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 Edgehog.MultitenantResource,
24+
domain: Edgehog.Files,
25+
extensions: [AshGraphql.Resource]
26+
27+
graphql do
28+
type :file_upload_request
29+
end
30+
31+
actions do
32+
defaults [:read, :destroy]
33+
end
34+
35+
attributes do
36+
uuid_v7_primary_key :id
37+
38+
attribute :url, :string do
39+
allow_nil? false
40+
public? true
41+
end
42+
43+
attribute :source, :string do
44+
public? true
45+
end
46+
47+
attribute :compression, :string do
48+
public? true
49+
end
50+
51+
attribute :progress_enabled, :boolean do
52+
public? true
53+
end
54+
55+
attribute :status, :string do
56+
public? true
57+
end
58+
59+
attribute :progress_percentage, :integer do
60+
public? true
61+
end
62+
63+
attribute :response_code, :integer do
64+
public? true
65+
end
66+
67+
attribute :response_message, :string do
68+
public? true
69+
end
70+
71+
timestamps()
72+
end
73+
74+
relationships do
75+
belongs_to :device, Edgehog.Devices.Device do
76+
allow_nil? false
77+
public? true
78+
end
79+
end
80+
81+
postgres do
82+
table "file_upload_requests"
83+
repo Edgehog.Repo
84+
end
85+
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)