mirror of
https://github.com/vcscsvcscs/GenerationsHeritage.git
synced 2025-08-12 22:09:07 +02:00
Compare commits
2 Commits
feature/Ad
...
feature/up
Author | SHA1 | Date | |
---|---|---|---|
10c9ad393d | |||
c1df052462 |
2
.github/workflows/auth-service-cd.yml
vendored
2
.github/workflows/auth-service-cd.yml
vendored
@@ -48,4 +48,4 @@ jobs:
|
||||
push: true
|
||||
context: "{{defaultContext}}:auth-service"
|
||||
tags: vcscsvcscs/gheritage-auth-service:${{steps.create_image_tag.outputs.result}}
|
||||
platforms: linux/arm64
|
||||
platforms: linux/arm64/v8
|
||||
|
2
.github/workflows/backend-cd.yml
vendored
2
.github/workflows/backend-cd.yml
vendored
@@ -48,4 +48,4 @@ jobs:
|
||||
push: true
|
||||
context: "{{defaultContext}}:backend"
|
||||
tags: vcscsvcscs/gheritage-backend-service:${{steps.create_image_tag.outputs.result}}
|
||||
platforms: linux/arm64
|
||||
platforms: linux/arm64/v8
|
||||
|
@@ -1,23 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/zitadel/zitadel-go/v3/pkg/authorization/oauth"
|
||||
"github.com/zitadel/zitadel-go/v3/pkg/http/middleware"
|
||||
)
|
||||
|
||||
func auth(mw *middleware.Interceptor[*oauth.IntrospectionContext]) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
mw.RequireAuthorization()(http.HandlerFunc(authHTTPHandler(mw, c))).ServeHTTP(c.Writer, c.Request)
|
||||
}
|
||||
}
|
||||
|
||||
func authHTTPHandler(mw *middleware.Interceptor[*oauth.IntrospectionContext], c *gin.Context) func(w http.ResponseWriter, r *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
authCtx := mw.Context(r.Context())
|
||||
w.Header().Set("id", authCtx.UserID())
|
||||
c.JSON(http.StatusOK, gin.H{"id": authCtx.UserID(), "status": "ok"})
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
FROM arm64v8/golang:1.22.2-alpine as build
|
||||
FROM golang:1.22.2-alpine as build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@@ -6,11 +6,8 @@ COPY . .
|
||||
|
||||
RUN GOOS=linux GOARCH=arm64 go build -o auth-service
|
||||
|
||||
RUN apk update && apk add ca-certificates && update-ca-certificates
|
||||
FROM arm64v8/busybox
|
||||
|
||||
FROM arm64v8/busybox:1.36.1
|
||||
|
||||
COPY --from=build /etc/ssl/certs /etc/ssl/certs
|
||||
COPY --from=build /app/auth-service /app/
|
||||
|
||||
CMD [ "/app/auth-service" ]
|
@@ -3,47 +3,30 @@ module github.com/vcscsvcscs/GenerationsHeritage/auth-service
|
||||
go 1.22.2
|
||||
|
||||
require (
|
||||
github.com/gin-contrib/cors v1.7.2
|
||||
github.com/gin-gonic/gin v1.9.1
|
||||
github.com/vcscsvcscs/GenerationsHeritage/utilities v0.0.0-20240414091827-ffde94d457cb
|
||||
github.com/zitadel/zitadel-go/v3 v3.0.0-next.2
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/bytedance/sonic v1.11.6 // indirect
|
||||
github.com/bytedance/sonic/loader v0.1.1 // indirect
|
||||
github.com/cloudwego/base64x v0.1.4 // indirect
|
||||
github.com/cloudwego/iasm v0.2.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
|
||||
github.com/bytedance/sonic v1.9.1 // indirect
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/go-jose/go-jose/v3 v3.0.1 // indirect
|
||||
github.com/gin-gonic/gin v1.9.1 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.20.0 // indirect
|
||||
github.com/go-playground/validator/v10 v10.14.0 // indirect
|
||||
github.com/goccy/go-json v0.10.2 // indirect
|
||||
github.com/gorilla/securecookie v1.1.2 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
|
||||
github.com/leodido/go-urn v1.2.4 // indirect
|
||||
github.com/mattn/go-isatty v0.0.19 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/muhlemmer/gu v0.3.1 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.1 // indirect
|
||||
github.com/sirupsen/logrus v1.9.3 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.12 // indirect
|
||||
github.com/zitadel/logging v0.5.0 // indirect
|
||||
github.com/zitadel/oidc/v3 v3.5.1 // indirect
|
||||
github.com/zitadel/schema v1.3.0 // indirect
|
||||
golang.org/x/arch v0.7.0 // indirect
|
||||
golang.org/x/crypto v0.22.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
|
||||
golang.org/x/net v0.24.0 // indirect
|
||||
golang.org/x/oauth2 v0.19.0 // indirect
|
||||
golang.org/x/sys v0.19.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
google.golang.org/protobuf v1.34.0 // indirect
|
||||
github.com/ugorji/go/codec v1.2.11 // indirect
|
||||
github.com/vcscsvcscs/GenerationsHeritage/utilities v0.0.0-20240414091827-ffde94d457cb // indirect
|
||||
golang.org/x/arch v0.3.0 // indirect
|
||||
golang.org/x/crypto v0.9.0 // indirect
|
||||
golang.org/x/net v0.10.0 // indirect
|
||||
golang.org/x/sys v0.8.0 // indirect
|
||||
golang.org/x/text v0.9.0 // indirect
|
||||
google.golang.org/protobuf v1.30.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
@@ -1,153 +1,80 @@
|
||||
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
|
||||
github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
|
||||
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
|
||||
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
|
||||
github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
|
||||
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
||||
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
|
||||
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
|
||||
github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s=
|
||||
github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U=
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams=
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
|
||||
github.com/gin-contrib/cors v1.7.2 h1:oLDHxdg8W/XDoN/8zamqk/Drgt4oVZDvaV0YmvVICQw=
|
||||
github.com/gin-contrib/cors v1.7.2/go.mod h1:SUJVARKgQ40dmrzgXEVxj2m7Ig1v1qIboQkPDTQ9t2E=
|
||||
github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=
|
||||
github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
|
||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=
|
||||
github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU=
|
||||
github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk=
|
||||
github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
|
||||
github.com/go-jose/go-jose/v3 v3.0.1 h1:pWmKFVtt+Jl0vBZTIpz/eAKwsm6LkIxDVVbFHKkchhA=
|
||||
github.com/go-jose/go-jose/v3 v3.0.1/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8=
|
||||
github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY=
|
||||
github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8=
|
||||
github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
|
||||
github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js=
|
||||
github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
|
||||
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
||||
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
|
||||
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
|
||||
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA=
|
||||
github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo=
|
||||
github.com/jeremija/gosubmit v0.2.7 h1:At0OhGCFGPXyjPYAsCchoBUhE099pcBXmsb4iZqROIc=
|
||||
github.com/jeremija/gosubmit v0.2.7/go.mod h1:Ui+HS073lCFREXBbdfrJzMB57OI/bdxTiLtrDHHhFPI=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk=
|
||||
github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
|
||||
github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
|
||||
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
|
||||
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
|
||||
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/muhlemmer/gu v0.3.1 h1:7EAqmFrW7n3hETvuAdmFmn4hS8W+z3LgKtrnow+YzNM=
|
||||
github.com/muhlemmer/gu v0.3.1/go.mod h1:YHtHR+gxM+bKEIIs7Hmi9sPT3ZDUvTN/i88wQpZkrdM=
|
||||
github.com/muhlemmer/httpforwarded v0.1.0 h1:x4DLrzXdliq8mprgUMR0olDvHGkou5BJsK/vWUetyzY=
|
||||
github.com/muhlemmer/httpforwarded v0.1.0/go.mod h1:yo9czKedo2pdZhoXe+yDkGVbU0TJ0q9oQ90BVoDEtw0=
|
||||
github.com/pelletier/go-toml/v2 v2.2.1 h1:9TA9+T8+8CUCO2+WYnDLCgrYi9+omqKXyjDtosvtEhg=
|
||||
github.com/pelletier/go-toml/v2 v2.2.1/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ=
|
||||
github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
|
||||
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
|
||||
github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo=
|
||||
github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
|
||||
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
|
||||
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
|
||||
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=
|
||||
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
github.com/vcscsvcscs/GenerationsHeritage/utilities v0.0.0-20240414091827-ffde94d457cb h1:fU736we2gQQRMOWP/su7sCiUFmrXTKBN0s8LG5k7bOE=
|
||||
github.com/vcscsvcscs/GenerationsHeritage/utilities v0.0.0-20240414091827-ffde94d457cb/go.mod h1:aQlmG6BiGFmOFxzAkWTJDzm1EzdCJ4OEETXTUkWJaLk=
|
||||
github.com/zitadel/logging v0.5.0 h1:Kunouvqse/efXy4UDvFw5s3vP+Z4AlHo3y8wF7stXHA=
|
||||
github.com/zitadel/logging v0.5.0/go.mod h1:IzP5fzwFhzzyxHkSmfF8dsyqFsQRJLLcQmwhIBzlGsE=
|
||||
github.com/zitadel/oidc/v3 v3.5.1 h1:7gyrxRNqX5eZYai2KhzPj8MhBZ7I3YpviQeX1Lp4j4U=
|
||||
github.com/zitadel/oidc/v3 v3.5.1/go.mod h1:R8sF5DPR98QQnOoyySsaNqI4NcF/VFMkf/XoYiBUuXQ=
|
||||
github.com/zitadel/schema v1.3.0 h1:kQ9W9tvIwZICCKWcMvCEweXET1OcOyGEuFbHs4o5kg0=
|
||||
github.com/zitadel/schema v1.3.0/go.mod h1:NptN6mkBDFvERUCvZHlvWmmME+gmZ44xzwRXwhzsbtc=
|
||||
github.com/zitadel/zitadel-go/v3 v3.0.0-next.2 h1:w0lnLvijwQwkrUEA74loenNR9udRAaq6rccjlMSA+4U=
|
||||
github.com/zitadel/zitadel-go/v3 v3.0.0-next.2/go.mod h1:SY9IZuDw/766mwEobCX7JNwXawIQxVseo679JG1U0c0=
|
||||
go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc=
|
||||
go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo=
|
||||
go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4=
|
||||
go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM=
|
||||
go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc=
|
||||
go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ=
|
||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/arch v0.7.0 h1:pskyeJh/3AmoQ8CPE95vxHLqp1G1GfGNXTmcl9NEKTc=
|
||||
golang.org/x/arch v0.7.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
|
||||
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
|
||||
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM=
|
||||
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
|
||||
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
|
||||
golang.org/x/oauth2 v0.19.0 h1:9+E/EZBCbTLNrbN35fHv/a/d/mOBatymz1zbtQrXpIg=
|
||||
golang.org/x/oauth2 v0.19.0/go.mod h1:vYi7skDa1x015PmRRYZ7+s1cWyPgrPiSYRe4rnsexc8=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k=
|
||||
golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
|
||||
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
|
||||
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
|
||||
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v1.34.0 h1:Qo/qEd2RZPCf2nKuorzksSknv0d3ERwp1vFG38gSmH4=
|
||||
google.golang.org/protobuf v1.34.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
|
||||
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
||||
|
@@ -1,85 +1,5 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/vcscsvcscs/GenerationsHeritage/utilities"
|
||||
"github.com/vcscsvcscs/GenerationsHeritage/utilities/gin_liveness"
|
||||
|
||||
"github.com/zitadel/zitadel-go/v3/pkg/authorization"
|
||||
"github.com/zitadel/zitadel-go/v3/pkg/authorization/oauth"
|
||||
"github.com/zitadel/zitadel-go/v3/pkg/http/middleware"
|
||||
"github.com/zitadel/zitadel-go/v3/pkg/zitadel"
|
||||
)
|
||||
|
||||
var (
|
||||
cert = flag.String("cert", "/etc/gh-auth-service/ssl/tls.crt", "Specify the path of TLS cert")
|
||||
key = flag.String("key", "/etc/gh-auth-service/ssl/tls.key", "Specify the path of TLS key")
|
||||
zitadelAccessKey = flag.String("zitadel-access-key", "/etc/gh-auth-service/zitadel/api-key.json", "Specify the path of Zitadel access key")
|
||||
httpsPort = flag.String("https", ":443", "Specify port for http secure hosting(example for format :443)")
|
||||
httpPort = flag.String("http", ":80", "Specify port for http hosting(example for format :80)")
|
||||
zitadelURI = flag.String("zitadel-uri", "zitadel.varghacsongor.hu", "Specify the Zitadel URI")
|
||||
release = flag.Bool("release", false, "Set true to release build")
|
||||
logToFile = flag.Bool("log-to-file", false, "Set true to log to file")
|
||||
logToFileAndStd = flag.Bool("log-to-file-and-std", false, "Set true to log to file and std")
|
||||
requestTimeout = time.Duration(*flag.Int("request-timeout", 20, "Set request timeout in seconds"))
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
if *release {
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
}
|
||||
|
||||
utilities.SetupLogger(*logToFileAndStd, *logToFile)
|
||||
|
||||
hc := gin_liveness.New()
|
||||
|
||||
router := gin.Default()
|
||||
router.Use(gin.Recovery())
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
// Initiate the authorization by providing a zitadel configuration and a verifier.
|
||||
// This example will use OAuth2 Introspection for this, therefore you will also need to provide the downloaded api key.json
|
||||
authZ, err := authorization.New(ctx, zitadel.New(*zitadelURI), oauth.DefaultAuthorization(*zitadelAccessKey))
|
||||
if err != nil {
|
||||
log.Println("zitadel sdk could not initialize", "error", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Initialize the HTTP middleware by providing the authorization
|
||||
mw := middleware.New(authZ)
|
||||
|
||||
router.GET("/health", hc.HealthCheckHandler())
|
||||
router.GET("/auth", auth(mw))
|
||||
|
||||
server := utilities.SetupHttpsServer(router, *cert, *key, *httpsPort, *httpPort, requestTimeout)
|
||||
|
||||
// Wait for interrupt signal to gracefully shutdown the server with some time to finish requests.
|
||||
quit := make(chan os.Signal, 1)
|
||||
// kill (no param) default send syscall.SIGTERM
|
||||
// kill -2 is syscall.SIGINT
|
||||
// kill -9 is syscall.SIGKILL but can't be caught, so don't need to add it
|
||||
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM, os.Interrupt)
|
||||
<-quit
|
||||
log.Println("Shutting down server...")
|
||||
|
||||
// The context is used to inform the server it has some seconds to finish
|
||||
// the request it is currently handling
|
||||
ctx, cancel := context.WithTimeout(context.Background(), requestTimeout*time.Second)
|
||||
defer cancel()
|
||||
|
||||
if err := server.Shutdown(ctx); err != nil {
|
||||
log.Fatal("Server forced to shutdown:", err)
|
||||
}
|
||||
|
||||
log.Println("Server exiting")
|
||||
}
|
||||
|
@@ -1,23 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/zitadel/zitadel-go/v3/pkg/authorization/oauth"
|
||||
"github.com/zitadel/zitadel-go/v3/pkg/http/middleware"
|
||||
)
|
||||
|
||||
func auth(mw *middleware.Interceptor[*oauth.IntrospectionContext]) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
mw.RequireAuthorization()(http.HandlerFunc(authHTTPHandler(mw, c))).ServeHTTP(c.Writer, c.Request)
|
||||
}
|
||||
}
|
||||
|
||||
func authHTTPHandler(mw *middleware.Interceptor[*oauth.IntrospectionContext], c *gin.Context) func(w http.ResponseWriter, r *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
authCtx := mw.Context(r.Context())
|
||||
c.Set("id", authCtx.UserID())
|
||||
c.Next()
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
FROM arm64v8/golang:1.22.2-alpine as build
|
||||
FROM golang:1.22.2-alpine as build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@@ -6,11 +6,8 @@ COPY . .
|
||||
|
||||
RUN GOOS=linux GOARCH=arm64 go build -o backend
|
||||
|
||||
RUN apk update && apk add ca-certificates && update-ca-certificates
|
||||
FROM busybox
|
||||
|
||||
FROM arm64v8/busybox:1.36.1
|
||||
|
||||
COPY --from=build /etc/ssl/certs /etc/ssl/certs
|
||||
COPY --from=build /app/backend /app/
|
||||
|
||||
CMD [ "/app/backend" ]
|
@@ -3,13 +3,11 @@ module github.com/vcscsvcscs/GenerationsHeritage/backend
|
||||
go 1.22.2
|
||||
|
||||
require (
|
||||
github.com/gin-contrib/cors v1.7.1
|
||||
github.com/gin-gonic/gin v1.9.1
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/neo4j/neo4j-go-driver/v5 v5.19.0
|
||||
github.com/vcscsvcscs/GenerationsHeritage/utilities v0.0.0-20240414091827-ffde94d457cb
|
||||
github.com/zitadel/zitadel-go/v3 v3.0.0-next.2
|
||||
golang.org/x/net v0.23.0
|
||||
golang.org/x/net v0.22.0
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -18,31 +16,21 @@ require (
|
||||
github.com/chenzhuoyu/iasm v0.9.1 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/go-jose/go-jose/v3 v3.0.1 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.19.0 // indirect
|
||||
github.com/goccy/go-json v0.10.2 // indirect
|
||||
github.com/gorilla/securecookie v1.1.2 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/muhlemmer/gu v0.3.1 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.0 // indirect
|
||||
github.com/sirupsen/logrus v1.9.3 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.12 // indirect
|
||||
github.com/zitadel/logging v0.5.0 // indirect
|
||||
github.com/zitadel/oidc/v3 v3.5.1 // indirect
|
||||
github.com/zitadel/schema v1.3.0 // indirect
|
||||
golang.org/x/arch v0.7.0 // indirect
|
||||
golang.org/x/crypto v0.21.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20231219180239-dc181d75b848 // indirect
|
||||
golang.org/x/oauth2 v0.19.0 // indirect
|
||||
golang.org/x/sys v0.18.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
google.golang.org/protobuf v1.33.0 // indirect
|
||||
|
@@ -9,26 +9,15 @@ github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d/go.mod h1:8EPpV
|
||||
github.com/chenzhuoyu/iasm v0.9.0/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog=
|
||||
github.com/chenzhuoyu/iasm v0.9.1 h1:tUHQJXo3NhBqw6s33wkGn9SP3bvrWLdlVIJ3hQBL7P0=
|
||||
github.com/chenzhuoyu/iasm v0.9.1/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
|
||||
github.com/gin-contrib/cors v1.7.1 h1:s9SIppU/rk8enVvkzwiC2VK3UZ/0NNGsWfUKvV55rqs=
|
||||
github.com/gin-contrib/cors v1.7.1/go.mod h1:n/Zj7B4xyrgk/cX1WCX2dkzFfaNm/xJb6oIUk7WTtps=
|
||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=
|
||||
github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU=
|
||||
github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk=
|
||||
github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
|
||||
github.com/go-jose/go-jose/v3 v3.0.1 h1:pWmKFVtt+Jl0vBZTIpz/eAKwsm6LkIxDVVbFHKkchhA=
|
||||
github.com/go-jose/go-jose/v3 v3.0.1/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8=
|
||||
github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY=
|
||||
github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
@@ -39,28 +28,17 @@ github.com/go-playground/validator/v10 v10.19.0 h1:ol+5Fu+cSq9JD7SoSqe04GMI92cbn
|
||||
github.com/go-playground/validator/v10 v10.19.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
|
||||
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
||||
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
|
||||
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA=
|
||||
github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo=
|
||||
github.com/jeremija/gosubmit v0.2.7 h1:At0OhGCFGPXyjPYAsCchoBUhE099pcBXmsb4iZqROIc=
|
||||
github.com/jeremija/gosubmit v0.2.7/go.mod h1:Ui+HS073lCFREXBbdfrJzMB57OI/bdxTiLtrDHHhFPI=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
@@ -70,28 +48,17 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/muhlemmer/gu v0.3.1 h1:7EAqmFrW7n3hETvuAdmFmn4hS8W+z3LgKtrnow+YzNM=
|
||||
github.com/muhlemmer/gu v0.3.1/go.mod h1:YHtHR+gxM+bKEIIs7Hmi9sPT3ZDUvTN/i88wQpZkrdM=
|
||||
github.com/muhlemmer/httpforwarded v0.1.0 h1:x4DLrzXdliq8mprgUMR0olDvHGkou5BJsK/vWUetyzY=
|
||||
github.com/muhlemmer/httpforwarded v0.1.0/go.mod h1:yo9czKedo2pdZhoXe+yDkGVbU0TJ0q9oQ90BVoDEtw0=
|
||||
github.com/neo4j/neo4j-go-driver/v5 v5.19.0 h1:v2cB19fZQYz1xmj6EZXofFHD/+Tj16hH/OOp39uNN1I=
|
||||
github.com/neo4j/neo4j-go-driver/v5 v5.19.0/go.mod h1:Vff8OwT7QpLm7L2yYr85XNWe9Rbqlbeb9asNXJTHO4k=
|
||||
github.com/pelletier/go-toml/v2 v2.2.0 h1:QLgLl2yMN7N+ruc31VynXs1vhMZa7CeHHejIeBAsoHo=
|
||||
github.com/pelletier/go-toml/v2 v2.2.0/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
|
||||
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
|
||||
github.com/rs/cors v1.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo=
|
||||
github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
|
||||
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
|
||||
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
@@ -103,54 +70,29 @@ github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
|
||||
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
github.com/vcscsvcscs/GenerationsHeritage/utilities v0.0.0-20240413225529-30321ba5d7e7 h1:6HOZdgsOt8KojDfNDOyHLwv+Chv90MECxMdP+cKKNv4=
|
||||
github.com/vcscsvcscs/GenerationsHeritage/utilities v0.0.0-20240413225529-30321ba5d7e7/go.mod h1:8byGXK+Csy5RCmHrvdMIzS8oVuvkr9Ech2PqLrad7os=
|
||||
github.com/vcscsvcscs/GenerationsHeritage/utilities v0.0.0-20240414091827-ffde94d457cb h1:fU736we2gQQRMOWP/su7sCiUFmrXTKBN0s8LG5k7bOE=
|
||||
github.com/vcscsvcscs/GenerationsHeritage/utilities v0.0.0-20240414091827-ffde94d457cb/go.mod h1:aQlmG6BiGFmOFxzAkWTJDzm1EzdCJ4OEETXTUkWJaLk=
|
||||
github.com/zitadel/logging v0.5.0 h1:Kunouvqse/efXy4UDvFw5s3vP+Z4AlHo3y8wF7stXHA=
|
||||
github.com/zitadel/logging v0.5.0/go.mod h1:IzP5fzwFhzzyxHkSmfF8dsyqFsQRJLLcQmwhIBzlGsE=
|
||||
github.com/zitadel/oidc/v3 v3.5.1 h1:7gyrxRNqX5eZYai2KhzPj8MhBZ7I3YpviQeX1Lp4j4U=
|
||||
github.com/zitadel/oidc/v3 v3.5.1/go.mod h1:R8sF5DPR98QQnOoyySsaNqI4NcF/VFMkf/XoYiBUuXQ=
|
||||
github.com/zitadel/schema v1.3.0 h1:kQ9W9tvIwZICCKWcMvCEweXET1OcOyGEuFbHs4o5kg0=
|
||||
github.com/zitadel/schema v1.3.0/go.mod h1:NptN6mkBDFvERUCvZHlvWmmME+gmZ44xzwRXwhzsbtc=
|
||||
github.com/zitadel/zitadel-go/v3 v3.0.0-next.2 h1:w0lnLvijwQwkrUEA74loenNR9udRAaq6rccjlMSA+4U=
|
||||
github.com/zitadel/zitadel-go/v3 v3.0.0-next.2/go.mod h1:SY9IZuDw/766mwEobCX7JNwXawIQxVseo679JG1U0c0=
|
||||
go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc=
|
||||
go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo=
|
||||
go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4=
|
||||
go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM=
|
||||
go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc=
|
||||
go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ=
|
||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/arch v0.7.0 h1:pskyeJh/3AmoQ8CPE95vxHLqp1G1GfGNXTmcl9NEKTc=
|
||||
golang.org/x/arch v0.7.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
|
||||
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
|
||||
golang.org/x/exp v0.0.0-20231219180239-dc181d75b848 h1:+iq7lrkxmFNBM7xx+Rae2W6uyPfhPeDWD+n+JgppptE=
|
||||
golang.org/x/exp v0.0.0-20231219180239-dc181d75b848/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
|
||||
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
|
||||
golang.org/x/oauth2 v0.19.0 h1:9+E/EZBCbTLNrbN35fHv/a/d/mOBatymz1zbtQrXpIg=
|
||||
golang.org/x/oauth2 v0.19.0/go.mod h1:vYi7skDa1x015PmRRYZ7+s1cWyPgrPiSYRe4rnsexc8=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc=
|
||||
golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
|
||||
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
|
||||
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
@@ -35,7 +35,6 @@ func CreatePerson(driver neo4j.DriverWithContext) gin.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
person.ID = c.GetString("id")
|
||||
rec, err := person.CreatePerson(driver)
|
||||
if err != nil {
|
||||
log.Printf("ip: %s error: %s", c.ClientIP(), err.Error())
|
||||
|
@@ -18,7 +18,7 @@ func ViewFamiliyTree(driver neo4j.DriverWithContext) gin.HandlerFunc {
|
||||
session := driver.NewSession(ctx, neo4j.SessionConfig{AccessMode: neo4j.AccessModeRead})
|
||||
defer session.Close(ctx)
|
||||
|
||||
id := c.GetString("id")
|
||||
id := c.Query("id")
|
||||
if id == "" {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "id is required"})
|
||||
|
||||
@@ -26,13 +26,13 @@ func ViewFamiliyTree(driver neo4j.DriverWithContext) gin.HandlerFunc {
|
||||
}
|
||||
|
||||
query := `
|
||||
MATCH (n:Person {id: $person_id})-[p:Parent*1..]->(family:Person)
|
||||
MATCH (n:Person {ID: $person_id})-[p:Parent*1..]->(family:Person)
|
||||
OPTIONAL MATCH (family)-[c:Child]->(children:Person)
|
||||
WITH family, p, children, c, n
|
||||
OPTIONAL MATCH (children)<-[p2:Parent]-(OtherParents:Person)
|
||||
WITH family, p, children, c, OtherParents, p2,n
|
||||
OPTIONAL MATCH (family)-[s:Spouse]-(spouse:Person)
|
||||
RETURN family, p, children, c, OtherParents, p2, spouse, s, n;`
|
||||
RETURN family, p, children, c, OtherParents, p2, spouse, s, n`
|
||||
|
||||
result, err := session.Run(ctx, query, map[string]any{"person_id": id})
|
||||
if err != nil {
|
||||
@@ -42,7 +42,7 @@ func ViewFamiliyTree(driver neo4j.DriverWithContext) gin.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
rec, err := result.Collect(ctx)
|
||||
rec, err := result.Single(ctx)
|
||||
if err != nil {
|
||||
log.Printf("ip: %s error: %s", c.ClientIP(), err)
|
||||
c.JSON(http.StatusNotFound, gin.H{"error": "could not find family tree for person with id: " + id})
|
||||
@@ -50,6 +50,6 @@ func ViewFamiliyTree(driver neo4j.DriverWithContext) gin.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(200, rec)
|
||||
c.JSON(200, rec.AsMap()["n"])
|
||||
}
|
||||
}
|
||||
|
@@ -19,17 +19,13 @@ func ViewPerson(driver neo4j.DriverWithContext) gin.HandlerFunc {
|
||||
defer session.Close(ctx)
|
||||
|
||||
id := c.Query("id")
|
||||
if id == "" {
|
||||
id = c.GetString("id")
|
||||
}
|
||||
|
||||
if id == "" {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "id is required"})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
result, err := session.Run(ctx, "MATCH (n:Person) WHERE n.id = $person_id RETURN n;", map[string]any{"person_id": id})
|
||||
result, err := session.Run(ctx, "MATCH (n:Person) WHERE n.ID = $person_id RETURN n;", map[string]any{"person_id": id})
|
||||
if err != nil {
|
||||
log.Printf("ip: %s error: %s", c.ClientIP(), err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "internal server error"})
|
||||
|
@@ -9,32 +9,25 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/gin-contrib/cors"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/vcscsvcscs/GenerationsHeritage/backend/handlers"
|
||||
"github.com/vcscsvcscs/GenerationsHeritage/backend/memgraph"
|
||||
"github.com/vcscsvcscs/GenerationsHeritage/utilities"
|
||||
"github.com/vcscsvcscs/GenerationsHeritage/utilities/gin_liveness"
|
||||
"github.com/zitadel/zitadel-go/v3/pkg/authorization"
|
||||
"github.com/zitadel/zitadel-go/v3/pkg/authorization/oauth"
|
||||
"github.com/zitadel/zitadel-go/v3/pkg/http/middleware"
|
||||
"github.com/zitadel/zitadel-go/v3/pkg/zitadel"
|
||||
)
|
||||
|
||||
var (
|
||||
cert = flag.String("cert", "/etc/gh-backend/ssl/tls.crt", "Specify the path of TLS cert")
|
||||
key = flag.String("key", "/etc/gh-backend/ssl/tls.key", "Specify the path of TLS key")
|
||||
httpsPort = flag.String("https", ":443", "Specify port for http secure hosting(example for format :443)")
|
||||
httpPort = flag.String("http", ":80", "Specify port for http hosting(example for format :80)")
|
||||
zitadelAccessKey = flag.String("zitadel-access-key", "/etc/gh-backend/zitadel/api-key.json", "Specify the path of Zitadel access key")
|
||||
zitadelURI = flag.String("zitadel-uri", "zitadel.varghacsongor.hu", "Specify the Zitadel URI")
|
||||
memgraphURI = flag.String("memgraph", "bolt+ssc://memgraph:7687", "Specify the Memgraph database URI")
|
||||
memgraphUser = flag.String("memgraph-user", "", "Specify the Memgraph database user")
|
||||
memgraphPass = flag.String("memgraph-pass", "", "Specify the Memgraph database password")
|
||||
release = flag.Bool("release", false, "Set true to release build")
|
||||
logToFile = flag.Bool("log-to-file", false, "Set true to log to file")
|
||||
logToFileAndStd = flag.Bool("log-to-file-and-std", false, "Set true to log to file and std")
|
||||
requestTimeout = time.Duration(*flag.Int("request-timeout", 20, "Set request timeout in seconds"))
|
||||
cert = flag.String("cert", "./private/keys/cert.pem", "Specify the path of TLS cert")
|
||||
key = flag.String("key", "./private/keys/key.pem", "Specify the path of TLS key")
|
||||
httpsPort = flag.String("https", ":443", "Specify port for http secure hosting(example for format :443)")
|
||||
httpPort = flag.String("http", ":80", "Specify port for http hosting(example for format :80)")
|
||||
memgraphURI = flag.String("memgraph", "bolt+ssc://memgraph:7687", "Specify the Memgraph database URI")
|
||||
memgraphUser = flag.String("memgraph-user", "", "Specify the Memgraph database user")
|
||||
memgraphPass = flag.String("memgraph-pass", "", "Specify the Memgraph database password")
|
||||
release = flag.Bool("release", false, "Set true to release build")
|
||||
logToFile = flag.Bool("log-to-file", false, "Set true to log to file")
|
||||
logToFileAndStd = flag.Bool("log-to-file-and-std", false, "Set true to log to file and std")
|
||||
requestTimeout = time.Duration(*flag.Int("request-timeout", 20, "Set request timeout in seconds"))
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -50,28 +43,6 @@ func main() {
|
||||
memgraphDriver := memgraph.InitDatabase(*memgraphURI, *memgraphUser, *memgraphPass)
|
||||
|
||||
router := gin.Default()
|
||||
router.Use(cors.New(cors.Config{
|
||||
AllowOrigins: []string{"http://localhost:5173", "http://localhost", "https://heritagebackend.varghacsongor.hu", "https://feature-add-frontend.generationsheritage.pages.dev/", "https://csalad.varghacsongor.hu/"},
|
||||
AllowCredentials: true,
|
||||
AllowHeaders: []string{"Authorization", "id", "Content-Type"},
|
||||
MaxAge: 12 * time.Hour,
|
||||
}))
|
||||
router.Use(gin.Recovery())
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
// Initiate the authorization by providing a zitadel configuration and a verifier.
|
||||
// This example will use OAuth2 Introspection for this, therefore you will also need to provide the downloaded api key.json
|
||||
authZ, err := authorization.New(ctx, zitadel.New(*zitadelURI), oauth.DefaultAuthorization(*zitadelAccessKey))
|
||||
if err != nil {
|
||||
log.Println("zitadel sdk could not initialize", "error", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Initialize the HTTP middleware by providing the authorization
|
||||
mw := middleware.New(authZ)
|
||||
|
||||
router.Use(auth(mw))
|
||||
router.GET("/health", hc.HealthCheckHandler())
|
||||
router.GET("/person", handlers.ViewPerson(memgraphDriver))
|
||||
router.POST("/person", handlers.CreatePerson(memgraphDriver))
|
||||
|
@@ -2,14 +2,16 @@ package memgraph
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/neo4j/neo4j-go-driver/v5/neo4j"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
func (p *Person) CreatePerson(driver neo4j.DriverWithContext) (*neo4j.Record, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
|
||||
session := driver.NewSession(ctx, neo4j.SessionConfig{AccessMode: neo4j.AccessModeWrite})
|
||||
@@ -19,6 +21,8 @@ func (p *Person) CreatePerson(driver neo4j.DriverWithContext) (*neo4j.Record, er
|
||||
return nil, err
|
||||
}
|
||||
|
||||
p.ID = strings.ReplaceAll(uuid.New().String(), "-", "")
|
||||
|
||||
query := fmt.Sprintf("CREATE (n:Person {%s}) RETURN n;", p.ToString())
|
||||
|
||||
result, err := session.Run(ctx, query, nil)
|
||||
|
@@ -19,7 +19,7 @@ func (r *Relationship) CreateRelationship(driver neo4j.DriverWithContext) (*neo4
|
||||
return nil, err
|
||||
}
|
||||
|
||||
query := fmt.Sprintf(`MATCH (a:Person), (b:Person) WHERE a.id = '%s' AND b.id = '%s'`, r.FirstPersonID, r.SecondPersonID)
|
||||
query := fmt.Sprintf(`MATCH (a:Person), (b:Person) WHERE a.ID = '%s' AND b.ID = '%s'`, r.FirstPersonID, r.SecondPersonID)
|
||||
|
||||
if r.Direction == "->" {
|
||||
query = fmt.Sprintf(`%s CREATE (a)-[r:%s {verified: false}]->(b) RETURN r;`, query, r.Relationship)
|
||||
|
@@ -23,7 +23,7 @@ func (rp *RelationshipAndPerson) CreateRelationshipAndPerson(driver neo4j.Driver
|
||||
|
||||
rp.Person.ID = strings.ReplaceAll(uuid.New().String(), "-", "")
|
||||
|
||||
query := fmt.Sprintf(`MATCH (a:Person) WHERE a.id = '%s'`, rp.Relationship.FirstPersonID)
|
||||
query := fmt.Sprintf(`MATCH (a:Person) WHERE a.ID = '%s'`, rp.Relationship.FirstPersonID)
|
||||
|
||||
query = fmt.Sprintf("%s CREATE (b:Person {%s})", query, rp.Person.ToString())
|
||||
|
||||
|
@@ -17,12 +17,12 @@ func createIndexes(driver neo4j.DriverWithContext) error {
|
||||
defer session.Close(ctx)
|
||||
|
||||
indexes := []string{
|
||||
`CREATE INDEX ON :Person(id);`,
|
||||
`CREATE INDEX ON :Person(last_name);`,
|
||||
`CREATE INDEX ON :Person(first_name);`,
|
||||
`CREATE INDEX ON :Person(born);`,
|
||||
`CREATE INDEX ON :Person(mothers_first_name);`,
|
||||
`CREATE INDEX ON :Person(mothers_last_name);`,
|
||||
`CREATE INDEX ON :Person(ID);`,
|
||||
`CREATE INDEX ON :Person(Lastname);`,
|
||||
`CREATE INDEX ON :Person(Firstname);`,
|
||||
`CREATE INDEX ON :Person(Born);`,
|
||||
`CREATE INDEX ON :Person(MothersFirstname);`,
|
||||
`CREATE INDEX ON :Person(MothersLastname);`,
|
||||
}
|
||||
|
||||
// Run index queries via implicit auto-commit transaction
|
||||
@@ -44,14 +44,14 @@ func createConstraints(driver neo4j.DriverWithContext) error {
|
||||
defer session.Close(ctx)
|
||||
|
||||
constraints := []string{
|
||||
`CREATE CONSTRAINT ON (n:Person) ASSERT EXISTS (n.id);`,
|
||||
`CREATE CONSTRAINT ON (n:Person) ASSERT EXISTS (n.last_name);`,
|
||||
`CREATE CONSTRAINT ON (n:Person) ASSERT EXISTS (n.first_name);`,
|
||||
`CREATE CONSTRAINT ON (n:Person) ASSERT EXISTS (n.born);`,
|
||||
`CREATE CONSTRAINT ON (n:Person) ASSERT EXISTS (n.mothers_first_name);`,
|
||||
`CREATE CONSTRAINT ON (n:Person) ASSERT EXISTS (n.mothers_last_name);`,
|
||||
`CREATE CONSTRAINT ON (n:Person) ASSERT n.id IS UNIQUE;`,
|
||||
`CREATE CONSTRAINT ON (n:Person) ASSERT n.last_name, n.first_name, n.born, n.mothers_first_name, n.mothers_last_name IS UNIQUE;`,
|
||||
`CREATE CONSTRAINT ON (n:Person) ASSERT EXISTS (n.ID);`,
|
||||
`CREATE CONSTRAINT ON (n:Person) ASSERT EXISTS (n.Lastname);`,
|
||||
`CREATE CONSTRAINT ON (n:Person) ASSERT EXISTS (n.Firstname);`,
|
||||
`CREATE CONSTRAINT ON (n:Person) ASSERT EXISTS (n.Born);`,
|
||||
`CREATE CONSTRAINT ON (n:Person) ASSERT EXISTS (n.MothersFirstname);`,
|
||||
`CREATE CONSTRAINT ON (n:Person) ASSERT EXISTS (n.MothersLastname);`,
|
||||
`CREATE CONSTRAINT ON (n:Person) ASSERT n.ID IS UNIQUE;`,
|
||||
`CREATE CONSTRAINT ON (n:Person) ASSERT n.Lastname, n.Firstname, n.Born, n.MothersFirstname, n.MothersLastname IS UNIQUE;`,
|
||||
}
|
||||
|
||||
// Run index queries via implicit auto-commit transaction
|
||||
|
@@ -19,7 +19,7 @@ func (p *Person) DeletePerson(driver neo4j.DriverWithContext) error {
|
||||
return err
|
||||
}
|
||||
|
||||
query := fmt.Sprintf("MATCH (n:Person {id: '%s'}) DELETE n;", p.ID)
|
||||
query := fmt.Sprintf("MATCH (n:Person {ID: '%s'}) DELETE n;", p.ID)
|
||||
|
||||
_, err := session.Run(ctx, query, nil)
|
||||
|
||||
|
@@ -28,7 +28,7 @@ func (r *Relationship) DeleteRelationship(driver neo4j.DriverWithContext) error
|
||||
query = fmt.Sprintf(`MATCH (a)-[r:%s]-(b)`, r.Relationship)
|
||||
}
|
||||
|
||||
query = fmt.Sprintf(`%s WHERE a.id = '%s' AND b.id = '%s' DELETE r;`, query, r.FirstPersonID, r.SecondPersonID)
|
||||
query = fmt.Sprintf(`%s WHERE a.ID = '%s' AND b.ID = '%s' DELETE r;`, query, r.FirstPersonID, r.SecondPersonID)
|
||||
|
||||
_, err := session.Run(ctx, query, nil)
|
||||
|
||||
|
@@ -38,46 +38,46 @@ type Person struct {
|
||||
}
|
||||
|
||||
func (p *Person) ToString() string {
|
||||
result := fmt.Sprintf("id: '%s'", p.ID)
|
||||
result := fmt.Sprintf("ID: '%s'", p.ID)
|
||||
if p.Firstname != "" {
|
||||
result = fmt.Sprintf("%s, first_name: '%s'", result, p.Firstname)
|
||||
result = fmt.Sprintf("%s, Firstname: '%s'", result, p.Firstname)
|
||||
}
|
||||
if p.Lastname != "" {
|
||||
result = fmt.Sprintf("%s, last_name: '%s'", result, p.Lastname)
|
||||
result = fmt.Sprintf("%s, Lastname: '%s'", result, p.Lastname)
|
||||
}
|
||||
if p.Middlename != "" {
|
||||
result = fmt.Sprintf("%s, middle_name: '%s'", result, p.Middlename)
|
||||
result = fmt.Sprintf("%s, Middlename: '%s'", result, p.Middlename)
|
||||
}
|
||||
if p.MothersFirstname != "" {
|
||||
result = fmt.Sprintf("%s, mothers_first_name: '%s'", result, p.MothersFirstname)
|
||||
result = fmt.Sprintf("%s, MothersFirstname: '%s'", result, p.MothersFirstname)
|
||||
}
|
||||
if p.MothersLastname != "" {
|
||||
result = fmt.Sprintf("%s, mothers_last_name: '%s'", result, p.MothersLastname)
|
||||
result = fmt.Sprintf("%s, MothersLastname: '%s'", result, p.MothersLastname)
|
||||
}
|
||||
if !p.Born.IsZero() {
|
||||
result = fmt.Sprintf("%s, born: date({year:%d, month:%d, day:%d})", result, p.Born.Year(), p.Born.Month(), p.Born.Day())
|
||||
result = fmt.Sprintf("%s, Born: date({year:%d, month:%d, day:%d})", result, p.Born.Year(), p.Born.Month(), p.Born.Day())
|
||||
}
|
||||
if !p.Death.IsZero() {
|
||||
result = fmt.Sprintf("%s, death: date({year:%d, month:%d, day:%d})", result, p.Death.Year(), p.Death.Month(), p.Death.Day())
|
||||
result = fmt.Sprintf("%s, Death: date({year:%d, month:%d, day:%d})", result, p.Death.Year(), p.Death.Month(), p.Death.Day())
|
||||
}
|
||||
if p.Birthplace != "" {
|
||||
result = fmt.Sprintf("%s, birthplace: '%s'", result, p.Birthplace)
|
||||
result = fmt.Sprintf("%s, Birthplace: '%s'", result, p.Birthplace)
|
||||
}
|
||||
if p.Residence != "" {
|
||||
result = fmt.Sprintf("%s, residence: '%s'", result, p.Residence)
|
||||
result = fmt.Sprintf("%s, Residence: '%s'", result, p.Residence)
|
||||
}
|
||||
if p.Deathplace != "" {
|
||||
result = fmt.Sprintf("%s, deathplace: '%s'", result, p.Deathplace)
|
||||
result = fmt.Sprintf("%s, Deathplace: '%s'", result, p.Deathplace)
|
||||
}
|
||||
if p.OccupationToDisplay != "" {
|
||||
result = fmt.Sprintf("%s, occupation_to_display: '%s'", result, p.OccupationToDisplay)
|
||||
result = fmt.Sprintf("%s, OccupationToDisplay: '%s'", result, p.OccupationToDisplay)
|
||||
}
|
||||
if p.ProfilePicture != "" {
|
||||
result = fmt.Sprintf("%s, profile_picture: '%s'", result, p.ProfilePicture)
|
||||
result = fmt.Sprintf("%s, ProfilePicture: '%s'", result, p.ProfilePicture)
|
||||
}
|
||||
|
||||
if p.Titles != nil && len(p.Titles) > 0 {
|
||||
result = fmt.Sprintf("%s, titles: [", result)
|
||||
result = fmt.Sprintf("%s, Titles: [", result)
|
||||
for _, title := range p.Titles {
|
||||
result = fmt.Sprintf("%s'%s', ", result, title)
|
||||
}
|
||||
@@ -85,7 +85,7 @@ func (p *Person) ToString() string {
|
||||
}
|
||||
|
||||
if p.Suffixes != nil && len(p.Suffixes) > 0 {
|
||||
result = fmt.Sprintf("%s, suffixes: [", result)
|
||||
result = fmt.Sprintf("%s, Suffixes: [", result)
|
||||
for _, suffix := range p.Suffixes {
|
||||
result = fmt.Sprintf("%s'%s', ", result, suffix)
|
||||
}
|
||||
@@ -93,7 +93,7 @@ func (p *Person) ToString() string {
|
||||
}
|
||||
|
||||
if p.ExtraNames != nil && len(p.ExtraNames) > 0 {
|
||||
result = fmt.Sprintf("%s, extra_names: [", result)
|
||||
result = fmt.Sprintf("%s, ExtraNames: [", result)
|
||||
for _, extraName := range p.ExtraNames {
|
||||
result = fmt.Sprintf("%s'%s', ", result, extraName)
|
||||
}
|
||||
@@ -101,7 +101,7 @@ func (p *Person) ToString() string {
|
||||
}
|
||||
|
||||
if p.Aliases != nil && len(p.Aliases) > 0 {
|
||||
result = fmt.Sprintf("%s, aliases: [", result)
|
||||
result = fmt.Sprintf("%s, Aliases: [", result)
|
||||
for _, alias := range p.Aliases {
|
||||
result = fmt.Sprintf("%s'%s', ", result, alias)
|
||||
}
|
||||
@@ -109,7 +109,7 @@ func (p *Person) ToString() string {
|
||||
}
|
||||
|
||||
if p.LifeEvents != nil && len(p.LifeEvents) > 0 {
|
||||
result = fmt.Sprintf("%s, life_events: [", result)
|
||||
result = fmt.Sprintf("%s, LifeEvents: [", result)
|
||||
for i := 0; i < len(p.LifeEvents); i++ {
|
||||
date, dok := p.LifeEvents[i]["date"]
|
||||
event, eok := p.LifeEvents[i]["event"]
|
||||
@@ -121,7 +121,7 @@ func (p *Person) ToString() string {
|
||||
}
|
||||
|
||||
if p.Occupations != nil && len(p.Occupations) > 0 {
|
||||
result = fmt.Sprintf("%s, occupations: [", result)
|
||||
result = fmt.Sprintf("%s, Occupations: [", result)
|
||||
|
||||
for _, occupation := range p.Occupations {
|
||||
result = fmt.Sprintf("%s'%s', ", result, occupation)
|
||||
@@ -131,7 +131,7 @@ func (p *Person) ToString() string {
|
||||
}
|
||||
|
||||
if p.OthersSaid != nil {
|
||||
result = fmt.Sprintf("%s, others_said: {", result)
|
||||
result = fmt.Sprintf("%s, OthersSaid: {", result)
|
||||
for key, value := range p.OthersSaid {
|
||||
result = fmt.Sprintf("%s%s: '%s', ", result, key, value)
|
||||
}
|
||||
@@ -139,7 +139,7 @@ func (p *Person) ToString() string {
|
||||
}
|
||||
|
||||
if p.Photos != nil && len(p.Photos) > 0 {
|
||||
result = fmt.Sprintf("%s, photos: {", result)
|
||||
result = fmt.Sprintf("%s, Photos: {", result)
|
||||
for key, value := range p.Photos {
|
||||
result = fmt.Sprintf("%s%s: '%s', ", result, key, value)
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@ func (p *Person) UpdatePerson(driver neo4j.DriverWithContext) (*neo4j.Record, er
|
||||
return nil, err
|
||||
}
|
||||
|
||||
query := fmt.Sprintf("MATCH (n:Person {id: '%s'}) SET n += {%s} RETURN n;", p.ID, p.ToString())
|
||||
query := fmt.Sprintf("MATCH (n:Person {ID: '%s'}) SET n += {%s} RETURN n;", p.ID, p.ToString())
|
||||
|
||||
result, err := session.Run(ctx, query, nil)
|
||||
if err != nil {
|
||||
|
@@ -28,7 +28,7 @@ func (r *Relationship) VerifyRelationship(driver neo4j.DriverWithContext) (*neo4
|
||||
query = fmt.Sprintf(`MATCH (a)-[r:%s]-(b)`, r.Relationship)
|
||||
}
|
||||
|
||||
query = fmt.Sprintf(`%s WHERE a.id = %s AND b.id = %s set r.verified = true return r;`, query, r.FirstPersonID, r.SecondPersonID)
|
||||
query = fmt.Sprintf(`%s WHERE a.ID = %s AND b.ID = %s set r.verified = true return r;`, query, r.FirstPersonID, r.SecondPersonID)
|
||||
|
||||
result, err := session.Run(ctx, query, nil)
|
||||
if err != nil {
|
||||
|
@@ -40,12 +40,7 @@ spec:
|
||||
volumeMounts:
|
||||
- name: gh-auth-service-certs
|
||||
mountPath: /etc/gh-auth-service/ssl
|
||||
- name: zitadel-service-account
|
||||
mountPath: /etc/gh-auth-service/zitadel
|
||||
volumes:
|
||||
- name: gh-auth-service-certs
|
||||
secret:
|
||||
secretName: gh-auth-service-tls
|
||||
- name: zitadel-service-account
|
||||
secret:
|
||||
secretName: zitadel-service-account
|
||||
|
@@ -1,11 +0,0 @@
|
||||
apiVersion: traefik.io/v1alpha1
|
||||
kind: Middleware
|
||||
metadata:
|
||||
name: auth-service
|
||||
spec:
|
||||
forwardAuth:
|
||||
address: https://gh-auth-service/auth/
|
||||
authResponseHeaders:
|
||||
- id
|
||||
tls:
|
||||
insecureSkipVerify: true
|
@@ -4,8 +4,6 @@ namespace: generations-heritage
|
||||
|
||||
resources:
|
||||
- ./certificate.yaml
|
||||
- ./zitadel-acces-key.yaml
|
||||
- ./deployment.yaml
|
||||
- ./service.yaml
|
||||
- ./horizontalPodAutoScaler.yaml
|
||||
- ./forwardAuth.yaml
|
||||
|
@@ -1,6 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: zitadel-service-account
|
||||
data:
|
||||
api-key.json: eyJ0eXBlIjoiYXBwbGljYXRpb24iLCJrZXlJZCI6IjI2NzQxOTk4NzY3MTUxNTM4OCIsImtleSI6Ii0tLS0tQkVHSU4gUlNBIFBSSVZBVEUgS0VZLS0tLS1cbk1JSUVwQUlCQUFLQ0FRRUF1b3hpdytnWURkMXRwTjc1VUUyejVGN2tRRTVQdzVYYmNOTDFuK3RrUEd0MnRBeDBcbkFZalhUTWVZMGRTUzF3cHhEMGpWVnkwZzJ1Z2gyUzNZL1lrL0ZSWHZMMEhIRmd4N1V4RGFnV2VFNGwvazlIUTJcbjF5Tmx0UjY4NzdoaXN5L2ViOWhVMWxvRG10RDRjZEhSWStOYXBmeG41cFN0Ulh6b2tpYTdnVVl5V0pCdW5FU1pcbkZWM0tsY1g5Nkp3c0RoTXkvdWFFNmtYd1lhUmRWODZENVNueHRvZGFFUzU1cUxYMFhmYUE0VjBleGtQalNpLzNcbnRJNy9WMWY3NnFycTZyK25lN1luZFVGOXVxaHViY3gxZXJSTzZGZm4zWnVMOHhIdVVLVURLWWh6M0xUdjdCYStcbmtMcGd1VFdKdXJ0ZyswNmhFUkw5TFFpUVRwNGNsSEdIYzU3TndRSURBUUFCQW9JQkFBeUJKb210UUJlRjFUaXNcbi9aZEZiaDZMd2M4UnNNVVNnWUFoay9kaFJ2bkoxazRoVzVGU3crUFFxVXkvYkF4Z0ZjNEplc3Q2S2U2aWlzcE5cbkNYT05SSjQ4TnlrNnhvYVMxWjF1enNiSDBwOStBQkhtekZwRmRDYmM1WnRJQjgydEVzTDZoRTFPQVZuYVVoMEhcbkRIc2VuVS90Q0dYcloyWDJCbnp0ZmJvZm8zWk9NdHBIMW91SXRvOFRoRWZWYkVSSFdKN1IrUVFoZVJwbEV6dUpcbkpIdm12cHorMFFkOWVGbjRaUWViOU1DOFRSSW5sTzNyK1d0S1VrWWk1dzlwNTVBSXZiM2RROVpKR2NSSk9RbnlcbnMwTlpRV2tkblJSN05sV0pZUUtPdVIzYVQ1MlY3eER5NDJ5Q1hSTHhEOEU3SWt5aXMvbkswVjlucWNML29DYUhcbkovUURJY0VDZ1lFQTR4TWQ0TGJhNHZjREZMUjJmUHJLUnRkYms3YktGV01BQUx4K2srbXgwY2tyZitMdUY2QVdcbkJpbU9MeFk5TnZrenpQdkVmeG5IWW1DN1NpS2IxbGhUMDBQcGsyWld2SjBESWpaMUc1cXRCQkJpODQvUHVqZ0pcbmFEbFlseUM3T1gyTmlNL25STVN0SnYxamZuZk8rOWZqYnlZNXhSRXMya1U3b24yM091TzgxMGtDZ1lFQTBrKzFcbjZTNTZaQ3BFSkorUWZzaDdvSkFOZkpaMnRyS0diaXVGRlNpdFRLT081am5Dd0pacjVDNW44dUhaT3REUUNkMVFcbmgwWTlEOHUyTlE0NU50ZElzOWNmRGVEVFV6QUF0aVk1Uk9TMzc3MG1MMVNZNWVpQkQ5c081ekZ6enI2aVJBa2hcbjRFZGZlYVNlakFmMHdYVnBMWk9CekRyTXlIaWJzWjJPbjVmcmFya0NnWUVBcVN1ZjBiOUkyVmgvY2hoMFFlNHhcbmJvK1pDVFpmM1lrUkFudHJyZFNvQm92aUhYZTZPOTJuS3RZZ3VKSFA3em0vVHRLdTlLWUc5aExzMVhGdE9rWTVcbnhTWk9TT013Y1hwa1VFUFVBVW05NWs0eStoUEZCWTRqN0FMMUxqcFRZYVJaSW5rSmFpRkFndEM2SkFrc0tsSVBcbmZjb3p0YzV5NVBZNVZIaG1YcmcyQXdrQ2dZRUF1SWJUMTNxK1RIQ0JSWmp6VVNwYXZuQm1SUEJIek5rcTlqTWRcbkc0bUxOSGsxZ204Zm41YmJwMlBJTk9WUWtqaHdzSmNNZHdSN3d3WThJcVVPTWo0R1BqVDd2Rk9OVjZvQWxkRkhcbjRsakR3b2UxbjBXY3VleWNnT3IxVW9palViMFY1cGdVcnhJd2hTeVpKOGc3U2hyWVkvTE9xZ0RWZVBmSnM3ZklcblVlTWIzWkVDZ1lBcGpuZ2ZHckFQbmpzV3hxMXRxQ2RjVThUYmtsMHh2c3ZZVndWR0wrUlJXZlZKQkdFOXpwUVhcbmM2S01mdzR6VXMwUVc5NlJMYXZyQVR3b3JON1p0a05sZXZZNU9HYmpvTWRGN2praUhlTWFzeUh4c25iK0ZPUEtcbkgyZ0FVT0grbGV2WUpiQ3ZqbkM2R3RTR3d2ZVAvRWR2Mng0NTVRVFQ1WTZwck1ZOGdxVWw0QT09XG4tLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLVxuIiwiYXBwSWQiOiIyNjczNjUwMzYyMTU3NjMxOTUiLCJjbGllbnRJZCI6IjI2NzM2NTAzNjIxNTgyODczMUBnZW5lcmF0aW9uc2hlcml0YWdlIn0=
|
@@ -39,13 +39,7 @@ spec:
|
||||
volumeMounts:
|
||||
- name: gh-backend-certs
|
||||
mountPath: /etc/gh-backend/ssl
|
||||
- name: zitadel-service-account
|
||||
mountPath: /etc/gh-backend/zitadel
|
||||
volumes:
|
||||
- name: gh-backend-certs
|
||||
secret:
|
||||
secretName: gh-backend-tls
|
||||
- name: zitadel-service-account
|
||||
secret:
|
||||
secretName: zitadel-service-account
|
||||
|
@@ -14,17 +14,6 @@ spec:
|
||||
services:
|
||||
- name: gh-backend
|
||||
port: 443
|
||||
passHostHeader: true
|
||||
scheme: https
|
||||
serversTransport: gh-backend
|
||||
tls: {}
|
||||
---
|
||||
apiVersion: traefik.containo.us/v1alpha1
|
||||
kind: ServersTransport
|
||||
metadata:
|
||||
name: gh-backend
|
||||
annotations:
|
||||
argocd.argoproj.io/hook: PostSync
|
||||
spec:
|
||||
insecureSkipVerify: true
|
||||
rootCAsSecrets:
|
||||
- gh-backend-tls
|
||||
tls: {}
|
@@ -18,7 +18,7 @@ helmCharts:
|
||||
repo: https://charts.zitadel.com
|
||||
releaseName: zitadel
|
||||
namespace: generations-heritage
|
||||
version: 7.10.0
|
||||
version: 7.12.1
|
||||
valuesFile: ./values.yaml
|
||||
|
||||
patches:
|
||||
|
@@ -20,6 +20,12 @@ zitadel:
|
||||
dbSslAdminCrtSecret: cockroachdb-client-secret
|
||||
dbSslUserCrtSecret: db-cockroachdb-zitadel-secret
|
||||
|
||||
image:
|
||||
repository: ghcr.io/zitadel/zitadel
|
||||
pullPolicy: IfNotPresent
|
||||
# Overrides the image tag whose default is the chart appVersion.
|
||||
tag: "v2.51.0"
|
||||
|
||||
annotations:
|
||||
argocd.argoproj.io/sync-wave: "5"
|
||||
argocd.argoproj.io/hook: Sync
|
||||
|
2179
frontend/package-lock.json
generated
2179
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -16,23 +16,16 @@
|
||||
"@sveltejs/adapter-static": "^3.0.1",
|
||||
"@sveltejs/kit": "^2.0.0",
|
||||
"@sveltejs/vite-plugin-svelte": "^3.0.0",
|
||||
"autoprefixer": "^10.4.19",
|
||||
"daisyui": "^4.10.2",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-google": "^0.14.0",
|
||||
"eslint-plugin-svelte": "^2.35.1",
|
||||
"postcss": "^8.4.38",
|
||||
"prettier": "^3.2.5",
|
||||
"prettier-plugin-svelte": "^3.2.2",
|
||||
"svelte": "^4.2.12",
|
||||
"tailwindcss": "^3.4.3",
|
||||
"vite": "^5.0.3"
|
||||
},
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@dagrejs/dagre": "github:dagrejs/dagre",
|
||||
"@xyflow/svelte": "^0.0.41",
|
||||
"oidc-client-ts": "^3.0.1",
|
||||
"svelte-eslint-parser": "^0.33.1"
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +0,0 @@
|
||||
export default {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {}
|
||||
}
|
||||
};
|
@@ -1,79 +1,14 @@
|
||||
<!doctype html>
|
||||
<html lang="en" style="width: 100%; height: 100%">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link href="https://cdn.jsdelivr.net/npm/daisyui@4.10.2/dist/full.min.css" rel="stylesheet" type="text/css" />
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
%sveltekit.head%
|
||||
</head>
|
||||
|
||||
<body data-sveltekit-preload-data="hover" style="width: 100vw; height: 100vh">
|
||||
<div style="display: contents; width: 100vw; height: 100vh" class="bg-base-100">
|
||||
%sveltekit.body%
|
||||
</div>
|
||||
<div
|
||||
class="dropdown mb-72"
|
||||
style="position: absolute; left: auto; right: 3vw; top: 10px; bottom: auto"
|
||||
>
|
||||
<div tabindex="0" role="button" class="btn m-1">
|
||||
Theme
|
||||
<svg
|
||||
width="12px"
|
||||
height="12px"
|
||||
class="h-2 w-2 fill-current opacity-60 inline-block"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 2048 2048"
|
||||
>
|
||||
<path d="M1799 349l242 241-1017 1017L7 590l242-241 775 775 775-775z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
<ul tabindex="0" class="dropdown-content z-[1] p-2 shadow-2xl bg-base-300 rounded-box w-36">
|
||||
<li>
|
||||
<input
|
||||
type="radio"
|
||||
name="theme-dropdown"
|
||||
class="theme-controller btn btn-sm btn-block btn-ghost justify-start"
|
||||
aria-label="Light"
|
||||
value="light"
|
||||
/>
|
||||
</li>
|
||||
<li>
|
||||
<input
|
||||
type="radio"
|
||||
name="theme-dropdown"
|
||||
class="theme-controller btn btn-sm btn-block btn-ghost justify-start"
|
||||
aria-label="Dark"
|
||||
value="dark"
|
||||
/>
|
||||
</li>
|
||||
<li>
|
||||
<input
|
||||
type="radio"
|
||||
name="theme-dropdown"
|
||||
class="theme-controller btn btn-sm btn-block btn-ghost justify-start"
|
||||
aria-label="Cyberpunk"
|
||||
value="cyberpunk"
|
||||
/>
|
||||
</li>
|
||||
<li>
|
||||
<input
|
||||
type="radio"
|
||||
name="theme-dropdown"
|
||||
class="theme-controller btn btn-sm btn-block btn-ghost justify-start"
|
||||
aria-label="Synthwave"
|
||||
value="synthwave"
|
||||
/>
|
||||
</li>
|
||||
<li>
|
||||
<input
|
||||
type="radio"
|
||||
name="theme-dropdown"
|
||||
class="theme-controller btn btn-sm btn-block btn-ghost justify-start"
|
||||
aria-label="Retro"
|
||||
value="retro"
|
||||
/>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<body data-sveltekit-preload-data="hover">
|
||||
<div style="display: contents">%sveltekit.body%</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -1,66 +0,0 @@
|
||||
import { UserManager, WebStorageStateStore, type User } from 'oidc-client-ts';
|
||||
import { isAuthenticated, user } from './stores';
|
||||
import { PUBLIC_ZITADEL_CLIENT_ID, PUBLIC_ISSUER } from '$env/static/public';
|
||||
import { goto } from '$app/navigation';
|
||||
import { browser } from '$app/environment';
|
||||
|
||||
let userManager: UserManager;
|
||||
if (browser) {
|
||||
const host_url = window.location.href.startsWith('http://')
|
||||
? 'http://localhost:5173'
|
||||
: 'https://' + window.location.hostname;
|
||||
const config = {
|
||||
authority: PUBLIC_ISSUER, // At Zitadel Project Console > [Your project] > [Your application] > URLs - Issuer
|
||||
client_id: PUBLIC_ZITADEL_CLIENT_ID, // At Zitadel Project Console > [Your project] > [Your application] > Configuration - Client ID
|
||||
redirect_uri: host_url + '/callback', // At Zitadel Project Console > [Your project] > [Your application] > URLs - Login Redirect URI
|
||||
response_type: 'code',
|
||||
scope: 'openid profile email',
|
||||
post_logout_redirect_uri: host_url,
|
||||
userStore: new WebStorageStateStore({ store: window.localStorage }),
|
||||
automaticSilentRenew: true,
|
||||
silent_redirect_uri: host_url + '/silent-refresh'
|
||||
};
|
||||
|
||||
userManager = new UserManager(config);
|
||||
|
||||
userManager.events.addUserLoaded((loadedUser: User) => {
|
||||
console.log('userManager.events.addUserLoaded');
|
||||
user.set(loadedUser);
|
||||
isAuthenticated.set(true);
|
||||
});
|
||||
|
||||
userManager.events.addUserUnloaded(() => {
|
||||
console.log('userManager.events.addUserUnloaded');
|
||||
user.set(null);
|
||||
isAuthenticated.set(false);
|
||||
});
|
||||
}
|
||||
|
||||
async function login(): Promise<void> {
|
||||
console.log('UserManager.login()');
|
||||
if (browser) {
|
||||
await userManager.signinRedirect();
|
||||
}
|
||||
}
|
||||
|
||||
async function logout(): Promise<void> {
|
||||
if (browser) {
|
||||
await userManager.signoutRedirect();
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCallback(): Promise<void> {
|
||||
if (browser) {
|
||||
await userManager.signinRedirectCallback();
|
||||
goto('/');
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSilentCallback(): Promise<void> {
|
||||
if (browser) {
|
||||
await userManager.signinSilentCallback();
|
||||
goto('/');
|
||||
}
|
||||
}
|
||||
|
||||
export { login, logout, handleCallback, handleSilentCallback };
|
@@ -1,215 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { PUBLIC_API_URL } from '$env/static/public';
|
||||
import { setFamilyTreeNodes } from './setFamilyTreeNodes';
|
||||
import { user } from '../stores';
|
||||
import { onMount } from 'svelte';
|
||||
export let id = '';
|
||||
|
||||
let auth_token = '';
|
||||
|
||||
user.subscribe((value) => {
|
||||
if (value) {
|
||||
auth_token = value.access_token;
|
||||
}
|
||||
});
|
||||
|
||||
let relationship = '';
|
||||
let dialog: HTMLDialogElement;
|
||||
|
||||
let payload = {
|
||||
relationship: {
|
||||
first_person_id: id,
|
||||
relationship: relationship,
|
||||
direction: '->'
|
||||
},
|
||||
person: {
|
||||
first_name: '',
|
||||
middle_name: '',
|
||||
last_name: '',
|
||||
mothers_first_name: '',
|
||||
mothers_last_name: '',
|
||||
born: '',
|
||||
birthplace: '',
|
||||
titles: [],
|
||||
residence: '',
|
||||
death: '',
|
||||
deathplace: '',
|
||||
life_events: [],
|
||||
occupation: [],
|
||||
occupation_to_display: '',
|
||||
others_said: {},
|
||||
photos: {},
|
||||
profile_picture: 'https://cdn-icons-png.flaticon.com/512/3607/3607444.png'
|
||||
}
|
||||
};
|
||||
|
||||
function handleSubmit(event: Event) {
|
||||
event.preventDefault();
|
||||
|
||||
if (
|
||||
id &&
|
||||
relationship &&
|
||||
payload.person.first_name &&
|
||||
payload.person.last_name &&
|
||||
payload.person.born &&
|
||||
payload.person.mothers_first_name &&
|
||||
payload.person.mothers_last_name
|
||||
) {
|
||||
fetch(PUBLIC_API_URL + '/createRelationshipAndPerson', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: auth_token
|
||||
},
|
||||
body: JSON.stringify(payload)
|
||||
}).then((response) => {
|
||||
if (response.ok) {
|
||||
setFamilyTreeNodes();
|
||||
dialog.close();
|
||||
} else {
|
||||
alert('Failed to add family member! with status ' + response.status);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
alert('You have to fill out all the required fields!');
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
if (dialog) dialog.showModal();
|
||||
});
|
||||
</script>
|
||||
|
||||
<dialog bind:this={dialog} class="modal bg-base-300">
|
||||
<div class="modal-box w-11/12 max-w-5xl">
|
||||
<form method="dialog">
|
||||
<button class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</button>
|
||||
</form>
|
||||
<h1 class="font-bold text-lg">Create a family members profile</h1>
|
||||
<p>
|
||||
You can add a family member to your family tree by filling out the form below. You can update
|
||||
the information later.
|
||||
</p>
|
||||
<form on:submit={handleSubmit} method="dialog" class="flex flex-col gap-4">
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<label for="relationship" class="input input-bordered flex items-center gap-2">
|
||||
Relationship type:
|
||||
<select id="relationship" bind:value={relationship} required>
|
||||
<option value="" disabled selected>Choose one ...</option>
|
||||
<option value="Parent">Parent</option>
|
||||
<option value="Child">Child</option>
|
||||
<option value="Spouse">Spouse</option>
|
||||
<option value="Sibling">Sibling</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label for="firstName" class="input input-bordered flex items-center gap-2">
|
||||
First Name:
|
||||
<input
|
||||
type="text"
|
||||
id="firstName"
|
||||
class="grow input-md"
|
||||
bind:value={payload.person.first_name}
|
||||
required
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label for="middleName" class="input input-bordered flex items-center gap-2">
|
||||
Middle Name:
|
||||
<input
|
||||
type="text"
|
||||
id="middleName"
|
||||
class="grow input-md"
|
||||
bind:value={payload.person.middle_name}
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label for="lastName" class="input input-bordered flex items-center gap-2">
|
||||
Last Name:
|
||||
<input
|
||||
type="text"
|
||||
id="lastName"
|
||||
class="grow input-md"
|
||||
bind:value={payload.person.last_name}
|
||||
required
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label for="born" class="input input-bordered flex items-center gap-2">
|
||||
Born:
|
||||
<input
|
||||
type="date"
|
||||
id="born"
|
||||
class="grow input-md"
|
||||
bind:value={payload.person.born}
|
||||
required
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label for="birthplace" class="input input-bordered flex items-center gap-2">
|
||||
Birthplace:
|
||||
<input
|
||||
type="text"
|
||||
id="birthplace"
|
||||
class="grow input-md"
|
||||
bind:value={payload.person.birthplace}
|
||||
required
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label for="mothersFirstName" class="input input-bordered flex items-center gap-2">
|
||||
Mother's First Name:
|
||||
<input
|
||||
type="text"
|
||||
id="mothersFirstName"
|
||||
class="grow input-md"
|
||||
bind:value={payload.person.mothers_first_name}
|
||||
required
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label for="mothersLastName" class="input input-bordered flex items-center gap-2">
|
||||
Mother's Last Name:
|
||||
<input
|
||||
type="text"
|
||||
id="mothersLastName"
|
||||
class="grow input-md"
|
||||
bind:value={payload.person.mothers_last_name}
|
||||
required
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label for="death" class="input input-bordered flex items-center gap-2">
|
||||
Death:
|
||||
<input type="date" id="death" class="grow input-md" bind:value={payload.person.death} />
|
||||
</label>
|
||||
|
||||
<label for="deathplace" class="input input-bordered flex items-center gap-2">
|
||||
Place of death:
|
||||
<input
|
||||
type="text"
|
||||
id="deathplace"
|
||||
class="grow input-md"
|
||||
bind:value={payload.person.deathplace}
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label for="residence" class="input input-bordered flex items-center gap-2">
|
||||
Residence:
|
||||
<input
|
||||
type="text"
|
||||
id="residence"
|
||||
class="grow input-md"
|
||||
bind:value={payload.person.residence}
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label for="titles" class="input input-bordered flex items-center gap-2">
|
||||
Titles:
|
||||
<input type="text" id="titles" class="grow input-md" bind:value={payload.person.titles} />
|
||||
</label>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary w-40 place-self-end">Add</button>
|
||||
</form>
|
||||
</div>
|
||||
</dialog>
|
@@ -1,80 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { PUBLIC_API_URL } from '$env/static/public';
|
||||
import { setFamilyTreeNodes } from './setFamilyTreeNodes';
|
||||
import { user } from '$lib/stores';
|
||||
import { onMount } from 'svelte';
|
||||
export let id = '';
|
||||
let relationship = '';
|
||||
let second_person_id = '';
|
||||
let dialog: HTMLDialogElement; // HTMLDialogElement
|
||||
let auth_token = '';
|
||||
|
||||
user.subscribe((value) => {
|
||||
if (value) {
|
||||
auth_token = value.access_token;
|
||||
}
|
||||
});
|
||||
|
||||
function handleSubmit(event: SubmitEvent) {
|
||||
event.preventDefault();
|
||||
|
||||
if (second_person_id && id && relationship) {
|
||||
const payload = {
|
||||
first_person_id: id,
|
||||
second_person_id: second_person_id,
|
||||
relationship: relationship,
|
||||
direction: '->'
|
||||
};
|
||||
|
||||
fetch(PUBLIC_API_URL + '/relationship', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: auth_token
|
||||
},
|
||||
body: JSON.stringify(payload)
|
||||
}).then((response) => {
|
||||
if (response.ok) {
|
||||
setFamilyTreeNodes();
|
||||
dialog.close();
|
||||
} else {
|
||||
alert('Failed to add relationship! with status ' + response.status);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
alert('You have to fill out all the fields!');
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
if (dialog) dialog.showModal();
|
||||
});
|
||||
</script>
|
||||
|
||||
<dialog bind:this={dialog} class="modal bg-base-300">
|
||||
<div class="modal-box w-11/12 max-w-5xl">
|
||||
<form method="dialog">
|
||||
<button class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</button>
|
||||
</form>
|
||||
<h1 class="font-bold text-lg">Add a relationship</h1>
|
||||
<p>
|
||||
Ask your relative to give you their id and set what kind of relationship you have with them.
|
||||
</p>
|
||||
<form on:submit={handleSubmit} method="dialog">
|
||||
<label for="id" class="input input-bordered flex items-center gap-2">
|
||||
ID:
|
||||
<input type="text" id="id" class="grow" bind:value={id} required />
|
||||
</label>
|
||||
<label for="relationship">Relationship type:</label>
|
||||
<select id="relationship" bind:value={relationship} required>
|
||||
<option value="" disabled selected>Choose one ...</option>
|
||||
<option value="Parent">Parent</option>
|
||||
<option value="Child">Child</option>
|
||||
<option value="Spouse">Spouse</option>
|
||||
<option value="Sibling">Sibling</option>
|
||||
</select>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Add</button>
|
||||
</form>
|
||||
</div>
|
||||
</dialog>
|
@@ -1,152 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { PUBLIC_API_URL } from '$env/static/public';
|
||||
import { onMount } from 'svelte';
|
||||
import { user } from '../stores';
|
||||
|
||||
let auth_token = '';
|
||||
|
||||
user.subscribe((value) => {
|
||||
if (value) {
|
||||
auth_token = value.access_token;
|
||||
}
|
||||
});
|
||||
|
||||
let dialog: HTMLDialogElement;
|
||||
|
||||
let payload = {
|
||||
first_name: '',
|
||||
middle_name: '',
|
||||
last_name: '',
|
||||
mothers_first_name: '',
|
||||
mothers_last_name: '',
|
||||
born: '',
|
||||
birthplace: '',
|
||||
titles: [],
|
||||
residence: '',
|
||||
life_events: [],
|
||||
occupation: [],
|
||||
occupation_to_display: '',
|
||||
photos: {},
|
||||
profile_picture: 'https://cdn-icons-png.flaticon.com/512/3607/3607444.png'
|
||||
};
|
||||
|
||||
function handleSubmit(event: Event) {
|
||||
event.preventDefault();
|
||||
|
||||
if (
|
||||
payload.first_name &&
|
||||
payload.last_name &&
|
||||
payload.born &&
|
||||
payload.mothers_first_name &&
|
||||
payload.mothers_last_name
|
||||
) {
|
||||
payload.born = new Date(payload.born).toISOString();
|
||||
fetch(PUBLIC_API_URL + '/person', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: 'Bearer' + auth_token
|
||||
},
|
||||
body: JSON.stringify(payload)
|
||||
}).then((response) => {
|
||||
if (response.ok) {
|
||||
dialog.close();
|
||||
} else {
|
||||
alert('Failed to create profile! with status ' + response.status);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
alert('You have to fill out all the required fields!');
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
if (dialog) dialog.showModal();
|
||||
});
|
||||
</script>
|
||||
|
||||
<dialog bind:this={dialog} class="modal bg-base-300">
|
||||
<div class="modal-box w-11/12 max-w-5xl flex flex-col gap-4">
|
||||
<h1 class="font-bold text-lg">Create your profile</h1>
|
||||
<p>To start building your family tree fill this form. You can add more information later.</p>
|
||||
<form on:submit={handleSubmit} method="dialog">
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<label class="input input-bordered flex items-center gap-2" for="firstName">
|
||||
First Name:
|
||||
<input
|
||||
type="text"
|
||||
id="firstName"
|
||||
class="grow input-md"
|
||||
bind:value={payload.first_name}
|
||||
required
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label class="input input-bordered flex items-center gap-2" for="middleName">
|
||||
Middle Name:
|
||||
<input
|
||||
type="text"
|
||||
id="middleName"
|
||||
class="grow input-md"
|
||||
bind:value={payload.middle_name}
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label class="input input-bordered flex items-center gap-2" for="lastName">
|
||||
Last Name:
|
||||
<input
|
||||
type="text"
|
||||
id="lastName"
|
||||
class="grow input-md"
|
||||
bind:value={payload.last_name}
|
||||
required
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label class="input input-bordered flex items-center gap-2" for="born">
|
||||
Born:
|
||||
<input type="date" id="born" class="grow input-md" bind:value={payload.born} required />
|
||||
</label>
|
||||
<label class="input input-bordered flex items-center gap-2" for="birthplace">
|
||||
Birthplace:
|
||||
<input
|
||||
type="text"
|
||||
id="birthplace"
|
||||
class="grow input-md"
|
||||
bind:value={payload.birthplace}
|
||||
required
|
||||
/>
|
||||
</label>
|
||||
<label class="input input-bordered flex items-center gap-2" for="mothersFirstName">
|
||||
Mother's First Name:
|
||||
<input
|
||||
type="text"
|
||||
id="mothersFirstName"
|
||||
class="grow input-md"
|
||||
bind:value={payload.mothers_first_name}
|
||||
required
|
||||
/>
|
||||
</label>
|
||||
<label class="input input-bordered flex items-center gap-2" for="mothersLastName">
|
||||
Mother's Last Name:
|
||||
<input
|
||||
type="text"
|
||||
id="mothersLastName"
|
||||
class="grow input-md"
|
||||
bind:value={payload.mothers_last_name}
|
||||
required
|
||||
/>
|
||||
</label>
|
||||
<label class="input input-bordered flex items-center gap-2" for="residence">
|
||||
Residence:
|
||||
<input type="text" id="residence" class="grow input-md" bind:value={payload.residence} />
|
||||
</label>
|
||||
<label class="input input-bordered flex items-center gap-2" for="titles">
|
||||
Titles:
|
||||
<input type="text" id="titles" class="grow input-md" bind:value={payload.titles} />
|
||||
</label>
|
||||
<button type="submit" class="btn btn-primary w-40 place-self-end">Add</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</dialog>
|
@@ -1,61 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
export let onClick: () => void;
|
||||
export let deleteNode: () => void;
|
||||
export let addRelationship: () => void;
|
||||
export let addFamilymember: () => void;
|
||||
export let id: string;
|
||||
export let top: number | undefined;
|
||||
export let left: number | undefined;
|
||||
export let right: number | undefined;
|
||||
export let bottom: number | undefined;
|
||||
|
||||
let contextMenu: HTMLDivElement;
|
||||
onMount(() => {
|
||||
if (top) {
|
||||
contextMenu.style.top = `${top}px`;
|
||||
}
|
||||
if (left) {
|
||||
contextMenu.style.left = `${left}px`;
|
||||
}
|
||||
if (right) {
|
||||
contextMenu.style.right = `${right}px`;
|
||||
}
|
||||
if (bottom) {
|
||||
contextMenu.style.bottom = `${bottom}px`;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||
<div
|
||||
bind:this={contextMenu}
|
||||
class="context-menu bg-primary-100 rounded-lg shadow-lg"
|
||||
on:click={onClick}
|
||||
>
|
||||
<p style="margin: 0.5em;">
|
||||
<small>node: {id}</small>
|
||||
</p>
|
||||
<button on:click={addRelationship} class="btn">Add Relationship</button>
|
||||
<button on:click={addFamilymember} class="btn">Add familymember</button>
|
||||
<button on:click={deleteNode} class="btn">Delete</button>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.context-menu {
|
||||
border-style: solid;
|
||||
box-shadow: 10px 19px 20px rgba(0, 0, 0, 10%);
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.context-menu button {
|
||||
border: none;
|
||||
display: block;
|
||||
padding: 0.5em;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
@@ -1,70 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { Handle, Position, type NodeProps } from '@xyflow/svelte';
|
||||
|
||||
export let id: NodeProps['id'];
|
||||
id;
|
||||
export let dragHandle: NodeProps['dragHandle'] = undefined;
|
||||
dragHandle;
|
||||
export let type: NodeProps['type'] = undefined;
|
||||
type;
|
||||
export let selected: NodeProps['selected'] = undefined;
|
||||
selected;
|
||||
export let width: NodeProps['width'] = undefined;
|
||||
width;
|
||||
export let height: NodeProps['height'] = undefined;
|
||||
height;
|
||||
export let dragging: NodeProps['dragging'];
|
||||
dragging;
|
||||
export let targetPosition: NodeProps['targetPosition'] = undefined;
|
||||
targetPosition;
|
||||
export let sourcePosition: NodeProps['sourcePosition'] = undefined;
|
||||
sourcePosition;
|
||||
export let data = {
|
||||
id: '',
|
||||
last_name: 'Nem',
|
||||
first_name: 'Ismert',
|
||||
middle_name: '',
|
||||
profile_picture: 'https://cdn-icons-png.flaticon.com/512/3607/3607444.png'
|
||||
};
|
||||
</script>
|
||||
|
||||
<div class="rounded-badge card card-compact bg-base-300">
|
||||
<div class="card-body items-center text-center w-30">
|
||||
<div class="avatar">
|
||||
<figure class="w-24 mask mask-squircle">
|
||||
<img src={'https://cdn-icons-png.flaticon.com/512/3607/3607444.png'} alt="Picture of {data.last_name} {data.first_name}" />
|
||||
</figure>
|
||||
</div>
|
||||
<h2 class="card-title text-base-content">
|
||||
{data.first_name}
|
||||
{data.middle_name ? data.middle_name : ''}
|
||||
{data.last_name}
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
<Handle
|
||||
type="target"
|
||||
position={Position.Top}
|
||||
id="spouse"
|
||||
style="transform: translate(10px, 50%); left: 0;"
|
||||
/>
|
||||
<Handle
|
||||
type="source"
|
||||
position={Position.Top}
|
||||
id="spouse"
|
||||
style="transform: translate(0, 50%); left: auto; right: 10px"
|
||||
/>
|
||||
<Handle type="target" position={Position.Top} id="parent" style="transform: translate(0, 50%);" />
|
||||
<Handle
|
||||
type="source"
|
||||
position={Position.Bottom}
|
||||
id="child"
|
||||
style="transform: translate(0, -3px);"
|
||||
/>
|
||||
<Handle type="target" position={Position.Top} id="child" style="transform: translate(0, 50%);" />
|
||||
<Handle
|
||||
type="source"
|
||||
position={Position.Bottom}
|
||||
id="parent"
|
||||
style="transform: translate(0, -3px);"
|
||||
/>
|
@@ -1,53 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { fetch_profile } from './getProfile';
|
||||
export let data = {
|
||||
id: '',
|
||||
last_name: 'Nem',
|
||||
first_name: 'Ismert',
|
||||
middle_name: '',
|
||||
profile_picture: 'https://cdn-icons-png.flaticon.com/512/3607/3607444.png'
|
||||
};
|
||||
let dialog: HTMLDialogElement; // HTMLDialogElement
|
||||
|
||||
onMount(() => {
|
||||
if (dialog) dialog.showModal();
|
||||
fetch_profile(data.id).then((data) => {
|
||||
data = data
|
||||
});
|
||||
data.profile_picture = 'https://cdn-icons-png.flaticon.com/512/3607/3607444.png';
|
||||
});
|
||||
</script>
|
||||
|
||||
<dialog bind:this={dialog} class="modal bg-base-300">
|
||||
<div class="modal-box w-11/12 max-w-5xl">
|
||||
<form method="dialog">
|
||||
<button class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</button>
|
||||
</form>
|
||||
|
||||
<div class="hero min-h-screen bg-base-200">
|
||||
<div class="hero-content flex-col lg:flex-row">
|
||||
<div class="avatar max-w-sm rounded-lg shadow-2xl">
|
||||
<figure class="w-24 mask mask-squircle">
|
||||
<img src={data.profile_picture} alt="Picture of {data.last_name} {data.first_name}" />
|
||||
</figure>
|
||||
</div>
|
||||
<div>
|
||||
<h1 class="text-5xl font-bold">
|
||||
{data.first_name}
|
||||
{data.middle_name ? data.middle_name : ''}
|
||||
{data.last_name}
|
||||
</h1>
|
||||
<p class="py-6">
|
||||
Provident cupiditate voluptatem et in. Quaerat fugiat ut assumenda excepturi
|
||||
exercitationem quasi. In deleniti eaque aut repudiandae et a id nisi.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<form method="dialog" class="modal-backdrop">
|
||||
<button>close</button>
|
||||
</form>
|
||||
</div>
|
||||
</dialog>
|
@@ -1,39 +0,0 @@
|
||||
import dagre from '@dagrejs/dagre';
|
||||
import { Position, type Node, type Edge } from '@xyflow/svelte';
|
||||
|
||||
const dagreGraph = new dagre.graphlib.Graph();
|
||||
|
||||
const nodeWidth = 250;
|
||||
const nodeHeight = 250;
|
||||
|
||||
function getLayoutedElements(nodes: Node[], edges: Edge[], direction = 'TB') {
|
||||
dagreGraph.setDefaultEdgeLabel(() => ({}));
|
||||
const isHorizontal = direction === 'LR';
|
||||
dagreGraph.setGraph({ rankdir: direction });
|
||||
nodes.forEach((node) => {
|
||||
dagreGraph.setNode(node.id, { width: nodeWidth, height: nodeHeight });
|
||||
});
|
||||
|
||||
edges.forEach((edge) => {
|
||||
dagreGraph.setEdge(edge.source, edge.target);
|
||||
});
|
||||
|
||||
dagre.layout(dagreGraph);
|
||||
|
||||
nodes.forEach((node) => {
|
||||
const nodeWithPosition = dagreGraph.node(node.id);
|
||||
node.targetPosition = isHorizontal ? Position.Left : Position.Top;
|
||||
node.sourcePosition = isHorizontal ? Position.Right : Position.Bottom;
|
||||
|
||||
// We are shifting the dagre node position (anchor=center center) to the top left
|
||||
// so it matches the React Flow node anchor point (top left).
|
||||
node.position = {
|
||||
x: nodeWithPosition.x - nodeWidth / 2,
|
||||
y: nodeWithPosition.y - nodeHeight / 2
|
||||
};
|
||||
});
|
||||
|
||||
return { nodes, edges };
|
||||
}
|
||||
|
||||
export { getLayoutedElements };
|
@@ -1,77 +0,0 @@
|
||||
import { type Node, type Edge } from '@xyflow/svelte';
|
||||
|
||||
function AddToNodesData(data: any, i: number, pushToNodesCallback: (arg: Node) => void) {
|
||||
if (data[0].Values[i] != null) {
|
||||
if (Object.prototype.toString.call(data[0].Values[i]) === '[object Array]') {
|
||||
data[0].Values[i].forEach((person: { ElementId: string; Props: {} }) => {
|
||||
pushToNodesCallback({
|
||||
id: person.ElementId,
|
||||
type: 'custom',
|
||||
data: person.Props,
|
||||
position: { x: 0, y: 0 }
|
||||
});
|
||||
});
|
||||
} else {
|
||||
console.log(data[0].Values[i]);
|
||||
pushToNodesCallback({
|
||||
id: data[0].Values[i].ElementId,
|
||||
type: 'custom',
|
||||
data: data[0].Values[i].Props,
|
||||
position: { x: 0, y: 0 }
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function AddToEdgesData(data: any, i: number, pushToEdgesCallback: (arg: Edge) => void) {
|
||||
if (data[0].Values[i] != null) {
|
||||
if (Object.prototype.toString.call(data[0].Values[i]) === '[object Array]') {
|
||||
data[0].Values[i].forEach(
|
||||
(edge: {
|
||||
ElementId: string;
|
||||
StartElementId: string;
|
||||
EndElementId: string;
|
||||
Type: string;
|
||||
Props: {};
|
||||
}) => {
|
||||
pushToEdgesCallback({
|
||||
id: edge.ElementId,
|
||||
source: edge.StartElementId,
|
||||
sourceHandle:
|
||||
edge.Type === 'Parent' ? 'parent' : edge.Type === 'Child' ? 'child' : 'spouse',
|
||||
target: edge.EndElementId,
|
||||
targetHandle:
|
||||
edge.Type === 'Parent' ? 'child' : edge.Type === 'Child' ? 'parent' : 'spouse',
|
||||
label: edge.Type,
|
||||
data: edge.Props,
|
||||
zIndex: edge.Type === 'Spouse' ? 1 : 0
|
||||
});
|
||||
}
|
||||
);
|
||||
} else {
|
||||
console.log(data[0].Values[i]);
|
||||
pushToEdgesCallback({
|
||||
id: data[0].Values[i].ElementId,
|
||||
source: data[0].Values[i].StartElementId,
|
||||
sourceHandle:
|
||||
data[0].Values[i].Type === 'Parent'
|
||||
? 'parent'
|
||||
: data[0].Values[i].Type === 'Child'
|
||||
? 'child'
|
||||
: 'spouse',
|
||||
target: data[0].Values[i].EndElementId,
|
||||
targetHandle:
|
||||
data[0].Values[i].Type === 'Parent'
|
||||
? 'child'
|
||||
: data[0].Values[i].Type === 'Child'
|
||||
? 'parent'
|
||||
: 'spouse',
|
||||
label: data[0].Values[i].Type,
|
||||
data: data[0].Values[i].Props,
|
||||
zIndex: data[0].Values[i].Type === 'Spouse' ? 1 : 0
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { AddToNodesData, AddToEdgesData };
|
@@ -1,24 +0,0 @@
|
||||
import { PUBLIC_API_URL } from '$env/static/public';
|
||||
import { user } from '$lib/stores';
|
||||
|
||||
let auth_token: string;
|
||||
|
||||
user.subscribe((value) => {
|
||||
if (value) {
|
||||
auth_token = value.access_token;
|
||||
}
|
||||
});
|
||||
|
||||
async function fetch_family_tree() {
|
||||
const response = await fetch(PUBLIC_API_URL + '/familyTree', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
Authorization: 'Bearer ' + auth_token
|
||||
}
|
||||
});
|
||||
const data = await response.json();
|
||||
return data;
|
||||
}
|
||||
|
||||
export { fetch_family_tree };
|
@@ -1,24 +0,0 @@
|
||||
import { PUBLIC_API_URL } from '$env/static/public';
|
||||
import { user } from '$lib/stores';
|
||||
|
||||
let auth_token: string;
|
||||
|
||||
user.subscribe((value) => {
|
||||
if (value) {
|
||||
auth_token = value.access_token;
|
||||
}
|
||||
});
|
||||
|
||||
async function fetch_profile(id: string = '') {
|
||||
const response = await fetch(PUBLIC_API_URL + '/person' + (id != '' ? '?id=' + id : ''), {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
Authorization: 'Bearer ' + auth_token
|
||||
}
|
||||
});
|
||||
const data = await response.json();
|
||||
return data;
|
||||
}
|
||||
|
||||
export { fetch_profile };
|
@@ -1,61 +0,0 @@
|
||||
import { fetch_family_tree } from '$lib/family_tree/getFamilyTree';
|
||||
import { getLayoutedElements } from '$lib/family_tree/dagreLayout';
|
||||
import { AddToNodesData, AddToEdgesData } from '$lib/family_tree/dataAdapter';
|
||||
import type { Node, Edge } from '@xyflow/svelte';
|
||||
import { useEdges, useNodes } from '@xyflow/svelte';
|
||||
import { fetch_profile } from './getProfile';
|
||||
|
||||
export async function setFamilyTreeNodes(): Promise<{
|
||||
nodes: Node[];
|
||||
edges: Edge[];
|
||||
}> {
|
||||
console.log('fetching nodes');
|
||||
let layoutedElements: {
|
||||
nodes: Node[];
|
||||
edges: Edge[];
|
||||
} = { nodes: [], edges: [] };
|
||||
let nodes_data: Node[] = [];
|
||||
let edges_data: Edge[] = [];
|
||||
await fetch_profile().then((data) => {
|
||||
nodes_data.push({
|
||||
id: data.ElementId,
|
||||
type: 'custom',
|
||||
data: data.Props,
|
||||
position: { x: 0, y: 0 }
|
||||
});
|
||||
});
|
||||
|
||||
await fetch_family_tree().then((data: []) => {
|
||||
if (data.length == 0) {
|
||||
return layoutedElements;
|
||||
}
|
||||
|
||||
function pushNodeToData(node: Node) {
|
||||
nodes_data.push(node);
|
||||
}
|
||||
|
||||
AddToNodesData(data, 0, pushNodeToData);
|
||||
AddToNodesData(data, 2, pushNodeToData);
|
||||
AddToNodesData(data, 4, pushNodeToData);
|
||||
AddToNodesData(data, 6, pushNodeToData);
|
||||
AddToNodesData(data, 8, pushNodeToData);
|
||||
|
||||
function pushEdgeToData(edge: Edge) {
|
||||
edges_data.push(edge);
|
||||
}
|
||||
|
||||
AddToEdgesData(data, 1, pushEdgeToData);
|
||||
AddToEdgesData(data, 3, pushEdgeToData);
|
||||
AddToEdgesData(data, 5, pushEdgeToData);
|
||||
AddToEdgesData(data, 7, pushEdgeToData);
|
||||
});
|
||||
|
||||
console.log('Fetched nodes and edges data.');
|
||||
|
||||
// Remove duplicate nodes
|
||||
nodes_data = nodes_data.filter(
|
||||
(node, index, self) => index === self.findIndex((n) => n.id === node.id)
|
||||
);
|
||||
|
||||
return getLayoutedElements(nodes_data, edges_data, 'TB');
|
||||
}
|
@@ -1,5 +0,0 @@
|
||||
import { writable } from 'svelte/store';
|
||||
import type { User } from 'oidc-client-ts';
|
||||
|
||||
export const isAuthenticated = writable<boolean>(false);
|
||||
export const user = writable<User | null>(null);
|
@@ -1,3 +1 @@
|
||||
export const prerender = true;
|
||||
import 'tailwindcss/tailwind.css';
|
||||
import '@xyflow/svelte/dist/style.css';
|
||||
|
@@ -1,139 +1,4 @@
|
||||
<script lang="ts">
|
||||
import { writable } from 'svelte/store';
|
||||
import { onMount } from 'svelte';
|
||||
import { SvelteFlowProvider, SvelteFlow, Controls, MiniMap } from '@xyflow/svelte';
|
||||
import type { Node, Edge, NodeTypes } from '@xyflow/svelte';
|
||||
import { isAuthenticated } from '../lib/stores';
|
||||
import PersonNode from './../lib/family_tree/PersonNode.svelte';
|
||||
import { setFamilyTreeNodes } from '../lib/family_tree/setFamilyTreeNodes';
|
||||
import { login } from '../lib/auth';
|
||||
|
||||
import PersonMenu from '$lib/family_tree/PersonMenu.svelte';
|
||||
import PersonPanel from '$lib/family_tree/PersonPanel.svelte';
|
||||
import AddRelationship from '$lib/family_tree/AddRelationship.svelte';
|
||||
import AddFamilyMember from '$lib/family_tree/AddFamilyMember.svelte';
|
||||
import CreateProfile from '$lib/family_tree/CreateProfile.svelte';
|
||||
|
||||
let relationshipPanel = '';
|
||||
let AddFamilyMemberPanel = '';
|
||||
let CreateProfilePanel = false;
|
||||
|
||||
const nodes = writable<Node[]>([]);
|
||||
const edges = writable<Edge[]>([]);
|
||||
|
||||
onMount(() => {
|
||||
if (!$isAuthenticated) {
|
||||
console.log('user is not authenticated');
|
||||
login();
|
||||
} else {
|
||||
console.log('user is authenticated');
|
||||
setFamilyTreeNodes().then((layout) => {
|
||||
if (layout.nodes.length < 1) {
|
||||
CreateProfilePanel = true;
|
||||
} else {
|
||||
nodes.set(layout.nodes);
|
||||
edges.set(layout.edges);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const nodeTypes: NodeTypes = {
|
||||
custom: PersonNode
|
||||
};
|
||||
|
||||
let personPanel:
|
||||
| {
|
||||
id: string;
|
||||
last_name: string;
|
||||
first_name: string;
|
||||
middle_name: string;
|
||||
profile_picture: string;
|
||||
}
|
||||
| undefined;
|
||||
|
||||
let menu: { id: string; top?: number; left?: number; right?: number; bottom?: number } | null;
|
||||
let width: number;
|
||||
let height: number;
|
||||
|
||||
function handleContextMenu({
|
||||
detail: { event, node }
|
||||
}: {
|
||||
detail: { event: MouseEvent; node: Node };
|
||||
}) {
|
||||
event.preventDefault();
|
||||
|
||||
menu = {
|
||||
id: node.data.id,
|
||||
top: event.clientY < height - 200 ? event.clientY : undefined,
|
||||
left: event.clientX < width - 200 ? event.clientX : undefined,
|
||||
right: event.clientX >= width - 200 ? width - event.clientX : undefined,
|
||||
bottom: event.clientY >= height - 200 ? height - event.clientY : undefined
|
||||
};
|
||||
}
|
||||
|
||||
// Close the context menu if it's open whenever the window is clicked.
|
||||
function handlePaneClick() {
|
||||
menu = null;
|
||||
relationshipPanel = '';
|
||||
}
|
||||
|
||||
function handleNodeClick({
|
||||
detail: { event, node }
|
||||
}: {
|
||||
detail: { event: MouseEvent; node: Node };
|
||||
}) {
|
||||
event.preventDefault();
|
||||
personPanel = node.data;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div style="height:100vh;">
|
||||
<SvelteFlowProvider>
|
||||
<SvelteFlow
|
||||
{nodes}
|
||||
{nodeTypes}
|
||||
{edges}
|
||||
on:nodecontextmenu={handleContextMenu}
|
||||
on:nodeclick={handleNodeClick}
|
||||
on:paneclick={handlePaneClick}
|
||||
class="bg-base-100"
|
||||
fitView
|
||||
onlyRenderVisibleElements
|
||||
>
|
||||
<Controls class="bg-base-300 text-base-content" />
|
||||
<MiniMap class="bg-base-200" />
|
||||
{#if menu != null}
|
||||
<PersonMenu
|
||||
onClick={handlePaneClick}
|
||||
deleteNode={() => {
|
||||
console.log('delete node');
|
||||
}}
|
||||
addRelationship={() => {
|
||||
if (menu) relationshipPanel = menu.id;
|
||||
}}
|
||||
addFamilymember={() => {
|
||||
if (menu) AddFamilyMemberPanel = menu.id;
|
||||
}}
|
||||
id={menu.id}
|
||||
top={menu.top}
|
||||
left={menu.left}
|
||||
right={menu.right}
|
||||
bottom={menu.bottom}
|
||||
/>
|
||||
{/if}
|
||||
{#if personPanel != null}
|
||||
<PersonPanel data={personPanel} />
|
||||
{/if}
|
||||
{#if relationshipPanel != ''}
|
||||
<AddRelationship id={relationshipPanel} />
|
||||
{/if}
|
||||
{#if AddFamilyMemberPanel != ''}
|
||||
<AddFamilyMember id={AddFamilyMemberPanel} />
|
||||
{/if}
|
||||
{#if CreateProfilePanel}
|
||||
<CreateProfile />
|
||||
{/if}
|
||||
</SvelteFlow>
|
||||
</SvelteFlowProvider>
|
||||
</div>
|
||||
<h1>Welcome to SvelteKit</h1>
|
||||
<p>
|
||||
Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation
|
||||
</p>
|
||||
|
@@ -1,11 +0,0 @@
|
||||
<!-- src/routes/callback.svelte -->
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { handleCallback } from '../../lib/auth';
|
||||
|
||||
onMount(() => {
|
||||
handleCallback();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div>Logging in...</div>
|
@@ -1,10 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { handleSilentCallback } from '../../lib/auth';
|
||||
|
||||
onMount(() => {
|
||||
handleSilentCallback();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div>Refreshing...</div>
|
@@ -1,9 +1,7 @@
|
||||
import adapter from '@sveltejs/adapter-static';
|
||||
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
||||
|
||||
/** @type {import('@sveltejs/kit').Config} */
|
||||
const config = {
|
||||
preprocess: vitePreprocess(),
|
||||
kit: {
|
||||
adapter: adapter({
|
||||
pages: 'build',
|
||||
|
@@ -1,12 +0,0 @@
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
export default {
|
||||
content: ['./src/**/*.{html,svelte,js,ts}'],
|
||||
important: true,
|
||||
theme: {
|
||||
extend: {}
|
||||
},
|
||||
daisyui: {
|
||||
themes: ['light', 'dark', 'cyberpunk', 'synthwave', 'retro', 'roboto', 'dracula']
|
||||
},
|
||||
plugins: [require('daisyui')]
|
||||
};
|
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"extends": "./.svelte-kit/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"skipLibCheck": true,
|
||||
"sourceMap": true,
|
||||
"strict": true
|
||||
},
|
||||
"include": ["src/**/*", "src/node_modules", ".svelte-kit/ambient.d.ts"] // see last element
|
||||
}
|
Reference in New Issue
Block a user