forked from mirrors/homebox
feat: item-attachments CRUD (#22)
* change /content/ -> /homebox/ * add cache to code generators * update env variables to set data storage * update env variables * set env variables in prod container * implement attachment post route (WIP) * get attachment endpoint * attachment download * implement string utilities lib * implement generic drop zone * use explicit truncate * remove clean dir * drop strings composable for lib * update item types and add attachments * add attachment API * implement service context * consolidate API code * implement editing attachments * implement upload limit configuration * improve error handling * add docs for max upload size * fix test cases
This commit is contained in:
parent
852d312ba7
commit
31b34241e0
165 changed files with 2509 additions and 664 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
||||||
# Project Specific
|
# Project Specific
|
||||||
|
backend/homebox-data/*
|
||||||
config.yml
|
config.yml
|
||||||
homebox.db
|
homebox.db
|
||||||
.idea
|
.idea
|
||||||
|
|
|
@ -29,8 +29,11 @@ RUN CGO_ENABLED=1 GOOS=linux go build \
|
||||||
# Production Stage
|
# Production Stage
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
|
|
||||||
|
ENV HBOX_MODE=production
|
||||||
|
ENV HBOX_STORAGE_DATA=/data/
|
||||||
|
ENV HBOX_STORAGE_SQLITE_URL=/data/homebox.db?_fk=1
|
||||||
|
|
||||||
RUN apk --no-cache add ca-certificates
|
RUN apk --no-cache add ca-certificates
|
||||||
COPY ./backend/config.template.yml /data/config.yml
|
|
||||||
RUN mkdir /app
|
RUN mkdir /app
|
||||||
COPY --from=builder /go/bin/api /app
|
COPY --from=builder /go/bin/api /app
|
||||||
|
|
||||||
|
|
19
Taskfile.yml
19
Taskfile.yml
|
@ -2,6 +2,9 @@ version: "3"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
generate:
|
generate:
|
||||||
|
desc: |
|
||||||
|
Generates collateral files from the backend project
|
||||||
|
including swagger docs and typescripts type for the frontend
|
||||||
cmds:
|
cmds:
|
||||||
- |
|
- |
|
||||||
cd backend && ent generate ./ent/schema \
|
cd backend && ent generate ./ent/schema \
|
||||||
|
@ -11,16 +14,26 @@ tasks:
|
||||||
- |
|
- |
|
||||||
npx swagger-typescript-api \
|
npx swagger-typescript-api \
|
||||||
--no-client \
|
--no-client \
|
||||||
--clean-output \
|
|
||||||
--modular \
|
--modular \
|
||||||
--path ./backend/app/api/docs/swagger.json \
|
--path ./backend/app/api/docs/swagger.json \
|
||||||
--output ./frontend/lib/api/types
|
--output ./frontend/lib/api/types
|
||||||
|
|
||||||
python3 ./scripts/process-types.py ./frontend/lib/api/types/data-contracts.ts
|
python3 ./scripts/process-types.py ./frontend/lib/api/types/data-contracts.ts
|
||||||
|
sources:
|
||||||
|
- "./backend/app/api/**/*"
|
||||||
|
- "./backend/app/internal/types/**/*"
|
||||||
|
- "./scripts/process-types.py"
|
||||||
|
generates:
|
||||||
|
- "./frontend/lib/api/types/data-contracts.ts"
|
||||||
|
- "./backend/app/api/docs/swagger.json"
|
||||||
|
- "./backend/app/api/docs/swagger.yaml"
|
||||||
|
|
||||||
api:
|
api:
|
||||||
|
desc: Starts the backend api server (depends on generate task)
|
||||||
|
deps:
|
||||||
|
- generate
|
||||||
cmds:
|
cmds:
|
||||||
- task: generate
|
- cd backend && go run ./app/api/ {{ .CLI_ARGS }}
|
||||||
- cd backend && go run ./app/api/ {{.CLI_ARGS}} ./config.yml
|
|
||||||
silent: false
|
silent: false
|
||||||
|
|
||||||
api:build:
|
api:build:
|
||||||
|
|
|
@ -3,12 +3,12 @@ package main
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hay-kot/content/backend/ent"
|
"github.com/hay-kot/homebox/backend/ent"
|
||||||
"github.com/hay-kot/content/backend/internal/config"
|
"github.com/hay-kot/homebox/backend/internal/config"
|
||||||
"github.com/hay-kot/content/backend/internal/repo"
|
"github.com/hay-kot/homebox/backend/internal/repo"
|
||||||
"github.com/hay-kot/content/backend/internal/services"
|
"github.com/hay-kot/homebox/backend/internal/services"
|
||||||
"github.com/hay-kot/content/backend/pkgs/mailer"
|
"github.com/hay-kot/homebox/backend/pkgs/mailer"
|
||||||
"github.com/hay-kot/content/backend/pkgs/server"
|
"github.com/hay-kot/homebox/backend/pkgs/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
type app struct {
|
type app struct {
|
||||||
|
|
|
@ -224,6 +224,222 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/v1/items/{id}/attachments": {
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"Bearer": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Items"
|
||||||
|
],
|
||||||
|
"summary": "imports items into the database",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Item ID",
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "file",
|
||||||
|
"description": "File attachment",
|
||||||
|
"name": "file",
|
||||||
|
"in": "formData",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Type of file",
|
||||||
|
"name": "type",
|
||||||
|
"in": "formData",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "name of the file including extension",
|
||||||
|
"name": "name",
|
||||||
|
"in": "formData",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/types.ItemOut"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"422": {
|
||||||
|
"description": "Unprocessable Entity",
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/server.ValidationError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/items/{id}/attachments/download": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"Bearer": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/octet-stream"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Items"
|
||||||
|
],
|
||||||
|
"summary": "retrieves an attachment for an item",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Item ID",
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Attachment token",
|
||||||
|
"name": "token",
|
||||||
|
"in": "query",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/items/{id}/attachments/{attachment_id}": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"Bearer": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/octet-stream"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Items"
|
||||||
|
],
|
||||||
|
"summary": "retrieves an attachment for an item",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Item ID",
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Attachment ID",
|
||||||
|
"name": "attachment_id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/types.ItemAttachmentToken"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"put": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"Bearer": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Items"
|
||||||
|
],
|
||||||
|
"summary": "retrieves an attachment for an item",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Item ID",
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Attachment ID",
|
||||||
|
"name": "attachment_id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Attachment Update",
|
||||||
|
"name": "payload",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/types.ItemAttachmentUpdate"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/types.ItemOut"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"delete": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"Bearer": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Items"
|
||||||
|
],
|
||||||
|
"summary": "retrieves an attachment for an item",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Item ID",
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Attachment ID",
|
||||||
|
"name": "attachment_id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"204": {
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/v1/labels": {
|
"/v1/labels": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
|
@ -818,6 +1034,17 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"server.ValidationError": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"field": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"reason": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"types.ApiSummary": {
|
"types.ApiSummary": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@ -881,11 +1108,33 @@ const docTemplate = `{
|
||||||
"id": {
|
"id": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"updatedAt": {
|
"updatedAt": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"types.ItemAttachmentToken": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"token": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"types.ItemAttachmentUpdate": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"title": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"types.ItemCreate": {
|
"types.ItemCreate": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@ -1185,9 +1434,6 @@ const docTemplate = `{
|
||||||
"description": {
|
"description": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"groupId": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"id": {
|
"id": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
@ -1214,9 +1460,6 @@ const docTemplate = `{
|
||||||
"description": {
|
"description": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"groupId": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"id": {
|
"id": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|
|
@ -216,6 +216,222 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/v1/items/{id}/attachments": {
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"Bearer": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Items"
|
||||||
|
],
|
||||||
|
"summary": "imports items into the database",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Item ID",
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "file",
|
||||||
|
"description": "File attachment",
|
||||||
|
"name": "file",
|
||||||
|
"in": "formData",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Type of file",
|
||||||
|
"name": "type",
|
||||||
|
"in": "formData",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "name of the file including extension",
|
||||||
|
"name": "name",
|
||||||
|
"in": "formData",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/types.ItemOut"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"422": {
|
||||||
|
"description": "Unprocessable Entity",
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/server.ValidationError"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/items/{id}/attachments/download": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"Bearer": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/octet-stream"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Items"
|
||||||
|
],
|
||||||
|
"summary": "retrieves an attachment for an item",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Item ID",
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Attachment token",
|
||||||
|
"name": "token",
|
||||||
|
"in": "query",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/items/{id}/attachments/{attachment_id}": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"Bearer": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/octet-stream"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Items"
|
||||||
|
],
|
||||||
|
"summary": "retrieves an attachment for an item",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Item ID",
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Attachment ID",
|
||||||
|
"name": "attachment_id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/types.ItemAttachmentToken"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"put": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"Bearer": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Items"
|
||||||
|
],
|
||||||
|
"summary": "retrieves an attachment for an item",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Item ID",
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Attachment ID",
|
||||||
|
"name": "attachment_id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Attachment Update",
|
||||||
|
"name": "payload",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/types.ItemAttachmentUpdate"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/types.ItemOut"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"delete": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"Bearer": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Items"
|
||||||
|
],
|
||||||
|
"summary": "retrieves an attachment for an item",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Item ID",
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Attachment ID",
|
||||||
|
"name": "attachment_id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"204": {
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/v1/labels": {
|
"/v1/labels": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
|
@ -810,6 +1026,17 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"server.ValidationError": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"field": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"reason": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"types.ApiSummary": {
|
"types.ApiSummary": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@ -873,11 +1100,33 @@
|
||||||
"id": {
|
"id": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"updatedAt": {
|
"updatedAt": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"types.ItemAttachmentToken": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"token": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"types.ItemAttachmentUpdate": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"title": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"types.ItemCreate": {
|
"types.ItemCreate": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@ -1177,9 +1426,6 @@
|
||||||
"description": {
|
"description": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"groupId": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"id": {
|
"id": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
@ -1206,9 +1452,6 @@
|
||||||
"description": {
|
"description": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"groupId": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"id": {
|
"id": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
|
|
@ -14,6 +14,13 @@ definitions:
|
||||||
items:
|
items:
|
||||||
type: any
|
type: any
|
||||||
type: object
|
type: object
|
||||||
|
server.ValidationError:
|
||||||
|
properties:
|
||||||
|
field:
|
||||||
|
type: string
|
||||||
|
reason:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
types.ApiSummary:
|
types.ApiSummary:
|
||||||
properties:
|
properties:
|
||||||
build:
|
build:
|
||||||
|
@ -55,9 +62,23 @@ definitions:
|
||||||
$ref: '#/definitions/types.DocumentOut'
|
$ref: '#/definitions/types.DocumentOut'
|
||||||
id:
|
id:
|
||||||
type: string
|
type: string
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
updatedAt:
|
updatedAt:
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
|
types.ItemAttachmentToken:
|
||||||
|
properties:
|
||||||
|
token:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
types.ItemAttachmentUpdate:
|
||||||
|
properties:
|
||||||
|
title:
|
||||||
|
type: string
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
types.ItemCreate:
|
types.ItemCreate:
|
||||||
properties:
|
properties:
|
||||||
description:
|
description:
|
||||||
|
@ -264,8 +285,6 @@ definitions:
|
||||||
type: string
|
type: string
|
||||||
description:
|
description:
|
||||||
type: string
|
type: string
|
||||||
groupId:
|
|
||||||
type: string
|
|
||||||
id:
|
id:
|
||||||
type: string
|
type: string
|
||||||
items:
|
items:
|
||||||
|
@ -283,8 +302,6 @@ definitions:
|
||||||
type: string
|
type: string
|
||||||
description:
|
description:
|
||||||
type: string
|
type: string
|
||||||
groupId:
|
|
||||||
type: string
|
|
||||||
id:
|
id:
|
||||||
type: string
|
type: string
|
||||||
name:
|
name:
|
||||||
|
@ -503,6 +520,143 @@ paths:
|
||||||
summary: updates a item
|
summary: updates a item
|
||||||
tags:
|
tags:
|
||||||
- Items
|
- Items
|
||||||
|
/v1/items/{id}/attachments:
|
||||||
|
post:
|
||||||
|
parameters:
|
||||||
|
- description: Item ID
|
||||||
|
in: path
|
||||||
|
name: id
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: File attachment
|
||||||
|
in: formData
|
||||||
|
name: file
|
||||||
|
required: true
|
||||||
|
type: file
|
||||||
|
- description: Type of file
|
||||||
|
in: formData
|
||||||
|
name: type
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: name of the file including extension
|
||||||
|
in: formData
|
||||||
|
name: name
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/types.ItemOut'
|
||||||
|
"422":
|
||||||
|
description: Unprocessable Entity
|
||||||
|
schema:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/server.ValidationError'
|
||||||
|
type: array
|
||||||
|
security:
|
||||||
|
- Bearer: []
|
||||||
|
summary: imports items into the database
|
||||||
|
tags:
|
||||||
|
- Items
|
||||||
|
/v1/items/{id}/attachments/{attachment_id}:
|
||||||
|
delete:
|
||||||
|
parameters:
|
||||||
|
- description: Item ID
|
||||||
|
in: path
|
||||||
|
name: id
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: Attachment ID
|
||||||
|
in: path
|
||||||
|
name: attachment_id
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"204":
|
||||||
|
description: ""
|
||||||
|
security:
|
||||||
|
- Bearer: []
|
||||||
|
summary: retrieves an attachment for an item
|
||||||
|
tags:
|
||||||
|
- Items
|
||||||
|
get:
|
||||||
|
parameters:
|
||||||
|
- description: Item ID
|
||||||
|
in: path
|
||||||
|
name: id
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: Attachment ID
|
||||||
|
in: path
|
||||||
|
name: attachment_id
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
produces:
|
||||||
|
- application/octet-stream
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/types.ItemAttachmentToken'
|
||||||
|
security:
|
||||||
|
- Bearer: []
|
||||||
|
summary: retrieves an attachment for an item
|
||||||
|
tags:
|
||||||
|
- Items
|
||||||
|
put:
|
||||||
|
parameters:
|
||||||
|
- description: Item ID
|
||||||
|
in: path
|
||||||
|
name: id
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: Attachment ID
|
||||||
|
in: path
|
||||||
|
name: attachment_id
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: Attachment Update
|
||||||
|
in: body
|
||||||
|
name: payload
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/types.ItemAttachmentUpdate'
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/types.ItemOut'
|
||||||
|
security:
|
||||||
|
- Bearer: []
|
||||||
|
summary: retrieves an attachment for an item
|
||||||
|
tags:
|
||||||
|
- Items
|
||||||
|
/v1/items/{id}/attachments/download:
|
||||||
|
get:
|
||||||
|
parameters:
|
||||||
|
- description: Item ID
|
||||||
|
in: path
|
||||||
|
name: id
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: Attachment token
|
||||||
|
in: query
|
||||||
|
name: token
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
produces:
|
||||||
|
- application/octet-stream
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: ""
|
||||||
|
security:
|
||||||
|
- Bearer: []
|
||||||
|
summary: retrieves an attachment for an item
|
||||||
|
tags:
|
||||||
|
- Items
|
||||||
/v1/items/import:
|
/v1/items/import:
|
||||||
post:
|
post:
|
||||||
parameters:
|
parameters:
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/hay-kot/content/backend/internal/config"
|
"github.com/hay-kot/homebox/backend/internal/config"
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
|
@ -5,12 +5,12 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hay-kot/content/backend/app/api/docs"
|
"github.com/hay-kot/homebox/backend/app/api/docs"
|
||||||
"github.com/hay-kot/content/backend/ent"
|
"github.com/hay-kot/homebox/backend/ent"
|
||||||
"github.com/hay-kot/content/backend/internal/config"
|
"github.com/hay-kot/homebox/backend/internal/config"
|
||||||
"github.com/hay-kot/content/backend/internal/repo"
|
"github.com/hay-kot/homebox/backend/internal/repo"
|
||||||
"github.com/hay-kot/content/backend/internal/services"
|
"github.com/hay-kot/homebox/backend/internal/services"
|
||||||
"github.com/hay-kot/content/backend/pkgs/server"
|
"github.com/hay-kot/homebox/backend/pkgs/server"
|
||||||
_ "github.com/mattn/go-sqlite3"
|
_ "github.com/mattn/go-sqlite3"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
@ -37,10 +37,6 @@ func main() {
|
||||||
path = os.Args[1]
|
path = os.Args[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
if path == "" {
|
|
||||||
log.Warn().Msg("No configuration detected, using defaults")
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg, err := config.NewConfig(path)
|
cfg, err := config.NewConfig(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
@ -55,17 +51,22 @@ func main() {
|
||||||
|
|
||||||
func run(cfg *config.Config) error {
|
func run(cfg *config.Config) error {
|
||||||
app := new(cfg)
|
app := new(cfg)
|
||||||
|
|
||||||
app.setupLogger()
|
app.setupLogger()
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
// Initialize Database & Repos
|
// Initialize Database & Repos
|
||||||
|
|
||||||
c, err := ent.Open(cfg.Database.GetDriver(), cfg.Database.GetUrl())
|
err := os.MkdirAll(cfg.Storage.Data, 0755)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal().Err(err).Msg("failed to create data directory")
|
||||||
|
}
|
||||||
|
|
||||||
|
c, err := ent.Open("sqlite3", cfg.Storage.SqliteUrl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal().
|
log.Fatal().
|
||||||
Err(err).
|
Err(err).
|
||||||
Str("driver", cfg.Database.GetDriver()).
|
Str("driver", "sqlite").
|
||||||
Str("url", cfg.Database.GetUrl()).
|
Str("url", cfg.Storage.SqliteUrl).
|
||||||
Msg("failed opening connection to sqlite")
|
Msg("failed opening connection to sqlite")
|
||||||
}
|
}
|
||||||
defer func(c *ent.Client) {
|
defer func(c *ent.Client) {
|
||||||
|
@ -74,12 +75,14 @@ func run(cfg *config.Config) error {
|
||||||
if err := c.Schema.Create(context.Background()); err != nil {
|
if err := c.Schema.Create(context.Background()); err != nil {
|
||||||
log.Fatal().
|
log.Fatal().
|
||||||
Err(err).
|
Err(err).
|
||||||
|
Str("driver", "sqlite").
|
||||||
|
Str("url", cfg.Storage.SqliteUrl).
|
||||||
Msg("failed creating schema resources")
|
Msg("failed creating schema resources")
|
||||||
}
|
}
|
||||||
|
|
||||||
app.db = c
|
app.db = c
|
||||||
app.repos = repo.EntAllRepos(c)
|
app.repos = repo.EntAllRepos(c)
|
||||||
app.services = services.NewServices(app.repos)
|
app.services = services.NewServices(app.repos, cfg.Storage.Data)
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
// Start Server
|
// Start Server
|
||||||
|
|
|
@ -8,9 +8,9 @@ import (
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
"github.com/go-chi/chi/v5/middleware"
|
"github.com/go-chi/chi/v5/middleware"
|
||||||
"github.com/hay-kot/content/backend/internal/config"
|
"github.com/hay-kot/homebox/backend/internal/config"
|
||||||
"github.com/hay-kot/content/backend/internal/services"
|
"github.com/hay-kot/homebox/backend/internal/services"
|
||||||
"github.com/hay-kot/content/backend/pkgs/server"
|
"github.com/hay-kot/homebox/backend/pkgs/server"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -11,10 +11,10 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
_ "github.com/hay-kot/content/backend/app/api/docs"
|
_ "github.com/hay-kot/homebox/backend/app/api/docs"
|
||||||
v1 "github.com/hay-kot/content/backend/app/api/v1"
|
v1 "github.com/hay-kot/homebox/backend/app/api/v1"
|
||||||
"github.com/hay-kot/content/backend/internal/repo"
|
"github.com/hay-kot/homebox/backend/internal/repo"
|
||||||
"github.com/hay-kot/content/backend/internal/types"
|
"github.com/hay-kot/homebox/backend/internal/types"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
httpSwagger "github.com/swaggo/http-swagger" // http-swagger middleware
|
httpSwagger "github.com/swaggo/http-swagger" // http-swagger middleware
|
||||||
)
|
)
|
||||||
|
@ -43,7 +43,7 @@ func (a *app) newRouter(repos *repo.AllRepos) *chi.Mux {
|
||||||
// API Version 1
|
// API Version 1
|
||||||
|
|
||||||
v1Base := v1.BaseUrlFunc(prefix)
|
v1Base := v1.BaseUrlFunc(prefix)
|
||||||
v1Ctrl := v1.NewControllerV1(a.services)
|
v1Ctrl := v1.NewControllerV1(a.services, v1.WithMaxUploadSize(a.conf.Web.MaxUploadSize))
|
||||||
{
|
{
|
||||||
r.Get(v1Base("/status"), v1Ctrl.HandleBase(func() bool { return true }, types.Build{
|
r.Get(v1Base("/status"), v1Ctrl.HandleBase(func() bool { return true }, types.Build{
|
||||||
Version: Version,
|
Version: Version,
|
||||||
|
@ -54,6 +54,10 @@ func (a *app) newRouter(repos *repo.AllRepos) *chi.Mux {
|
||||||
r.Post(v1Base("/users/register"), v1Ctrl.HandleUserRegistration())
|
r.Post(v1Base("/users/register"), v1Ctrl.HandleUserRegistration())
|
||||||
r.Post(v1Base("/users/login"), v1Ctrl.HandleAuthLogin())
|
r.Post(v1Base("/users/login"), v1Ctrl.HandleAuthLogin())
|
||||||
|
|
||||||
|
// Attachment download URl needs a `token` query param to be passed in the request.
|
||||||
|
// and also needs to be outside of the `auth` middleware.
|
||||||
|
r.Get(v1Base("/items/{id}/attachments/download"), v1Ctrl.HandleItemAttachmentDownload())
|
||||||
|
|
||||||
r.Group(func(r chi.Router) {
|
r.Group(func(r chi.Router) {
|
||||||
r.Use(a.mwAuthToken)
|
r.Use(a.mwAuthToken)
|
||||||
r.Get(v1Base("/users/self"), v1Ctrl.HandleUserSelf())
|
r.Get(v1Base("/users/self"), v1Ctrl.HandleUserSelf())
|
||||||
|
@ -81,6 +85,11 @@ func (a *app) newRouter(repos *repo.AllRepos) *chi.Mux {
|
||||||
r.Get(v1Base("/items/{id}"), v1Ctrl.HandleItemGet())
|
r.Get(v1Base("/items/{id}"), v1Ctrl.HandleItemGet())
|
||||||
r.Put(v1Base("/items/{id}"), v1Ctrl.HandleItemUpdate())
|
r.Put(v1Base("/items/{id}"), v1Ctrl.HandleItemUpdate())
|
||||||
r.Delete(v1Base("/items/{id}"), v1Ctrl.HandleItemDelete())
|
r.Delete(v1Base("/items/{id}"), v1Ctrl.HandleItemDelete())
|
||||||
|
|
||||||
|
r.Post(v1Base("/items/{id}/attachments"), v1Ctrl.HandleItemAttachmentCreate())
|
||||||
|
r.Get(v1Base("/items/{id}/attachments/{attachment_id}"), v1Ctrl.HandleItemAttachmentToken())
|
||||||
|
r.Put(v1Base("/items/{id}/attachments/{attachment_id}"), v1Ctrl.HandleItemAttachmentUpdate())
|
||||||
|
r.Delete(v1Base("/items/{id}/attachments/{attachment_id}"), v1Ctrl.HandleItemAttachmentDelete())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,20 @@ package v1
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/hay-kot/content/backend/internal/services"
|
"github.com/hay-kot/homebox/backend/internal/services"
|
||||||
"github.com/hay-kot/content/backend/internal/types"
|
"github.com/hay-kot/homebox/backend/internal/types"
|
||||||
"github.com/hay-kot/content/backend/pkgs/server"
|
"github.com/hay-kot/homebox/backend/pkgs/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func WithMaxUploadSize(maxUploadSize int64) func(*V1Controller) {
|
||||||
|
return func(ctrl *V1Controller) {
|
||||||
|
ctrl.maxUploadSize = maxUploadSize
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type V1Controller struct {
|
type V1Controller struct {
|
||||||
svc *services.AllServices
|
svc *services.AllServices
|
||||||
|
maxUploadSize int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func BaseUrlFunc(prefix string) func(s string) string {
|
func BaseUrlFunc(prefix string) func(s string) string {
|
||||||
|
@ -21,7 +28,7 @@ func BaseUrlFunc(prefix string) func(s string) string {
|
||||||
return prefixFunc
|
return prefixFunc
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewControllerV1(svc *services.AllServices) *V1Controller {
|
func NewControllerV1(svc *services.AllServices, options ...func(*V1Controller)) *V1Controller {
|
||||||
ctrl := &V1Controller{
|
ctrl := &V1Controller{
|
||||||
svc: svc,
|
svc: svc,
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hay-kot/content/backend/internal/types"
|
"github.com/hay-kot/homebox/backend/internal/types"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,10 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hay-kot/content/backend/ent"
|
"github.com/hay-kot/homebox/backend/ent"
|
||||||
"github.com/hay-kot/content/backend/internal/mocks"
|
"github.com/hay-kot/homebox/backend/internal/mocks"
|
||||||
"github.com/hay-kot/content/backend/internal/mocks/factories"
|
"github.com/hay-kot/homebox/backend/internal/mocks/factories"
|
||||||
"github.com/hay-kot/content/backend/internal/types"
|
"github.com/hay-kot/homebox/backend/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
var mockHandler = &V1Controller{}
|
var mockHandler = &V1Controller{}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/internal/services"
|
"github.com/hay-kot/homebox/backend/internal/services"
|
||||||
"github.com/hay-kot/content/backend/internal/types"
|
"github.com/hay-kot/homebox/backend/internal/types"
|
||||||
"github.com/hay-kot/content/backend/pkgs/server"
|
"github.com/hay-kot/homebox/backend/pkgs/server"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/hay-kot/content/backend/internal/services"
|
"github.com/hay-kot/homebox/backend/internal/services"
|
||||||
"github.com/hay-kot/content/backend/internal/types"
|
"github.com/hay-kot/homebox/backend/internal/types"
|
||||||
"github.com/hay-kot/content/backend/pkgs/server"
|
"github.com/hay-kot/homebox/backend/pkgs/server"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"encoding/csv"
|
"encoding/csv"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/hay-kot/content/backend/internal/services"
|
"github.com/hay-kot/homebox/backend/internal/services"
|
||||||
"github.com/hay-kot/content/backend/internal/types"
|
"github.com/hay-kot/homebox/backend/internal/types"
|
||||||
"github.com/hay-kot/content/backend/pkgs/server"
|
"github.com/hay-kot/homebox/backend/pkgs/server"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
237
backend/app/api/v1/v1_ctrl_items_attachments.go
Normal file
237
backend/app/api/v1/v1_ctrl_items_attachments.go
Normal file
|
@ -0,0 +1,237 @@
|
||||||
|
package v1
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/go-chi/chi/v5"
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/hay-kot/homebox/backend/ent/attachment"
|
||||||
|
"github.com/hay-kot/homebox/backend/internal/services"
|
||||||
|
"github.com/hay-kot/homebox/backend/internal/types"
|
||||||
|
"github.com/hay-kot/homebox/backend/pkgs/server"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
// HandleItemsImport godocs
|
||||||
|
// @Summary imports items into the database
|
||||||
|
// @Tags Items
|
||||||
|
// @Produce json
|
||||||
|
// @Param id path string true "Item ID"
|
||||||
|
// @Param file formData file true "File attachment"
|
||||||
|
// @Param type formData string true "Type of file"
|
||||||
|
// @Param name formData string true "name of the file including extension"
|
||||||
|
// @Success 200 {object} types.ItemOut
|
||||||
|
// @Failure 422 {object} []server.ValidationError
|
||||||
|
// @Router /v1/items/{id}/attachments [POST]
|
||||||
|
// @Security Bearer
|
||||||
|
func (ctrl *V1Controller) HandleItemAttachmentCreate() http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
err := r.ParseMultipartForm(ctrl.maxUploadSize << 20)
|
||||||
|
if err != nil {
|
||||||
|
log.Err(err).Msg("failed to parse multipart form")
|
||||||
|
server.RespondError(w, http.StatusBadRequest, errors.New("failed to parse multipart form"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
errs := make(server.ValidationErrors, 0)
|
||||||
|
|
||||||
|
file, _, err := r.FormFile("file")
|
||||||
|
if err != nil {
|
||||||
|
switch {
|
||||||
|
case errors.Is(err, http.ErrMissingFile):
|
||||||
|
log.Debug().Msg("file for attachment is missing")
|
||||||
|
errs = errs.Append("file", "file is required")
|
||||||
|
default:
|
||||||
|
log.Err(err).Msg("failed to get file from form")
|
||||||
|
server.RespondServerError(w)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
attachmentName := r.FormValue("name")
|
||||||
|
if attachmentName == "" {
|
||||||
|
log.Debug().Msg("failed to get name from form")
|
||||||
|
errs = errs.Append("name", "name is required")
|
||||||
|
}
|
||||||
|
|
||||||
|
if errs.HasErrors() {
|
||||||
|
server.Respond(w, http.StatusUnprocessableEntity, errs)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
attachmentType := r.FormValue("type")
|
||||||
|
if attachmentType == "" {
|
||||||
|
attachmentType = attachment.TypeAttachment.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
id, _, err := ctrl.partialParseIdAndUser(w, r)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx := services.NewContext(r.Context())
|
||||||
|
|
||||||
|
item, err := ctrl.svc.Items.AttachmentAdd(
|
||||||
|
ctx,
|
||||||
|
id,
|
||||||
|
attachmentName,
|
||||||
|
attachment.Type(attachmentType),
|
||||||
|
file,
|
||||||
|
)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Err(err).Msg("failed to add attachment")
|
||||||
|
server.RespondServerError(w)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
server.Respond(w, http.StatusCreated, item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// HandleItemAttachmentGet godocs
|
||||||
|
// @Summary retrieves an attachment for an item
|
||||||
|
// @Tags Items
|
||||||
|
// @Produce application/octet-stream
|
||||||
|
// @Param id path string true "Item ID"
|
||||||
|
// @Param token query string true "Attachment token"
|
||||||
|
// @Success 200
|
||||||
|
// @Router /v1/items/{id}/attachments/download [GET]
|
||||||
|
// @Security Bearer
|
||||||
|
func (ctrl *V1Controller) HandleItemAttachmentDownload() http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
token := server.GetParam(r, "token", "")
|
||||||
|
|
||||||
|
path, err := ctrl.svc.Items.AttachmentPath(r.Context(), token)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Err(err).Msg("failed to get attachment")
|
||||||
|
server.RespondServerError(w)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
w.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"", filepath.Base(path)))
|
||||||
|
w.Header().Set("Content-Type", "application/octet-stream")
|
||||||
|
http.ServeFile(w, r, path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// HandleItemAttachmentToken godocs
|
||||||
|
// @Summary retrieves an attachment for an item
|
||||||
|
// @Tags Items
|
||||||
|
// @Produce application/octet-stream
|
||||||
|
// @Param id path string true "Item ID"
|
||||||
|
// @Param attachment_id path string true "Attachment ID"
|
||||||
|
// @Success 200 {object} types.ItemAttachmentToken
|
||||||
|
// @Router /v1/items/{id}/attachments/{attachment_id} [GET]
|
||||||
|
// @Security Bearer
|
||||||
|
func (ctrl *V1Controller) HandleItemAttachmentToken() http.HandlerFunc {
|
||||||
|
return ctrl.handleItemAttachmentsHandler
|
||||||
|
}
|
||||||
|
|
||||||
|
// HandleItemAttachmentDelete godocs
|
||||||
|
// @Summary retrieves an attachment for an item
|
||||||
|
// @Tags Items
|
||||||
|
// @Param id path string true "Item ID"
|
||||||
|
// @Param attachment_id path string true "Attachment ID"
|
||||||
|
// @Success 204
|
||||||
|
// @Router /v1/items/{id}/attachments/{attachment_id} [DELETE]
|
||||||
|
// @Security Bearer
|
||||||
|
func (ctrl *V1Controller) HandleItemAttachmentDelete() http.HandlerFunc {
|
||||||
|
return ctrl.handleItemAttachmentsHandler
|
||||||
|
}
|
||||||
|
|
||||||
|
// HandleItemAttachmentUpdate godocs
|
||||||
|
// @Summary retrieves an attachment for an item
|
||||||
|
// @Tags Items
|
||||||
|
// @Param id path string true "Item ID"
|
||||||
|
// @Param attachment_id path string true "Attachment ID"
|
||||||
|
// @Param payload body types.ItemAttachmentUpdate true "Attachment Update"
|
||||||
|
// @Success 200 {object} types.ItemOut
|
||||||
|
// @Router /v1/items/{id}/attachments/{attachment_id} [PUT]
|
||||||
|
// @Security Bearer
|
||||||
|
func (ctrl *V1Controller) HandleItemAttachmentUpdate() http.HandlerFunc {
|
||||||
|
return ctrl.handleItemAttachmentsHandler
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ctrl *V1Controller) handleItemAttachmentsHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
uid, user, err := ctrl.partialParseIdAndUser(w, r)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
attachmentId, err := uuid.Parse(chi.URLParam(r, "attachment_id"))
|
||||||
|
if err != nil {
|
||||||
|
log.Err(err).Msg("failed to parse attachment_id param")
|
||||||
|
server.RespondError(w, http.StatusBadRequest, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx := services.NewContext(r.Context())
|
||||||
|
|
||||||
|
switch r.Method {
|
||||||
|
|
||||||
|
// Token Handler
|
||||||
|
case http.MethodGet:
|
||||||
|
token, err := ctrl.svc.Items.AttachmentToken(ctx, uid, attachmentId)
|
||||||
|
if err != nil {
|
||||||
|
switch err {
|
||||||
|
case services.ErrNotFound:
|
||||||
|
log.Err(err).
|
||||||
|
Str("id", attachmentId.String()).
|
||||||
|
Msg("failed to find attachment with id")
|
||||||
|
|
||||||
|
server.RespondError(w, http.StatusNotFound, err)
|
||||||
|
|
||||||
|
case services.ErrFileNotFound:
|
||||||
|
log.Err(err).
|
||||||
|
Str("id", attachmentId.String()).
|
||||||
|
Msg("failed to find file path for attachment with id")
|
||||||
|
log.Warn().Msg("attachment with no file path removed from database")
|
||||||
|
|
||||||
|
server.RespondError(w, http.StatusNotFound, err)
|
||||||
|
|
||||||
|
default:
|
||||||
|
log.Err(err).Msg("failed to get attachment")
|
||||||
|
server.RespondServerError(w)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server.Respond(w, http.StatusOK, types.ItemAttachmentToken{Token: token})
|
||||||
|
|
||||||
|
// Delete Attachment Handler
|
||||||
|
case http.MethodDelete:
|
||||||
|
err = ctrl.svc.Items.AttachmentDelete(r.Context(), user.GroupID, uid, attachmentId)
|
||||||
|
if err != nil {
|
||||||
|
log.Err(err).Msg("failed to delete attachment")
|
||||||
|
server.RespondServerError(w)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
server.Respond(w, http.StatusNoContent, nil)
|
||||||
|
|
||||||
|
// Update Attachment Handler
|
||||||
|
case http.MethodPut:
|
||||||
|
var attachment types.ItemAttachmentUpdate
|
||||||
|
err = server.Decode(r, &attachment)
|
||||||
|
if err != nil {
|
||||||
|
log.Err(err).Msg("failed to decode attachment")
|
||||||
|
server.RespondError(w, http.StatusBadRequest, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
attachment.ID = attachmentId
|
||||||
|
val, err := ctrl.svc.Items.AttachmentUpdate(ctx, uid, &attachment)
|
||||||
|
if err != nil {
|
||||||
|
log.Err(err).Msg("failed to delete attachment")
|
||||||
|
server.RespondServerError(w)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
server.Respond(w, http.StatusOK, val)
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,10 +3,10 @@ package v1
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/hay-kot/content/backend/ent"
|
"github.com/hay-kot/homebox/backend/ent"
|
||||||
"github.com/hay-kot/content/backend/internal/services"
|
"github.com/hay-kot/homebox/backend/internal/services"
|
||||||
"github.com/hay-kot/content/backend/internal/types"
|
"github.com/hay-kot/homebox/backend/internal/types"
|
||||||
"github.com/hay-kot/content/backend/pkgs/server"
|
"github.com/hay-kot/homebox/backend/pkgs/server"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,10 @@ package v1
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/hay-kot/content/backend/ent"
|
"github.com/hay-kot/homebox/backend/ent"
|
||||||
"github.com/hay-kot/content/backend/internal/services"
|
"github.com/hay-kot/homebox/backend/internal/services"
|
||||||
"github.com/hay-kot/content/backend/internal/types"
|
"github.com/hay-kot/homebox/backend/internal/types"
|
||||||
"github.com/hay-kot/content/backend/pkgs/server"
|
"github.com/hay-kot/homebox/backend/pkgs/server"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/internal/services"
|
"github.com/hay-kot/homebox/backend/internal/services"
|
||||||
"github.com/hay-kot/content/backend/internal/types"
|
"github.com/hay-kot/homebox/backend/internal/types"
|
||||||
"github.com/hay-kot/content/backend/pkgs/server"
|
"github.com/hay-kot/homebox/backend/pkgs/server"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
---
|
|
||||||
mode: development
|
|
||||||
swagger:
|
|
||||||
host: localhost:7745
|
|
||||||
scheme: http
|
|
||||||
web:
|
|
||||||
port: 7745
|
|
||||||
host: ""
|
|
||||||
database:
|
|
||||||
driver: sqlite3
|
|
||||||
sqlite-url: ./homebox.db?_fk=1
|
|
||||||
logger:
|
|
||||||
level: debug
|
|
||||||
mailer:
|
|
||||||
host: smtp.example.com
|
|
||||||
port: 465
|
|
||||||
username:
|
|
||||||
password:
|
|
||||||
from: example@email.com
|
|
|
@ -9,9 +9,9 @@ import (
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/attachment"
|
"github.com/hay-kot/homebox/backend/ent/attachment"
|
||||||
"github.com/hay-kot/content/backend/ent/document"
|
"github.com/hay-kot/homebox/backend/ent/document"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Attachment is the model entity for the Attachment schema.
|
// Attachment is the model entity for the Attachment schema.
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ID filters vertices based on their ID field.
|
// ID filters vertices based on their ID field.
|
||||||
|
|
|
@ -11,9 +11,9 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/attachment"
|
"github.com/hay-kot/homebox/backend/ent/attachment"
|
||||||
"github.com/hay-kot/content/backend/ent/document"
|
"github.com/hay-kot/homebox/backend/ent/document"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AttachmentCreate is the builder for creating a Attachment entity.
|
// AttachmentCreate is the builder for creating a Attachment entity.
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/hay-kot/content/backend/ent/attachment"
|
"github.com/hay-kot/homebox/backend/ent/attachment"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AttachmentDelete is the builder for deleting a Attachment entity.
|
// AttachmentDelete is the builder for deleting a Attachment entity.
|
||||||
|
|
|
@ -11,10 +11,10 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/attachment"
|
"github.com/hay-kot/homebox/backend/ent/attachment"
|
||||||
"github.com/hay-kot/content/backend/ent/document"
|
"github.com/hay-kot/homebox/backend/ent/document"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AttachmentQuery is the builder for querying Attachment entities.
|
// AttachmentQuery is the builder for querying Attachment entities.
|
||||||
|
|
|
@ -12,10 +12,10 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/attachment"
|
"github.com/hay-kot/homebox/backend/ent/attachment"
|
||||||
"github.com/hay-kot/content/backend/ent/document"
|
"github.com/hay-kot/homebox/backend/ent/document"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AttachmentUpdate is the builder for updating Attachment entities.
|
// AttachmentUpdate is the builder for updating Attachment entities.
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/authtokens"
|
"github.com/hay-kot/homebox/backend/ent/authtokens"
|
||||||
"github.com/hay-kot/content/backend/ent/user"
|
"github.com/hay-kot/homebox/backend/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AuthTokens is the model entity for the AuthTokens schema.
|
// AuthTokens is the model entity for the AuthTokens schema.
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ID filters vertices based on their ID field.
|
// ID filters vertices based on their ID field.
|
||||||
|
|
|
@ -11,8 +11,8 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/authtokens"
|
"github.com/hay-kot/homebox/backend/ent/authtokens"
|
||||||
"github.com/hay-kot/content/backend/ent/user"
|
"github.com/hay-kot/homebox/backend/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AuthTokensCreate is the builder for creating a AuthTokens entity.
|
// AuthTokensCreate is the builder for creating a AuthTokens entity.
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/hay-kot/content/backend/ent/authtokens"
|
"github.com/hay-kot/homebox/backend/ent/authtokens"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AuthTokensDelete is the builder for deleting a AuthTokens entity.
|
// AuthTokensDelete is the builder for deleting a AuthTokens entity.
|
||||||
|
|
|
@ -11,9 +11,9 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/authtokens"
|
"github.com/hay-kot/homebox/backend/ent/authtokens"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
"github.com/hay-kot/content/backend/ent/user"
|
"github.com/hay-kot/homebox/backend/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AuthTokensQuery is the builder for querying AuthTokens entities.
|
// AuthTokensQuery is the builder for querying AuthTokens entities.
|
||||||
|
|
|
@ -12,9 +12,9 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/authtokens"
|
"github.com/hay-kot/homebox/backend/ent/authtokens"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
"github.com/hay-kot/content/backend/ent/user"
|
"github.com/hay-kot/homebox/backend/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AuthTokensUpdate is the builder for updating AuthTokens entities.
|
// AuthTokensUpdate is the builder for updating AuthTokens entities.
|
||||||
|
|
|
@ -9,18 +9,18 @@ import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/migrate"
|
"github.com/hay-kot/homebox/backend/ent/migrate"
|
||||||
|
|
||||||
"github.com/hay-kot/content/backend/ent/attachment"
|
"github.com/hay-kot/homebox/backend/ent/attachment"
|
||||||
"github.com/hay-kot/content/backend/ent/authtokens"
|
"github.com/hay-kot/homebox/backend/ent/authtokens"
|
||||||
"github.com/hay-kot/content/backend/ent/document"
|
"github.com/hay-kot/homebox/backend/ent/document"
|
||||||
"github.com/hay-kot/content/backend/ent/documenttoken"
|
"github.com/hay-kot/homebox/backend/ent/documenttoken"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
"github.com/hay-kot/content/backend/ent/itemfield"
|
"github.com/hay-kot/homebox/backend/ent/itemfield"
|
||||||
"github.com/hay-kot/content/backend/ent/label"
|
"github.com/hay-kot/homebox/backend/ent/label"
|
||||||
"github.com/hay-kot/content/backend/ent/location"
|
"github.com/hay-kot/homebox/backend/ent/location"
|
||||||
"github.com/hay-kot/content/backend/ent/user"
|
"github.com/hay-kot/homebox/backend/ent/user"
|
||||||
|
|
||||||
"entgo.io/ent/dialect"
|
"entgo.io/ent/dialect"
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/document"
|
"github.com/hay-kot/homebox/backend/ent/document"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Document is the model entity for the Document schema.
|
// Document is the model entity for the Document schema.
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ID filters vertices based on their ID field.
|
// ID filters vertices based on their ID field.
|
||||||
|
|
|
@ -11,10 +11,10 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/attachment"
|
"github.com/hay-kot/homebox/backend/ent/attachment"
|
||||||
"github.com/hay-kot/content/backend/ent/document"
|
"github.com/hay-kot/homebox/backend/ent/document"
|
||||||
"github.com/hay-kot/content/backend/ent/documenttoken"
|
"github.com/hay-kot/homebox/backend/ent/documenttoken"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DocumentCreate is the builder for creating a Document entity.
|
// DocumentCreate is the builder for creating a Document entity.
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/hay-kot/content/backend/ent/document"
|
"github.com/hay-kot/homebox/backend/ent/document"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DocumentDelete is the builder for deleting a Document entity.
|
// DocumentDelete is the builder for deleting a Document entity.
|
||||||
|
|
|
@ -12,11 +12,11 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/attachment"
|
"github.com/hay-kot/homebox/backend/ent/attachment"
|
||||||
"github.com/hay-kot/content/backend/ent/document"
|
"github.com/hay-kot/homebox/backend/ent/document"
|
||||||
"github.com/hay-kot/content/backend/ent/documenttoken"
|
"github.com/hay-kot/homebox/backend/ent/documenttoken"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DocumentQuery is the builder for querying Document entities.
|
// DocumentQuery is the builder for querying Document entities.
|
||||||
|
|
|
@ -12,11 +12,11 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/attachment"
|
"github.com/hay-kot/homebox/backend/ent/attachment"
|
||||||
"github.com/hay-kot/content/backend/ent/document"
|
"github.com/hay-kot/homebox/backend/ent/document"
|
||||||
"github.com/hay-kot/content/backend/ent/documenttoken"
|
"github.com/hay-kot/homebox/backend/ent/documenttoken"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DocumentUpdate is the builder for updating Document entities.
|
// DocumentUpdate is the builder for updating Document entities.
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/document"
|
"github.com/hay-kot/homebox/backend/ent/document"
|
||||||
"github.com/hay-kot/content/backend/ent/documenttoken"
|
"github.com/hay-kot/homebox/backend/ent/documenttoken"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DocumentToken is the model entity for the DocumentToken schema.
|
// DocumentToken is the model entity for the DocumentToken schema.
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ID filters vertices based on their ID field.
|
// ID filters vertices based on their ID field.
|
||||||
|
|
|
@ -11,8 +11,8 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/document"
|
"github.com/hay-kot/homebox/backend/ent/document"
|
||||||
"github.com/hay-kot/content/backend/ent/documenttoken"
|
"github.com/hay-kot/homebox/backend/ent/documenttoken"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DocumentTokenCreate is the builder for creating a DocumentToken entity.
|
// DocumentTokenCreate is the builder for creating a DocumentToken entity.
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/hay-kot/content/backend/ent/documenttoken"
|
"github.com/hay-kot/homebox/backend/ent/documenttoken"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DocumentTokenDelete is the builder for deleting a DocumentToken entity.
|
// DocumentTokenDelete is the builder for deleting a DocumentToken entity.
|
||||||
|
|
|
@ -11,9 +11,9 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/document"
|
"github.com/hay-kot/homebox/backend/ent/document"
|
||||||
"github.com/hay-kot/content/backend/ent/documenttoken"
|
"github.com/hay-kot/homebox/backend/ent/documenttoken"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DocumentTokenQuery is the builder for querying DocumentToken entities.
|
// DocumentTokenQuery is the builder for querying DocumentToken entities.
|
||||||
|
|
|
@ -12,9 +12,9 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/document"
|
"github.com/hay-kot/homebox/backend/ent/document"
|
||||||
"github.com/hay-kot/content/backend/ent/documenttoken"
|
"github.com/hay-kot/homebox/backend/ent/documenttoken"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DocumentTokenUpdate is the builder for updating DocumentToken entities.
|
// DocumentTokenUpdate is the builder for updating DocumentToken entities.
|
||||||
|
|
|
@ -10,16 +10,16 @@ import (
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"github.com/hay-kot/content/backend/ent/attachment"
|
"github.com/hay-kot/homebox/backend/ent/attachment"
|
||||||
"github.com/hay-kot/content/backend/ent/authtokens"
|
"github.com/hay-kot/homebox/backend/ent/authtokens"
|
||||||
"github.com/hay-kot/content/backend/ent/document"
|
"github.com/hay-kot/homebox/backend/ent/document"
|
||||||
"github.com/hay-kot/content/backend/ent/documenttoken"
|
"github.com/hay-kot/homebox/backend/ent/documenttoken"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
"github.com/hay-kot/content/backend/ent/itemfield"
|
"github.com/hay-kot/homebox/backend/ent/itemfield"
|
||||||
"github.com/hay-kot/content/backend/ent/label"
|
"github.com/hay-kot/homebox/backend/ent/label"
|
||||||
"github.com/hay-kot/content/backend/ent/location"
|
"github.com/hay-kot/homebox/backend/ent/location"
|
||||||
"github.com/hay-kot/content/backend/ent/user"
|
"github.com/hay-kot/homebox/backend/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ent aliases to avoid import conflicts in user's code.
|
// ent aliases to avoid import conflicts in user's code.
|
||||||
|
|
|
@ -5,12 +5,12 @@ package enttest
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/hay-kot/content/backend/ent"
|
"github.com/hay-kot/homebox/backend/ent"
|
||||||
// required by schema hooks.
|
// required by schema hooks.
|
||||||
_ "github.com/hay-kot/content/backend/ent/runtime"
|
_ "github.com/hay-kot/homebox/backend/ent/runtime"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql/schema"
|
"entgo.io/ent/dialect/sql/schema"
|
||||||
"github.com/hay-kot/content/backend/ent/migrate"
|
"github.com/hay-kot/homebox/backend/ent/migrate"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Group is the model entity for the Group schema.
|
// Group is the model entity for the Group schema.
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ID filters vertices based on their ID field.
|
// ID filters vertices based on their ID field.
|
||||||
|
|
|
@ -11,12 +11,12 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/document"
|
"github.com/hay-kot/homebox/backend/ent/document"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
"github.com/hay-kot/content/backend/ent/label"
|
"github.com/hay-kot/homebox/backend/ent/label"
|
||||||
"github.com/hay-kot/content/backend/ent/location"
|
"github.com/hay-kot/homebox/backend/ent/location"
|
||||||
"github.com/hay-kot/content/backend/ent/user"
|
"github.com/hay-kot/homebox/backend/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GroupCreate is the builder for creating a Group entity.
|
// GroupCreate is the builder for creating a Group entity.
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GroupDelete is the builder for deleting a Group entity.
|
// GroupDelete is the builder for deleting a Group entity.
|
||||||
|
|
|
@ -12,13 +12,13 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/document"
|
"github.com/hay-kot/homebox/backend/ent/document"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
"github.com/hay-kot/content/backend/ent/label"
|
"github.com/hay-kot/homebox/backend/ent/label"
|
||||||
"github.com/hay-kot/content/backend/ent/location"
|
"github.com/hay-kot/homebox/backend/ent/location"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
"github.com/hay-kot/content/backend/ent/user"
|
"github.com/hay-kot/homebox/backend/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GroupQuery is the builder for querying Group entities.
|
// GroupQuery is the builder for querying Group entities.
|
||||||
|
|
|
@ -12,13 +12,13 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/document"
|
"github.com/hay-kot/homebox/backend/ent/document"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
"github.com/hay-kot/content/backend/ent/label"
|
"github.com/hay-kot/homebox/backend/ent/label"
|
||||||
"github.com/hay-kot/content/backend/ent/location"
|
"github.com/hay-kot/homebox/backend/ent/location"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
"github.com/hay-kot/content/backend/ent/user"
|
"github.com/hay-kot/homebox/backend/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GroupUpdate is the builder for updating Group entities.
|
// GroupUpdate is the builder for updating Group entities.
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/hay-kot/content/backend/ent"
|
"github.com/hay-kot/homebox/backend/ent"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The AttachmentFunc type is an adapter to allow the use of ordinary
|
// The AttachmentFunc type is an adapter to allow the use of ordinary
|
||||||
|
|
|
@ -9,9 +9,9 @@ import (
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
"github.com/hay-kot/content/backend/ent/location"
|
"github.com/hay-kot/homebox/backend/ent/location"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Item is the model entity for the Item schema.
|
// Item is the model entity for the Item schema.
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ID filters vertices based on their ID field.
|
// ID filters vertices based on their ID field.
|
||||||
|
|
|
@ -11,12 +11,12 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/attachment"
|
"github.com/hay-kot/homebox/backend/ent/attachment"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
"github.com/hay-kot/content/backend/ent/itemfield"
|
"github.com/hay-kot/homebox/backend/ent/itemfield"
|
||||||
"github.com/hay-kot/content/backend/ent/label"
|
"github.com/hay-kot/homebox/backend/ent/label"
|
||||||
"github.com/hay-kot/content/backend/ent/location"
|
"github.com/hay-kot/homebox/backend/ent/location"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ItemCreate is the builder for creating a Item entity.
|
// ItemCreate is the builder for creating a Item entity.
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ItemDelete is the builder for deleting a Item entity.
|
// ItemDelete is the builder for deleting a Item entity.
|
||||||
|
|
|
@ -12,13 +12,13 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/attachment"
|
"github.com/hay-kot/homebox/backend/ent/attachment"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
"github.com/hay-kot/content/backend/ent/itemfield"
|
"github.com/hay-kot/homebox/backend/ent/itemfield"
|
||||||
"github.com/hay-kot/content/backend/ent/label"
|
"github.com/hay-kot/homebox/backend/ent/label"
|
||||||
"github.com/hay-kot/content/backend/ent/location"
|
"github.com/hay-kot/homebox/backend/ent/location"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ItemQuery is the builder for querying Item entities.
|
// ItemQuery is the builder for querying Item entities.
|
||||||
|
|
|
@ -12,13 +12,13 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/attachment"
|
"github.com/hay-kot/homebox/backend/ent/attachment"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
"github.com/hay-kot/content/backend/ent/itemfield"
|
"github.com/hay-kot/homebox/backend/ent/itemfield"
|
||||||
"github.com/hay-kot/content/backend/ent/label"
|
"github.com/hay-kot/homebox/backend/ent/label"
|
||||||
"github.com/hay-kot/content/backend/ent/location"
|
"github.com/hay-kot/homebox/backend/ent/location"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ItemUpdate is the builder for updating Item entities.
|
// ItemUpdate is the builder for updating Item entities.
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
"github.com/hay-kot/content/backend/ent/itemfield"
|
"github.com/hay-kot/homebox/backend/ent/itemfield"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ItemField is the model entity for the ItemField schema.
|
// ItemField is the model entity for the ItemField schema.
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ID filters vertices based on their ID field.
|
// ID filters vertices based on their ID field.
|
||||||
|
|
|
@ -11,8 +11,8 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
"github.com/hay-kot/content/backend/ent/itemfield"
|
"github.com/hay-kot/homebox/backend/ent/itemfield"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ItemFieldCreate is the builder for creating a ItemField entity.
|
// ItemFieldCreate is the builder for creating a ItemField entity.
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/hay-kot/content/backend/ent/itemfield"
|
"github.com/hay-kot/homebox/backend/ent/itemfield"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ItemFieldDelete is the builder for deleting a ItemField entity.
|
// ItemFieldDelete is the builder for deleting a ItemField entity.
|
||||||
|
|
|
@ -11,9 +11,9 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
"github.com/hay-kot/content/backend/ent/itemfield"
|
"github.com/hay-kot/homebox/backend/ent/itemfield"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ItemFieldQuery is the builder for querying ItemField entities.
|
// ItemFieldQuery is the builder for querying ItemField entities.
|
||||||
|
|
|
@ -12,9 +12,9 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
"github.com/hay-kot/content/backend/ent/itemfield"
|
"github.com/hay-kot/homebox/backend/ent/itemfield"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ItemFieldUpdate is the builder for updating ItemField entities.
|
// ItemFieldUpdate is the builder for updating ItemField entities.
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/label"
|
"github.com/hay-kot/homebox/backend/ent/label"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Label is the model entity for the Label schema.
|
// Label is the model entity for the Label schema.
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ID filters vertices based on their ID field.
|
// ID filters vertices based on their ID field.
|
||||||
|
|
|
@ -11,9 +11,9 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
"github.com/hay-kot/content/backend/ent/label"
|
"github.com/hay-kot/homebox/backend/ent/label"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LabelCreate is the builder for creating a Label entity.
|
// LabelCreate is the builder for creating a Label entity.
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/hay-kot/content/backend/ent/label"
|
"github.com/hay-kot/homebox/backend/ent/label"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LabelDelete is the builder for deleting a Label entity.
|
// LabelDelete is the builder for deleting a Label entity.
|
||||||
|
|
|
@ -12,10 +12,10 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
"github.com/hay-kot/content/backend/ent/label"
|
"github.com/hay-kot/homebox/backend/ent/label"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LabelQuery is the builder for querying Label entities.
|
// LabelQuery is the builder for querying Label entities.
|
||||||
|
|
|
@ -12,10 +12,10 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
"github.com/hay-kot/content/backend/ent/label"
|
"github.com/hay-kot/homebox/backend/ent/label"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LabelUpdate is the builder for updating Label entities.
|
// LabelUpdate is the builder for updating Label entities.
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/location"
|
"github.com/hay-kot/homebox/backend/ent/location"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Location is the model entity for the Location schema.
|
// Location is the model entity for the Location schema.
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ID filters vertices based on their ID field.
|
// ID filters vertices based on their ID field.
|
||||||
|
|
|
@ -11,9 +11,9 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
"github.com/hay-kot/content/backend/ent/location"
|
"github.com/hay-kot/homebox/backend/ent/location"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LocationCreate is the builder for creating a Location entity.
|
// LocationCreate is the builder for creating a Location entity.
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/hay-kot/content/backend/ent/location"
|
"github.com/hay-kot/homebox/backend/ent/location"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LocationDelete is the builder for deleting a Location entity.
|
// LocationDelete is the builder for deleting a Location entity.
|
||||||
|
|
|
@ -12,10 +12,10 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
"github.com/hay-kot/content/backend/ent/location"
|
"github.com/hay-kot/homebox/backend/ent/location"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LocationQuery is the builder for querying Location entities.
|
// LocationQuery is the builder for querying Location entities.
|
||||||
|
|
|
@ -12,10 +12,10 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
"github.com/hay-kot/content/backend/ent/location"
|
"github.com/hay-kot/homebox/backend/ent/location"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LocationUpdate is the builder for updating Location entities.
|
// LocationUpdate is the builder for updating Location entities.
|
||||||
|
|
|
@ -10,17 +10,17 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/attachment"
|
"github.com/hay-kot/homebox/backend/ent/attachment"
|
||||||
"github.com/hay-kot/content/backend/ent/authtokens"
|
"github.com/hay-kot/homebox/backend/ent/authtokens"
|
||||||
"github.com/hay-kot/content/backend/ent/document"
|
"github.com/hay-kot/homebox/backend/ent/document"
|
||||||
"github.com/hay-kot/content/backend/ent/documenttoken"
|
"github.com/hay-kot/homebox/backend/ent/documenttoken"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
"github.com/hay-kot/content/backend/ent/itemfield"
|
"github.com/hay-kot/homebox/backend/ent/itemfield"
|
||||||
"github.com/hay-kot/content/backend/ent/label"
|
"github.com/hay-kot/homebox/backend/ent/label"
|
||||||
"github.com/hay-kot/content/backend/ent/location"
|
"github.com/hay-kot/homebox/backend/ent/location"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
"github.com/hay-kot/content/backend/ent/user"
|
"github.com/hay-kot/homebox/backend/ent/user"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
)
|
)
|
||||||
|
|
|
@ -6,17 +6,17 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/attachment"
|
"github.com/hay-kot/homebox/backend/ent/attachment"
|
||||||
"github.com/hay-kot/content/backend/ent/authtokens"
|
"github.com/hay-kot/homebox/backend/ent/authtokens"
|
||||||
"github.com/hay-kot/content/backend/ent/document"
|
"github.com/hay-kot/homebox/backend/ent/document"
|
||||||
"github.com/hay-kot/content/backend/ent/documenttoken"
|
"github.com/hay-kot/homebox/backend/ent/documenttoken"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/item"
|
"github.com/hay-kot/homebox/backend/ent/item"
|
||||||
"github.com/hay-kot/content/backend/ent/itemfield"
|
"github.com/hay-kot/homebox/backend/ent/itemfield"
|
||||||
"github.com/hay-kot/content/backend/ent/label"
|
"github.com/hay-kot/homebox/backend/ent/label"
|
||||||
"github.com/hay-kot/content/backend/ent/location"
|
"github.com/hay-kot/homebox/backend/ent/location"
|
||||||
"github.com/hay-kot/content/backend/ent/schema"
|
"github.com/hay-kot/homebox/backend/ent/schema"
|
||||||
"github.com/hay-kot/content/backend/ent/user"
|
"github.com/hay-kot/homebox/backend/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The init function reads all schema descriptors with runtime code
|
// The init function reads all schema descriptors with runtime code
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
package runtime
|
package runtime
|
||||||
|
|
||||||
// The schema-stitching logic is generated in github.com/hay-kot/content/backend/ent/runtime.go
|
// The schema-stitching logic is generated in github.com/hay-kot/homebox/backend/ent/runtime.go
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Version = "v0.11.2" // Version of ent codegen.
|
Version = "v0.11.2" // Version of ent codegen.
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/schema/edge"
|
"entgo.io/ent/schema/edge"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/hay-kot/content/backend/ent/schema/mixins"
|
"github.com/hay-kot/homebox/backend/ent/schema/mixins"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Attachment holds the schema definition for the Attachment entity.
|
// Attachment holds the schema definition for the Attachment entity.
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"entgo.io/ent/schema/edge"
|
"entgo.io/ent/schema/edge"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"entgo.io/ent/schema/index"
|
"entgo.io/ent/schema/index"
|
||||||
"github.com/hay-kot/content/backend/ent/schema/mixins"
|
"github.com/hay-kot/homebox/backend/ent/schema/mixins"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AuthTokens holds the schema definition for the AuthTokens entity.
|
// AuthTokens holds the schema definition for the AuthTokens entity.
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"entgo.io/ent/dialect/entsql"
|
"entgo.io/ent/dialect/entsql"
|
||||||
"entgo.io/ent/schema/edge"
|
"entgo.io/ent/schema/edge"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/hay-kot/content/backend/ent/schema/mixins"
|
"github.com/hay-kot/homebox/backend/ent/schema/mixins"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Document holds the schema definition for the Document entity.
|
// Document holds the schema definition for the Document entity.
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"entgo.io/ent/schema/edge"
|
"entgo.io/ent/schema/edge"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"entgo.io/ent/schema/index"
|
"entgo.io/ent/schema/index"
|
||||||
"github.com/hay-kot/content/backend/ent/schema/mixins"
|
"github.com/hay-kot/homebox/backend/ent/schema/mixins"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DocumentToken holds the schema definition for the DocumentToken entity.
|
// DocumentToken holds the schema definition for the DocumentToken entity.
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"entgo.io/ent/dialect/entsql"
|
"entgo.io/ent/dialect/entsql"
|
||||||
"entgo.io/ent/schema/edge"
|
"entgo.io/ent/schema/edge"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/hay-kot/content/backend/ent/schema/mixins"
|
"github.com/hay-kot/homebox/backend/ent/schema/mixins"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Group holds the schema definition for the Group entity.
|
// Group holds the schema definition for the Group entity.
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"entgo.io/ent/schema/edge"
|
"entgo.io/ent/schema/edge"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"entgo.io/ent/schema/index"
|
"entgo.io/ent/schema/index"
|
||||||
"github.com/hay-kot/content/backend/ent/schema/mixins"
|
"github.com/hay-kot/homebox/backend/ent/schema/mixins"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Item holds the schema definition for the Item entity.
|
// Item holds the schema definition for the Item entity.
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/schema/edge"
|
"entgo.io/ent/schema/edge"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/hay-kot/content/backend/ent/schema/mixins"
|
"github.com/hay-kot/homebox/backend/ent/schema/mixins"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ItemField holds the schema definition for the ItemField entity.
|
// ItemField holds the schema definition for the ItemField entity.
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"entgo.io/ent/dialect/entsql"
|
"entgo.io/ent/dialect/entsql"
|
||||||
"entgo.io/ent/schema/edge"
|
"entgo.io/ent/schema/edge"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/hay-kot/content/backend/ent/schema/mixins"
|
"github.com/hay-kot/homebox/backend/ent/schema/mixins"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Label holds the schema definition for the Label entity.
|
// Label holds the schema definition for the Label entity.
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/dialect/entsql"
|
"entgo.io/ent/dialect/entsql"
|
||||||
"entgo.io/ent/schema/edge"
|
"entgo.io/ent/schema/edge"
|
||||||
"github.com/hay-kot/content/backend/ent/schema/mixins"
|
"github.com/hay-kot/homebox/backend/ent/schema/mixins"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Location holds the schema definition for the Location entity.
|
// Location holds the schema definition for the Location entity.
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"entgo.io/ent/dialect/entsql"
|
"entgo.io/ent/dialect/entsql"
|
||||||
"entgo.io/ent/schema/edge"
|
"entgo.io/ent/schema/edge"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/hay-kot/content/backend/ent/schema/mixins"
|
"github.com/hay-kot/homebox/backend/ent/schema/mixins"
|
||||||
)
|
)
|
||||||
|
|
||||||
// User holds the schema definition for the User entity.
|
// User holds the schema definition for the User entity.
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/user"
|
"github.com/hay-kot/homebox/backend/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// User is the model entity for the User schema.
|
// User is the model entity for the User schema.
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ID filters vertices based on their ID field.
|
// ID filters vertices based on their ID field.
|
||||||
|
|
|
@ -11,9 +11,9 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/authtokens"
|
"github.com/hay-kot/homebox/backend/ent/authtokens"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/user"
|
"github.com/hay-kot/homebox/backend/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserCreate is the builder for creating a User entity.
|
// UserCreate is the builder for creating a User entity.
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
"github.com/hay-kot/content/backend/ent/user"
|
"github.com/hay-kot/homebox/backend/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserDelete is the builder for deleting a User entity.
|
// UserDelete is the builder for deleting a User entity.
|
||||||
|
|
|
@ -12,10 +12,10 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/authtokens"
|
"github.com/hay-kot/homebox/backend/ent/authtokens"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
"github.com/hay-kot/content/backend/ent/user"
|
"github.com/hay-kot/homebox/backend/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserQuery is the builder for querying User entities.
|
// UserQuery is the builder for querying User entities.
|
||||||
|
|
|
@ -12,10 +12,10 @@ import (
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hay-kot/content/backend/ent/authtokens"
|
"github.com/hay-kot/homebox/backend/ent/authtokens"
|
||||||
"github.com/hay-kot/content/backend/ent/group"
|
"github.com/hay-kot/homebox/backend/ent/group"
|
||||||
"github.com/hay-kot/content/backend/ent/predicate"
|
"github.com/hay-kot/homebox/backend/ent/predicate"
|
||||||
"github.com/hay-kot/content/backend/ent/user"
|
"github.com/hay-kot/homebox/backend/ent/user"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserUpdate is the builder for updating User entities.
|
// UserUpdate is the builder for updating User entities.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module github.com/hay-kot/content/backend
|
module github.com/hay-kot/homebox/backend
|
||||||
|
|
||||||
go 1.19
|
go 1.19
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue