diff --git a/api/docs/openAPI/openApi.go b/api/docs/openAPI/openApi.go index 0ff3b51..5e563d6 100644 --- a/api/docs/openAPI/openApi.go +++ b/api/docs/openAPI/openApi.go @@ -4,6 +4,7 @@ import ( "encoding/json" "github.com/a-h/rest" "log" + "net/http" "os" ) @@ -14,6 +15,14 @@ func main() { api = rest.NewAPI("portfolio") api.StripPkgPaths = []string{"github.com/a-h/rest/example", "github.com/a-h/respond"} + api.Get("/nfc/{uid}"). + HasPathParameter("uid", rest.PathParam{ + Description: "id of the user", + Regexp: `\d+`, + }). + HasDescription("Get nfc data by uid."). + HasResponseModel(http.StatusOK, rest.ModelOf[string]()) + // Create the specification. spec, err := api.Spec() if err != nil { diff --git a/common/docs/Dockerfile b/common/docs/Dockerfile new file mode 100644 index 0000000..7b3d3db --- /dev/null +++ b/common/docs/Dockerfile @@ -0,0 +1,29 @@ +FROM golang:latest as openApiGen + +ADD . . + +RUN go run ./api/docs/openAPI + +FROM registry.jetbrains.team/p/writerside/builder/writerside-builder:241.15989 as build + +ARG INSTANCE=Writerside/portfolio + +RUN mkdir /opt/sources + +WORKDIR /opt/sources + +COPY --from=openApiGen /go/common/docs/openApi.json ./Writerside + +ADD ./common/docs ./Writerside + +RUN export DISPLAY=:99 && \ +Xvfb :99 & \ +/opt/builder/bin/idea.sh helpbuilderinspect -source-dir /opt/sources --product $INSTANCE --runner other --output-dir /opt/wrs-output/ + +WORKDIR /opt/wrs-output + +RUN unzip webHelpPORTFOLIO2-all.zip -d /opt/wrs-output/unzipped-artifact + +FROM httpd:2.4 as http-server + +COPY --from=build /opt/wrs-output/unzipped-artifact/ /usr/local/apache2/htdocs/ \ No newline at end of file diff --git a/Writerside/c.list b/common/docs/c.list similarity index 100% rename from Writerside/c.list rename to common/docs/c.list diff --git a/Writerside/cfg/buildprofiles.xml b/common/docs/cfg/buildprofiles.xml similarity index 100% rename from Writerside/cfg/buildprofiles.xml rename to common/docs/cfg/buildprofiles.xml diff --git a/common/docs/openApi.json b/common/docs/openApi.json index 293cc85..4ac56a5 100644 --- a/common/docs/openApi.json +++ b/common/docs/openApi.json @@ -1,9 +1,42 @@ { "components": {}, "info": { - "title": "messages", + "title": "portfolio", "version": "0.0.0" }, "openapi": "3.0.0", - "paths": {} + "paths": { + "/nfc/{uid}": { + "get": { + "description": "Get nfc data by uid.", + "parameters": [ + { + "description": "id of the user", + "in": "path", + "name": "uid", + "required": true, + "schema": { + "pattern": "\\d+", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + }, + "description": "" + }, + "default": { + "description": "" + } + } + } + } + } } diff --git a/Writerside/portfolio.tree b/common/docs/portfolio.tree similarity index 51% rename from Writerside/portfolio.tree rename to common/docs/portfolio.tree index 8604aa6..39df7c7 100644 --- a/Writerside/portfolio.tree +++ b/common/docs/portfolio.tree @@ -4,6 +4,11 @@ + start-page="test.md"> + + + + + \ No newline at end of file diff --git a/Writerside/redirection-rules.xml b/common/docs/redirection-rules.xml similarity index 100% rename from Writerside/redirection-rules.xml rename to common/docs/redirection-rules.xml diff --git a/Writerside/topics/openApi.json/API_Reference.md b/common/docs/topics/openApi.json/API_Reference.md similarity index 100% rename from Writerside/topics/openApi.json/API_Reference.md rename to common/docs/topics/openApi.json/API_Reference.md diff --git a/common/docs/topics/openApi.json/Schemas.md b/common/docs/topics/openApi.json/Schemas.md new file mode 100644 index 0000000..a40b7b6 --- /dev/null +++ b/common/docs/topics/openApi.json/Schemas.md @@ -0,0 +1,3 @@ +# Schemas + +Start typing here... \ No newline at end of file diff --git a/common/docs/topics/openApi.json/nfc_uid_GET.md b/common/docs/topics/openApi.json/nfc_uid_GET.md new file mode 100644 index 0000000..a3a548b --- /dev/null +++ b/common/docs/topics/openApi.json/nfc_uid_GET.md @@ -0,0 +1,3 @@ +# /nfc/{uid} GET + + \ No newline at end of file diff --git a/common/docs/topics/test.md b/common/docs/topics/test.md new file mode 100644 index 0000000..f2099fe --- /dev/null +++ b/common/docs/topics/test.md @@ -0,0 +1,3 @@ +# test + +Start typing here... \ No newline at end of file diff --git a/Writerside/v.list b/common/docs/v.list similarity index 100% rename from Writerside/v.list rename to common/docs/v.list diff --git a/Writerside/writerside.cfg b/common/docs/writerside.cfg similarity index 100% rename from Writerside/writerside.cfg rename to common/docs/writerside.cfg diff --git a/database/ent/generate.go b/database/ent/generate.go index 8d3fdfd..9fdb106 100644 --- a/database/ent/generate.go +++ b/database/ent/generate.go @@ -1,3 +1,3 @@ package ent -//go:generate go run -mod=mod entgo.io/ent/cmd/ent generate ./schema +//go:generate go run entgo.io/ent/cmd/ent generate ./schema diff --git a/docker-compose.yml b/docker-compose.yml index 0a13044..b4c538e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,3 +24,13 @@ services: database: condition: service_healthy + docs: + build: . + ports: + - "4003:80" + restart: unless-stopped + image: docker.dariusklein.nl/portfolio:latest + depends_on: + database: + condition: service_healthy +