diff --git a/Dockerfile b/Dockerfile
index 805420e..08b4ecf 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -6,7 +6,7 @@ COPY frontend/package.json frontend/pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile --shamefully-hoist
COPY frontend .
RUN pnpm build
-
+RUN ls -la /app/.output/
# Build API
FROM golang:alpine AS builder
RUN apk update
@@ -14,8 +14,9 @@ RUN apk upgrade
RUN apk add --update git build-base gcc g++
WORKDIR /go/src/app
COPY ./backend .
-COPY --from=frontend-builder app/.output go/src/app/app/api/public
RUN go get -d -v ./...
+RUN rm -rf ./app/api/public
+COPY --from=frontend-builder /app/.output/public ./app/api/public
RUN CGO_ENABLED=1 GOOS=linux go build -o /go/bin/api -v ./app/api/*.go
# Production Stage
diff --git a/README.md b/README.md
index 7932b08..3f92dfc 100644
--- a/README.md
+++ b/README.md
@@ -19,15 +19,15 @@
- [ ] Items CRUD
- [x] Create
- [ ] Update
- - [ ] Delete
+ - [x] Delete
- [ ] Asset Attachments for Items
- [x] Bulk Import via CSV
- [ ] Documentation
- [ ] Docker Compose
- [ ] Import CSV Format
- [ ] TLDR; Getting Started
-- [ ] Release Flow
- - [ ] CI/CD Docker Builds w/ Multi-arch
+- [x] Release Flow
+ - [x] CI/CD Docker Builds w/ Multi-arch
- [ ] Db Migrations
- [ ] How To
- [ ] Repo House Keeping
diff --git a/backend/internal/services/service_items.go b/backend/internal/services/service_items.go
index 00b54c9..40ac207 100644
--- a/backend/internal/services/service_items.go
+++ b/backend/internal/services/service_items.go
@@ -50,7 +50,21 @@ func (svc *ItemService) Create(ctx context.Context, gid uuid.UUID, data types.It
return mappers.ToItemOut(item), nil
}
func (svc *ItemService) Delete(ctx context.Context, gid uuid.UUID, id uuid.UUID) error {
- panic("implement me")
+ item, err := svc.repo.Items.GetOne(ctx, id)
+ if err != nil {
+ return err
+ }
+
+ if item.Edges.Group.ID != gid {
+ return ErrNotOwner
+ }
+
+ err = svc.repo.Items.Delete(ctx, id)
+ if err != nil {
+ return err
+ }
+
+ return nil
}
func (svc *ItemService) Update(ctx context.Context, gid uuid.UUID, data types.ItemUpdate) (*types.ItemOut, error) {
panic("implement me")
diff --git a/fly.toml b/fly.toml
new file mode 100644
index 0000000..81c3a3c
--- /dev/null
+++ b/fly.toml
@@ -0,0 +1,40 @@
+# fly.toml file generated for homebox on 2022-09-08T16:00:08-08:00
+
+app = "homebox"
+kill_signal = "SIGINT"
+kill_timeout = 5
+processes = []
+
+
+[env]
+ PORT = "7745"
+
+[experimental]
+ allowed_public_ports = []
+ auto_rollback = true
+
+[[services]]
+ http_checks = []
+ internal_port = 7745
+ processes = ["app"]
+ protocol = "tcp"
+ script_checks = []
+ [services.concurrency]
+ hard_limit = 25
+ soft_limit = 20
+ type = "connections"
+
+ [[services.ports]]
+ force_https = true
+ handlers = ["http"]
+ port = 80
+
+ [[services.ports]]
+ handlers = ["tls", "http"]
+ port = 443
+
+ [[services.tcp_checks]]
+ grace_period = "1s"
+ interval = "15s"
+ restart_limit = 0
+ timeout = "2s"
diff --git a/frontend/components/Base/SectionHeader.vue b/frontend/components/Base/SectionHeader.vue
index 55cb21e..13442bd 100644
--- a/frontend/components/Base/SectionHeader.vue
+++ b/frontend/components/Base/SectionHeader.vue
@@ -12,6 +12,9 @@
+
+
+
diff --git a/frontend/lib/api/classes/items.ts b/frontend/lib/api/classes/items.ts
index 472ddbd..86e39af 100644
--- a/frontend/lib/api/classes/items.ts
+++ b/frontend/lib/api/classes/items.ts
@@ -33,15 +33,15 @@ export interface Item {
export class ItemsApi extends BaseAPI {
async getAll() {
- return this.http.get>(route('/items'));
+ return this.http.get>({ url: route('/items') });
}
async create(item: ItemCreate) {
- return this.http.post(route('/items'), item);
+ return this.http.post({ url: route('/items'), body: item });
}
async get(id: string) {
- const payload = await this.http.get- (route(`/items/${id}`));
+ const payload = await this.http.get
- ({ url: route(`/items/${id}`) });
if (!payload.data) {
return payload;
@@ -55,10 +55,17 @@ export class ItemsApi extends BaseAPI {
}
async delete(id: string) {
- return this.http.delete(route(`/items/${id}`));
+ return this.http.delete({ url: route(`/items/${id}`) });
}
async update(id: string, item: ItemCreate) {
- return this.http.put(route(`/items/${id}`), item);
+ return this.http.put({ url: route(`/items/${id}`), body: item });
+ }
+
+ async import(file: File) {
+ const formData = new FormData();
+ formData.append('csv', file);
+
+ return this.http.post({ url: route('/items/import'), data: formData });
}
}
diff --git a/frontend/lib/api/classes/labels.ts b/frontend/lib/api/classes/labels.ts
index 2024736..5ecf2e7 100644
--- a/frontend/lib/api/classes/labels.ts
+++ b/frontend/lib/api/classes/labels.ts
@@ -16,22 +16,22 @@ export type Label = LabelCreate &
export class LabelsApi extends BaseAPI {
async getAll() {
- return this.http.get>(route('/labels'));
+ return this.http.get>({ url: route('/labels') });
}
- async create(label: LabelCreate) {
- return this.http.post(route('/labels'), label);
+ async create(body: LabelCreate) {
+ return this.http.post({ url: route('/labels'), body });
}
async get(id: string) {
- return this.http.get