Compare commits

37 Commits

Author SHA1 Message Date
kandrusyak
492505cda5 fix typo 2023-10-13 02:59:45 +03:00
kandrusyak
75c32da189 replace msg to tag 2023-10-13 00:49:35 +03:00
kandrusyak
f8df2b95b0 update json field names 2023-10-13 00:42:20 +03:00
kandrusyak
dc7e3d195e change error format 2023-10-13 00:36:45 +03:00
kandrusyak
703e4f2ac1 logs fix 2023-09-25 22:57:27 +03:00
kandrusyak
48d7206356 logs fix 2023-09-25 22:53:26 +03:00
kandrusyak
20f69b4378 logs fix 2023-09-25 22:28:37 +03:00
kandrusyak
3edd2f8d93 logs fix 2023-09-25 22:20:19 +03:00
kandrusyak
7d3c4a26fe logs fix 2023-09-25 22:17:14 +03:00
kandrusyak
02ae90eb52 logs fix 2023-09-25 22:12:59 +03:00
kandrusyak
569d5ff7ed logs fix 2023-09-25 22:08:18 +03:00
kandrusyak
f3d2ab9919 errors fix 2023-09-25 22:00:34 +03:00
kandrusyak
075fbf89b0 add logs 2023-09-25 21:57:43 +03:00
Kirill Andrusyak
1fb8c903dc update pipeline 2023-09-04 23:24:00 +00:00
Kirill Andrusyak
9f72a3f8a2 update pipeline 2023-09-04 23:13:00 +00:00
kandrusyak
7dba549faa fix namespace 2023-08-24 23:40:47 +03:00
kandrusyak
81106a2599 add today endpoint 2023-08-16 21:22:55 +03:00
kandrusyak
11c0d1b989 add today endpoint 2023-08-16 21:21:05 +03:00
andrusyakka
2054c44aa2 fix events filter 2023-08-16 14:11:28 +03:00
kandrusyak
5be30ff30f fix mistake 2023-08-08 22:59:28 +03:00
kandrusyak
c5df48f0fb 1 replicas 2023-08-08 22:29:41 +03:00
kandrusyak
07efee246e update headers 2023-08-07 23:21:05 +03:00
kandrusyak
ccba5f3844 update person models 2023-08-03 02:23:53 +03:00
kandrusyak
aeccf956f7 add request to personal information 2023-08-03 02:14:44 +03:00
kandrusyak
d4ccd4d11b add request to personal information 2023-08-03 02:13:48 +03:00
kandrusyak
0364ad2d7d add request to personal information 2023-08-03 00:53:18 +03:00
kandrusyak
15f51516af change json field 2023-08-03 00:19:08 +03:00
kandrusyak
95a66c2c16 change json field 2023-08-03 00:11:58 +03:00
kandrusyak
fe09a32bbc add swagger 2023-08-02 22:49:48 +03:00
kandrusyak
a1705758df add validation 2023-08-02 15:57:56 +03:00
kandrusyak
481bd0b788 fix validator 2023-08-02 03:07:58 +03:00
kandrusyak
3a514800e6 add validator 2023-08-02 01:51:27 +03:00
andrusyakka
c55df47ada update events 2023-08-01 16:48:54 +03:00
kandrusyak
46afe2e794 fix mistake 2023-07-18 02:21:41 +03:00
kandrusyak
03cb8c3e38 replace id type 2023-07-18 01:16:04 +03:00
kandrusyak
b74291f449 replace id type 2023-07-18 01:01:38 +03:00
andrusyakka
1aa6b6c87e update events 2023-07-17 14:12:32 +03:00
21 changed files with 846 additions and 155 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
.idea
build
.env
test

View File

@@ -1,4 +1,4 @@
FROM kandrusyak/go-build as build
FROM docker.io/kandrusyak/go-build as build
LABEL authors="andrusyakka@dopcore.com"
WORKDIR /app
@@ -13,7 +13,7 @@ COPY . ./
RUN go build -o ./app
FROM alpine:edge
FROM docker.io/alpine:edge
WORKDIR /

View File

@@ -11,6 +11,7 @@ type ServerConfig struct {
type MSHosts struct {
UsersHost string
PersonsHost string
}
type Config struct {
@@ -25,7 +26,8 @@ func New() *Config {
ConnectionString: getEnv("CONNECTION_STRING", "host=localhost user=astra_events password=password dbname=astra_events_db port=5432 sslmode=disable TimeZone=Europe/Moscow"),
},
MSHosts: MSHosts{
UsersHost: getEnv("ASTRA-USERS", "http://localhost:8081"),
UsersHost: getEnv("ASTRA-USERS", "http://localhost:8083"),
PersonsHost: getEnv("ASTRA-PERSONAL-INFORMATION", "http://localhost:8082"),
},
}
}

View File

@@ -1,2 +1,2 @@
SERVICE_REPLICAS=3
SERVICE_REPLICAS=1
SERVICE_PORT=8080

View File

@@ -2,7 +2,6 @@ apiVersion: v1
kind: Service
metadata:
name: {{ .Values.app.fullName }}
namespace: default
spec:
ports:
- port: {{ .Values.app.server.port }}

View File

@@ -1,7 +1,7 @@
version: "3.9"
services:
postgres:
image: postgres:13.3
astra_events:
image: postgres:14.8
environment:
POSTGRES_DB: "astra_events_db"
POSTGRES_USER: "astra_events"

20
go.mod
View File

@@ -3,19 +3,28 @@ module astra-events
go 1.21rc1
require (
github.com/go-playground/validator/v10 v10.14.1
github.com/google/uuid v1.3.0
github.com/hashicorp/go-set v0.1.13
github.com/labstack/echo/v4 v4.10.2
gorm.io/driver/postgres v1.5.2
gorm.io/gorm v1.25.2
)
require (
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/hashicorp/go-set v0.1.13 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/pgx/v5 v5.3.1 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/labstack/echo/v4 v4.10.2 // indirect
github.com/labstack/gommon v0.4.0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-sqlite3 v1.14.17 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
golang.org/x/crypto v0.8.0 // indirect
@@ -23,7 +32,4 @@ require (
golang.org/x/sys v0.7.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/time v0.3.0 // indirect
gorm.io/driver/postgres v1.5.2 // indirect
gorm.io/driver/sqlite v1.5.2 // indirect
gorm.io/gorm v1.25.2 // indirect
)

43
go.sum
View File

@@ -1,7 +1,22 @@
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.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=
github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
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.14.1 h1:9c50NUPC30zyuKprjL3vNZ0m5oG+jU0zvx4AqHGnv4k=
github.com/go-playground/validator/v10 v10.14.1/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
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/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hashicorp/go-set v0.1.13 h1:k1B5goY3c7OKEzpK+gwAhJexxzAJwDN8kId8YvWrihA=
github.com/hashicorp/go-set v0.1.13/go.mod h1:0/D+R4MFUzJ6XmvjU7liXtznF1eQDxh84GJlhXw+lvo=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
@@ -18,8 +33,8 @@ github.com/labstack/echo/v4 v4.10.2 h1:n1jAhnq/elIFTHr1EYpiYtyKgx4RW9ccVgkqByZaN
github.com/labstack/echo/v4 v4.10.2/go.mod h1:OEyqf2//K1DFdE57vw2DRgWY0M7s65IVQO2FzvI4J5k=
github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8=
github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM=
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
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-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
@@ -27,35 +42,34 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM=
github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
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/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU=
github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k=
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/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
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.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc=
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ=
golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE=
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM=
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
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/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
@@ -63,10 +77,9 @@ golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/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=
gorm.io/driver/postgres v1.5.2 h1:ytTDxxEv+MplXOfFe3Lzm7SjG09fcdb3Z/c056DTBx0=
gorm.io/driver/postgres v1.5.2/go.mod h1:fmpX0m2I1PKuR7mKZiEluwrP3hbs+ps7JIGMUBpCgl8=
gorm.io/driver/sqlite v1.5.2 h1:TpQ+/dqCY4uCigCFyrfnrJnrW9zjpelWVoEVNy5qJkc=
gorm.io/driver/sqlite v1.5.2/go.mod h1:qxAuCol+2r6PannQDpOP1FP6ag3mKi4esLnB/jHed+4=
gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
gorm.io/gorm v1.25.2 h1:gs1o6Vsa+oVKG/a9ElL3XgyGfghFfkKA2SInQaCyMho=
gorm.io/gorm v1.25.2/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=

View File

@@ -4,138 +4,278 @@ import (
"astra-events/model"
"astra-events/pkg/utils"
"astra-events/services"
"errors"
"github.com/go-playground/validator/v10"
"github.com/google/uuid"
"github.com/hashicorp/go-set"
"github.com/labstack/echo/v4"
"gorm.io/gorm"
"net/http"
"strconv"
"time"
)
// swagger:route POST /events/ Events CreateEvent
//
// responses:
// 200: Event
func (h *Handler) CreateEvent(c echo.Context) (err error) {
newEvent := new(model.Event)
var person *model.PersonalInformationApi
event := new(model.CreateEvent)
authorId, err := strconv.Atoi(c.Request().Header.Get("UserId"))
orgId, err := strconv.Atoi(c.Request().Header.Get("UserOrganizationId"))
authorId, err := uuid.Parse(c.Request().Header.Get("X-User-Id"))
orgId, err := uuid.Parse(c.Request().Header.Get("X-User-Organization-Id"))
if err != nil {
return c.JSON(http.StatusUnauthorized, &utils.Error{
Type: "internal_error",
Message: "User in not authorized",
Code: "0002",
})
}
err = c.Bind(&event)
err = h.Validator.Struct(event)
if err != nil {
return c.NoContent(http.StatusUnauthorized)
var validationErrors validator.ValidationErrors
errors.As(err, &validationErrors)
Fields := make(map[string]string)
for _, validationError := range validationErrors {
Fields[validationError.Field()] = validationError.Tag()
}
return c.JSON(http.StatusBadRequest, &utils.ValidationError{
Type: "validation_error",
Message: err.Error(),
Code: "0001",
Fields: Fields,
})
}
if err = c.Bind(event); err != nil {
return c.NoContent(http.StatusBadRequest)
if event.Person.ID.ID() != 0 {
person, err = services.GetPerson(event.Person.ID, c.Request().Header, c)
if err != nil || person.ID != event.Person.ID {
return c.JSON(http.StatusBadGateway, &utils.Error{
Type: "internal_error",
Message: "Can't send request to persons service",
Code: "0003",
})
}
} else {
newPerson := model.PersonalInformationApi{
FirstName: event.Person.FirstName,
LastName: event.Person.LastName,
Patronymic: event.Person.Patronymic,
Contacts: []model.Contact{
{
Category: "PHONE",
Value: event.Person.Phone,
},
},
}
usersMap, err := services.GetUsers([]uint{event.EmployeeId, uint(authorId)}, c.Request().Header)
if err != nil {
return c.HTML(http.StatusBadGateway, err.Error())
person, err = services.CreatePerson(newPerson, c.Request().Header, c)
if err != nil || person.ID.ID() == 0 {
return c.JSON(http.StatusBadGateway, &utils.Error{
Type: "internal_error",
Message: "Can't send request to persons service",
Code: "0004",
})
}
}
employee := usersMap[event.EmployeeId]
author := usersMap[uint(authorId)]
usersMap, err := services.GetUsers([]uuid.UUID{event.MedicId, authorId}, c.Request().Header, c)
newEvent.Start = event.Start
newEvent.End = event.End
newEvent.AuthorId = uint(authorId)
newEvent.EmployeeId = event.EmployeeId
newEvent.MemberId = event.MemberId
newEvent.MedicalCardId = event.MedicalCardId
newEvent.Status = event.Status
newEvent.Services = event.Services
newEvent.OrgId = uint(orgId)
if err != nil || len(usersMap) == 0 {
return c.JSON(http.StatusBadGateway, &utils.Error{
Type: "internal_error",
Message: "Can't send request to users service",
Code: "0005",
})
}
medic := usersMap[event.MedicId]
author := usersMap[authorId]
newEvent, err := utils.TypeConverter[model.Event](event)
newEvent.OrgId = orgId
newEvent.MedicId = event.MedicId
newEvent.AuthorId = authorId
newEvent.PersonId = person.ID
newEvent.Person = *person
tx := h.DB.Create(&newEvent)
if tx.RowsAffected == 0 {
return c.NoContent(http.StatusBadGateway)
return c.JSON(http.StatusBadGateway, &utils.Error{
Type: "internal_error",
Message: "Database error",
Code: "0006",
})
}
newEvent.Author = author
newEvent.Employee = employee
newEvent.Medic = medic
return c.JSON(http.StatusCreated, newEvent)
}
// swagger:route GET /events/ Events GetEvents
//
// responses:
// 200: []Event
func (h *Handler) GetEvents(c echo.Context) (err error) {
var events []model.Event
query := c.Request().URL.Query()
_, _, filterMap := utils.GetFilterParams(query)
orgId, err := strconv.Atoi(c.Request().Header.Get("UserOrganizationId"))
orgId, err := uuid.Parse(c.Request().Header.Get("X-User-Organization-Id"))
if err != nil {
return c.NoContent(http.StatusUnauthorized)
return c.JSON(http.StatusUnauthorized, &utils.Error{
Type: "internal_error",
Message: "User in not authorized",
Code: "0002",
})
}
tx := h.DB.Where("org_id = ?", orgId)
if len(filterMap) > 0 {
tx = tx.Where("start >= ?", filterMap["start"]).Where("\"end\" <= ?", filterMap["end"])
if query.Has("start") && query.Has("end") {
tx = tx.Where("start >= ?", query.Get("start")).Where("\"end\" <= ?", query.Get("end"))
}
tx.Find(&events)
ids := set.New[uint](len(events) * 2)
for _, event := range events {
ids.Insert(event.EmployeeId)
ids.Insert(event.AuthorId)
return h.queryEvents(tx, c)
}
usersMap, err := services.GetUsers(ids.Slice(), c.Request().Header)
// swagger:route GET /events/today Events GetEventsToday
//
// responses:
// 200: []Event
func (h *Handler) GetEventsToday(c echo.Context) (err error) {
orgId, err := uuid.Parse(c.Request().Header.Get("X-User-Organization-Id"))
if err != nil {
return c.HTML(http.StatusBadGateway, err.Error())
return c.JSON(http.StatusUnauthorized, &utils.Error{
Type: "internal_error",
Message: "User in not authorized",
Code: "0002",
})
}
for i, event := range events {
events[i].Author = usersMap[event.AuthorId]
events[i].Employee = usersMap[event.EmployeeId]
tx := h.DB.Where("org_id = ?", orgId)
currentDate := time.Now().Format(time.DateOnly)
nextDate := time.Now().Add(24 * time.Hour).Format(time.DateOnly)
tx = tx.Where("start >= ?", currentDate).Where("\"end\" < ?", nextDate)
return h.queryEvents(tx, c)
}
return c.JSON(http.StatusOK, events)
}
// swagger:route GET /events/{uuid} Events GetEvent
//
// responses:
// 200: Event
func (h *Handler) GetEvent(c echo.Context) error {
var event model.Event
id := c.Param("id")
orgId, err := strconv.Atoi(c.Request().Header.Get("UserOrganizationId"))
orgId, err := uuid.Parse(c.Request().Header.Get("X-User-Organization-Id"))
if err != nil {
return c.NoContent(http.StatusUnauthorized)
return c.JSON(http.StatusUnauthorized, &utils.Error{
Type: "internal_error",
Message: "User in not authorized",
Code: "0002",
})
}
tx := h.DB.Where("org_id = ?", orgId).First(&event, id)
if tx.RowsAffected == 0 {
return c.NoContent(http.StatusNotFound)
return c.JSON(http.StatusNotFound, &utils.Error{
Type: "not_found_error",
Message: "Event not found",
Code: "0007",
})
}
usersMap, err := services.GetUsers([]uint{event.EmployeeId, event.AuthorId}, c.Request().Header)
usersMap, err := services.GetUsers([]uuid.UUID{event.MedicId, event.AuthorId}, c.Request().Header, c)
if err != nil {
return c.HTML(http.StatusBadGateway, err.Error())
return c.JSON(http.StatusBadGateway, &utils.Error{
Type: "internal_error",
Message: "Can't send request to persons or users service",
Code: "0005",
})
}
employee := usersMap[event.EmployeeId]
medic := usersMap[event.MedicId]
author := usersMap[event.AuthorId]
event.Employee = employee
event.Medic = medic
event.Author = author
return c.JSON(http.StatusOK, event)
}
// swagger:route DELETE /events/{uuid} Events DeleteEvent
//
// responses:
// 200
func (h *Handler) DeleteEvent(c echo.Context) error {
id := c.Param("id")
orgId, err := strconv.Atoi(c.Request().Header.Get("UserOrganizationId"))
orgId, err := uuid.Parse(c.Request().Header.Get("X-User-Organization-Id"))
if err != nil {
return c.NoContent(http.StatusUnauthorized)
return c.JSON(http.StatusUnauthorized, &utils.Error{
Type: "internal_error",
Message: "User in not authorized",
Code: "0002",
})
}
tx := h.DB.Where("org_id = ?", orgId).Delete(&model.Event{}, id)
if tx.RowsAffected == 0 {
return c.NoContent(http.StatusNotFound)
return c.JSON(http.StatusNotFound, &utils.Error{
Type: "not_found_error",
Message: "Event not found",
Code: "0007",
})
}
return c.NoContent(http.StatusOK)
}
func (h *Handler) queryEvents(tx *gorm.DB, c echo.Context) error {
var events []model.Event
tx.Find(&events)
userIds := set.New[uuid.UUID](len(events) * 2)
personIds := set.New[uuid.UUID](len(events))
for _, event := range events {
userIds.Insert(event.MedicId)
userIds.Insert(event.AuthorId)
personIds.Insert(event.PersonId)
}
usersMap, err := services.GetUsers(userIds.Slice(), c.Request().Header, c)
personsMap, err := services.GetPersons(personIds.Slice(), c.Request().Header, c)
if err != nil {
return c.JSON(http.StatusBadGateway, &utils.Error{
Type: "internal_error",
Message: "Can't send request to persons or users service",
Code: "0005",
})
}
for i, event := range events {
events[i].Author = usersMap[event.AuthorId]
events[i].Medic = usersMap[event.MedicId]
events[i].Person = personsMap[event.PersonId]
}
return c.JSON(http.StatusOK, events)
}

View File

@@ -1,7 +1,11 @@
package handler
import "gorm.io/gorm"
import (
"github.com/go-playground/validator/v10"
"gorm.io/gorm"
)
type Handler struct {
DB *gorm.DB
Validator *validator.Validate
}

19
main.go
View File

@@ -4,13 +4,17 @@ import (
"astra-events/config"
"astra-events/handler"
"astra-events/model"
"github.com/go-playground/validator/v10"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
log2 "github.com/labstack/gommon/log"
"gorm.io/driver/postgres"
"gorm.io/gorm"
"gorm.io/gorm/logger"
"log"
"os"
"reflect"
"strings"
"time"
)
@@ -38,14 +42,27 @@ func main() {
db.AutoMigrate(&model.Event{})
var h = &handler.Handler{DB: db}
validate := validator.New()
validate.RegisterTagNameFunc(func(fld reflect.StructField) string {
name := strings.SplitN(fld.Tag.Get("json"), ",", 2)[0]
if name == "-" {
return ""
}
return name
})
var h = &handler.Handler{DB: db, Validator: validate}
e.POST("/", h.CreateEvent)
e.GET("/:id", h.GetEvent)
e.GET("/", h.GetEvents)
e.GET("/today", h.GetEventsToday)
e.DELETE("/", h.DeleteEvent)
e.GET("/health", handler.Health)
e.Debug = true
e.Logger.SetLevel(log2.DEBUG)
e.Logger.Fatal(e.Start(":" + config.Env.Server.Port))
}

View File

@@ -1,34 +1,47 @@
package model
import (
"github.com/lib/pq"
"github.com/google/uuid"
"gorm.io/gorm"
"time"
)
// swagger:model Event
type Event struct {
gorm.Model
gorm.Model `json:"meta"`
ID uuid.UUID `json:"id" gorm:"type:uuid;default:gen_random_uuid();primarykey"`
Start time.Time `json:"start"`
End time.Time `json:"end"`
Author User `json:"author" gorm:"-"`
AuthorId uint `json:"-"`
Employee User `json:"employee" gorm:"-"`
EmployeeId uint `json:"-"`
Member PD `json:"member" gorm:"-"`
MemberId uint `json:"-"`
Status string `json:"status"`
MedicalCard Card `json:"medicalCard" gorm:"-"`
MedicalCardId uint `json:"-"`
Services pq.Int32Array `json:"services" gorm:"type:integer[]"`
OrgId uint `json:"-"`
AuthorId uuid.UUID `json:"-"`
Medic User `json:"medic" gorm:"-"`
MedicId uuid.UUID `json:"-"`
Person PersonalInformationApi `json:"person" gorm:"-"`
PersonId uuid.UUID `json:"-"`
OrgId uuid.UUID `json:"-"`
}
// swagger:model CreateEvent
type CreateEvent struct {
Start time.Time `json:"start"`
End time.Time `json:"end"`
EmployeeId uint `json:"employee_id"`
MemberId uint `json:"member_id"`
Status string `json:"status"`
MedicalCardId uint `json:"medical_card_id"`
Services []int32 `json:"services"`
// The event start time
// example: 2023-08-02T19:21:23.617Z
// required: true
Start time.Time `json:"start" validate:"required,gt"`
// The event end time
// example: 2023-08-02T19:21:23.617Z
// required: true
End time.Time `json:"end" validate:"required,gtfield=Start"`
// The person information
// required: true
Person *PersonalInformation `json:"person" validate:"required,dive"`
// The UUID of a medic
// example: 6204037c-30e6-408b-8aaa-dd8219860b4b
// required: true
MedicId uuid.UUID `json:"medic_id" validate:"required"`
}
// swagger:parameters CreateEvent
type CreateEventArg struct {
//in: body
CreateEvent *CreateEvent
}

View File

@@ -1,7 +0,0 @@
package model
import "gorm.io/gorm"
type PD struct {
gorm.Model
}

View File

@@ -0,0 +1,36 @@
package model
import "github.com/google/uuid"
// swagger:model PersonalInformation
type PersonalInformation struct {
// The UUID of a person
// example: 6204037c-30e6-408b-8aaa-dd8219860b4b
ID uuid.UUID `json:"id,omitempty" validate:"required_without_all=FirstName LastName Patronymic Phone"`
// The first name of a person
// example: Иван
FirstName string `json:"first_name,omitempty" validate:"required_without=ID"`
// The last name of a person
// example: Иванов
LastName string `json:"last_name,omitempty" validate:"required_without=ID"`
// The patronymic of a person
// example: Иванович
Patronymic string `json:"patronymic,omitempty" validate:"required_without=ID"`
// The first name of a person
// example: 79206321370
Phone string `json:"phone,omitempty" validate:"required_without=ID"`
}
type PersonalInformationApi struct {
ID uuid.UUID `json:"id,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Patronymic string `json:"patronymic,omitempty"`
BirthDate string `json:"birth_date,omitempty"`
Contacts []Contact `json:"contacts"`
}
type Contact struct {
Category string `json:"category"`
Value string `json:"value"`
}

View File

@@ -1,9 +1,13 @@
package model
import "gorm.io/gorm"
import (
"github.com/google/uuid"
"gorm.io/gorm"
)
type (
User struct {
ID uuid.UUID
gorm.Model
UserName string `json:"user_name" gorm:"unique"`
Password string `json:"password,omitempty"`

View File

@@ -3,15 +3,16 @@ package api
import (
"bytes"
"encoding/json"
"github.com/labstack/echo/v4"
"io"
"net/http"
)
func PostRequest(url string, model any, header http.Header) ([]byte, error) {
func PostRequest(url string, model any, header http.Header, c echo.Context) ([]byte, error, *http.Response) {
uJson, err := json.Marshal(model)
if err != nil {
return nil, err
return nil, err, nil
}
client := http.Client{}
@@ -19,22 +20,28 @@ func PostRequest(url string, model any, header http.Header) ([]byte, error) {
req.Header = header
req.Header.Set("Content-Type", "application/json")
c.Logger().Debug("Request---")
c.Logger().Debug(string(uJson))
resp, err := client.Do(req)
if err != nil {
return nil, err
return nil, err, nil
}
data, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
return nil, err, nil
}
return data, nil
c.Logger().Debug("Response---")
c.Logger().Debug(string(data))
return data, nil, resp
}
func GetRequest(url string, header http.Header, args ...string) ([]byte, error, *http.Response) {
func GetRequest(url string, header http.Header, c echo.Context, args ...string) ([]byte, error, *http.Response) {
client := http.Client{}
req, err := http.NewRequest("GET", url, nil)
if len(args) > 0 {
@@ -42,6 +49,10 @@ func GetRequest(url string, header http.Header, args ...string) ([]byte, error,
}
req.Header = header
req.Header.Set("Content-Type", "application/json")
c.Logger().Debug("Request---")
c.Logger().Debug(req.URL.String())
resp, err := client.Do(req)
if err != nil {
@@ -54,6 +65,9 @@ func GetRequest(url string, header http.Header, args ...string) ([]byte, error,
return nil, err, nil
}
c.Logger().Debug("Response---")
c.Logger().Debug(string(data))
return data, nil, resp
}

View File

@@ -0,0 +1,16 @@
package utils
import "encoding/json"
func TypeConverter[R any](data any) (*R, error) {
var result R
b, err := json.Marshal(&data)
if err != nil {
return nil, err
}
err = json.Unmarshal(b, &result)
if err != nil {
return nil, err
}
return &result, err
}

14
pkg/utils/validation.go Normal file
View File

@@ -0,0 +1,14 @@
package utils
type Error struct {
Type string `json:"type"`
Message string `json:"message"`
Code string `json:"code"`
}
type ValidationError struct {
Type string `json:"type"`
Message string `json:"message"`
Code string `json:"code"`
Fields map[string]string `json:"fields"`
}

View File

@@ -0,0 +1,82 @@
package services
import (
"astra-events/config"
"astra-events/model"
"astra-events/pkg/api"
"encoding/json"
"errors"
"github.com/google/uuid"
"github.com/labstack/echo/v4"
"net/http"
)
func GetPerson(id uuid.UUID, header http.Header, c echo.Context) (*model.PersonalInformationApi, error) {
data, err, _ := api.GetRequest(
config.Env.MSHosts.PersonsHost+"/persons/"+id.String(),
header, c)
if err != nil {
return nil, errors.New("error Request to Personal Information Service")
}
pi := new(model.PersonalInformationApi)
err = json.Unmarshal(data, &pi)
if err != nil {
return nil, errors.New("bad Response from Personal Information Service")
}
return pi, nil
}
func CreatePerson(person model.PersonalInformationApi, header http.Header, c echo.Context) (*model.PersonalInformationApi, error) {
data, err, _ := api.PostRequest(
config.Env.MSHosts.PersonsHost+"/persons/",
person,
header,
c,
)
if err != nil {
return nil, errors.New("error Request to Personal Information Service")
}
pi := new(model.PersonalInformationApi)
err = json.Unmarshal(data, &pi)
if err != nil {
return nil, errors.New("bad Response from Personal Information Service")
}
return pi, nil
}
func GetPersons(ids []uuid.UUID, header http.Header, c echo.Context) (map[uuid.UUID]model.PersonalInformationApi, error) {
var persons []model.PersonalInformationApi
personsMap := make(map[uuid.UUID]model.PersonalInformationApi)
data, err, req := api.PostRequest(
config.Env.MSHosts.PersonsHost+"/persons/batch/",
&map[string][]uuid.UUID{
"ids": ids,
},
header, c)
if err != nil || req.StatusCode != 200 {
return nil, err
}
err = json.Unmarshal(data, &persons)
if err != nil {
return nil, err
}
for _, person := range persons {
personsMap[person.ID] = person
}
return personsMap, nil
}

View File

@@ -6,17 +6,19 @@ import (
"astra-events/pkg/api"
"encoding/json"
"errors"
"github.com/google/uuid"
"github.com/labstack/echo/v4"
"net/http"
"net/url"
"strconv"
)
func GetUser(ID uint, header http.Header) (*model.User, error) {
func GetUser(ID uint, header http.Header, c echo.Context) (*model.User, error) {
id := strconv.Itoa(int(ID))
data, err, _ := api.GetRequest(
config.Env.MSHosts.UsersHost+"/"+id,
header)
header, c)
if err != nil {
return nil, errors.New("error Request to Users Service")
@@ -33,9 +35,9 @@ func GetUser(ID uint, header http.Header) (*model.User, error) {
return u, nil
}
func GetUsers(ids []uint, header http.Header) (map[uint]model.User, error) {
func GetUsers(ids []uuid.UUID, header http.Header, c echo.Context) (map[uuid.UUID]model.User, error) {
var users []model.User
var usersMap = make(map[uint]model.User)
var usersMap = make(map[uuid.UUID]model.User)
Url, err := url.Parse(config.Env.MSHosts.UsersHost)
if err != nil {
return nil, err
@@ -47,7 +49,7 @@ func GetUsers(ids []uint, header http.Header) (map[uint]model.User, error) {
data, err, req := api.GetRequest(
Url.String(),
header)
header, c)
if err != nil || req.StatusCode != 200 {
return nil, err

335
swagger/swagger.json Normal file
View File

@@ -0,0 +1,335 @@
{
"swagger": "2.0",
"paths": {
"/events/": {
"get": {
"tags": [
"Events"
],
"operationId": "GetEvents",
"responses": {
"200": {
"description": "Event",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Event"
}
}
}
}
},
"post": {
"tags": [
"Events"
],
"operationId": "CreateEvent",
"parameters": [
{
"name": "CreateEvent",
"in": "body",
"schema": {
"$ref": "#/definitions/CreateEvent"
}
}
],
"responses": {
"200": {
"description": "Event",
"schema": {
"$ref": "#/definitions/Event"
}
}
}
}
},
"/events/today": {
"get": {
"tags": [
"Events"
],
"operationId": "GetEvents",
"responses": {
"200": {
"description": "Event",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Event"
}
}
}
}
}
},
"/events/{uuid}": {
"get": {
"tags": [
"Events"
],
"operationId": "GetEvent",
"responses": {
"200": {
"description": "Event",
"schema": {
"$ref": "#/definitions/Event"
}
}
}
},
"delete": {
"tags": [
"Events"
],
"operationId": "DeleteEvent",
"responses": {}
}
}
},
"definitions": {
"Contact": {
"type": "object",
"properties": {
"category": {
"type": "string",
"x-go-name": "Category"
},
"value": {
"type": "string",
"x-go-name": "Value"
}
},
"x-go-package": "astra-events/model"
},
"CreateEvent": {
"type": "object",
"required": [
"start",
"end",
"person",
"medic_id"
],
"properties": {
"end": {
"description": "The event end time",
"type": "string",
"format": "date-time",
"x-go-name": "End",
"example": "2023-08-02T19:21:23.617Z"
},
"medic_id": {
"description": "The UUID of a medic",
"type": "string",
"format": "uuid",
"x-go-name": "MedicId",
"example": "6204037c-30e6-408b-8aaa-dd8219860b4b"
},
"person": {
"$ref": "#/definitions/PersonalInformation"
},
"start": {
"description": "The event start time",
"type": "string",
"format": "date-time",
"x-go-name": "Start",
"example": "2023-08-02T19:21:23.617Z"
}
},
"x-go-package": "astra-events/model"
},
"DeletedAt": {
"$ref": "#/definitions/NullTime"
},
"Event": {
"type": "object",
"properties": {
"CreatedAt": {
"type": "string",
"format": "date-time"
},
"DeletedAt": {
"$ref": "#/definitions/DeletedAt"
},
"ID": {
"type": "integer",
"format": "uint64"
},
"UpdatedAt": {
"type": "string",
"format": "date-time"
},
"author": {
"$ref": "#/definitions/User"
},
"end": {
"type": "string",
"format": "date-time",
"x-go-name": "End"
},
"id": {
"type": "string",
"format": "uuid",
"x-go-name": "ID"
},
"medic": {
"$ref": "#/definitions/User"
},
"person": {
"$ref": "#/definitions/PersonalInformationApi"
},
"start": {
"type": "string",
"format": "date-time",
"x-go-name": "Start"
}
},
"x-go-package": "astra-events/model"
},
"Model": {
"description": "type User struct {\ngorm.Model\n}",
"type": "object",
"title": "Model a basic GoLang struct which includes the following fields: ID, CreatedAt, UpdatedAt, DeletedAt\nIt may be embedded into your model or you may build your own model without it",
"properties": {
"CreatedAt": {
"type": "string",
"format": "date-time"
},
"DeletedAt": {
"$ref": "#/definitions/DeletedAt"
},
"ID": {
"type": "integer",
"format": "uint64"
},
"UpdatedAt": {
"type": "string",
"format": "date-time"
}
},
"x-go-package": "gorm.io/gorm"
},
"NullTime": {
"description": "NullTime implements the Scanner interface so\nit can be used as a scan destination, similar to NullString.",
"type": "object",
"title": "NullTime represents a time.Time that may be null.",
"properties": {
"Time": {
"type": "string",
"format": "date-time"
},
"Valid": {
"type": "boolean"
}
},
"x-go-package": "database/sql"
},
"PersonalInformation": {
"type": "object",
"properties": {
"first_name": {
"description": "The first name of a person",
"type": "string",
"x-go-name": "FirstName",
"example": "Иван"
},
"id": {
"description": "The UUID of a person",
"type": "string",
"format": "uuid",
"x-go-name": "ID",
"example": "6204037c-30e6-408b-8aaa-dd8219860b4b"
},
"last_name": {
"description": "The last name of a person",
"type": "string",
"x-go-name": "LastName",
"example": "Иванов"
},
"patronymic": {
"description": "The patronymic of a person",
"type": "string",
"x-go-name": "Patronymic",
"example": "Иванович"
},
"phone": {
"description": "The first name of a person",
"type": "string",
"x-go-name": "Phone",
"example": "79206321370"
}
},
"x-go-package": "astra-events/model"
},
"PersonalInformationApi": {
"type": "object",
"properties": {
"birth_date": {
"type": "string",
"x-go-name": "BirthDate"
},
"contacts": {
"type": "array",
"items": {
"$ref": "#/definitions/Contact"
},
"x-go-name": "Contacts"
},
"first_name": {
"type": "string",
"x-go-name": "FirstName"
},
"id": {
"type": "string",
"format": "uuid",
"x-go-name": "ID"
},
"last_name": {
"type": "string",
"x-go-name": "LastName"
},
"patronymic": {
"type": "string",
"x-go-name": "Patronymic"
}
},
"x-go-package": "astra-events/model"
},
"User": {
"type": "object",
"properties": {
"CreatedAt": {
"type": "string",
"format": "date-time"
},
"DeletedAt": {
"$ref": "#/definitions/DeletedAt"
},
"ID": {
"type": "string",
"format": "uuid"
},
"UpdatedAt": {
"type": "string",
"format": "date-time"
},
"first_name": {
"type": "string",
"x-go-name": "FirstName"
},
"last_name": {
"type": "string",
"x-go-name": "LastName"
},
"password": {
"type": "string",
"x-go-name": "Password"
},
"user_name": {
"type": "string",
"x-go-name": "UserName"
}
},
"x-go-package": "astra-events/model"
}
}
}