diff --git a/.env b/.env index 02a9e23..7dc6c04 100644 --- a/.env +++ b/.env @@ -11,4 +11,5 @@ SMTP_USERNAME=info@tailly.ru SMTP_PASSWORD="86AN1z1WxbFX6Q9u" SMTP_FROM=info@tailly.ru AppURL="https://tailly.ru" -MESSAGE_SERVICE_ADDRESS="tailly_messages:50052" \ No newline at end of file +MESSAGE_SERVICE_ADDRESS="tailly_messages:50052" +SUBSCRIBE_SERVICE_ADDRESS="tailly_subscribers:50053" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 5e49c56..a32e6ef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.25rc2-alpine AS builder +FROM golang:1.25rc3-alpine AS builder RUN apk add --no-cache git ca-certificates build-base diff --git a/cmd/server/main.go b/cmd/server/main.go index 40199bd..a0a35b4 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -33,25 +33,47 @@ func main() { } defer db.Close() - grpcConn, err := grpc.Dial( + // Подключение к MessageService gRPC + messageConn, err := grpc.Dial( cfg.GRPC.MessageServiceAddress, grpc.WithInsecure(), grpc.WithKeepaliveParams(keepalive.ClientParameters{ - Time: 30 * time.Second, // Отправлять keepalive ping каждые 30 секунд - Timeout: 10 * time.Second, // Ждать ответ 10 секунд - PermitWithoutStream: true, // Разрешить keepalive даже без активных стримов + Time: 30 * time.Second, + Timeout: 10 * time.Second, + PermitWithoutStream: true, }), grpc.WithConnectParams(grpc.ConnectParams{ - Backoff: backoff.DefaultConfig, // Экспоненциальная backoff-стратегия - MinConnectTimeout: 5 * time.Second, // Минимальное время ожидания подключения + Backoff: backoff.DefaultConfig, + MinConnectTimeout: 5 * time.Second, }), - grpc.WithDefaultServiceConfig(`{"loadBalancingPolicy":"round_robin"}`), // Политика балансировки + grpc.WithDefaultServiceConfig(`{"loadBalancingPolicy":"round_robin"}`), ) if err != nil { log.Fatalf("failed to connect to messages gRPC service: %v", err) } - defer grpcConn.Close() - messageClient := proto.NewMessageServiceClient(grpcConn) + defer messageConn.Close() + messageClient := proto.NewMessageServiceClient(messageConn) + + // Подключение к SubscribeService gRPC + subscribeConn, err := grpc.Dial( + cfg.GRPC.SubscribeServiceAddress, // Добавьте этот параметр в конфиг + grpc.WithInsecure(), + grpc.WithKeepaliveParams(keepalive.ClientParameters{ + Time: 30 * time.Second, + Timeout: 10 * time.Second, + PermitWithoutStream: true, + }), + grpc.WithConnectParams(grpc.ConnectParams{ + Backoff: backoff.DefaultConfig, + MinConnectTimeout: 5 * time.Second, + }), + grpc.WithDefaultServiceConfig(`{"loadBalancingPolicy":"round_robin"}`), + ) + if err != nil { + log.Fatalf("failed to connect to subscribe gRPC service: %v", err) + } + defer subscribeConn.Close() + subscribeClient := proto.NewSubscribeServiceClient(subscribeConn) // Инициализация зависимостей tokenAuth := auth.NewTokenAuth( @@ -96,19 +118,20 @@ func main() { // Создаем структуру Services services := &service.Services{ - Auth: authService, - User: userService, - Post: postService, - Comment: commentService, - Like: likeService, - Audit: auditService, - Recovery: recoveryService, - Session: sessionService, - Mail: mailService, - Messages: messageClient, // Добавляем gRPC клиент + Auth: authService, + User: userService, + Post: postService, + Comment: commentService, + Like: likeService, + Audit: auditService, + Recovery: recoveryService, + Session: sessionService, + Mail: mailService, + Messages: messageClient, + Subscribe: subscribeClient, // Добавляем gRPC клиент подписок } - // HTTP сервер - передаем db как дополнительный параметр + // HTTP сервер server := http.NewServer(cfg, services, tokenAuth, db) // Запуск сервера в отдельной горутине diff --git a/go.mod b/go.mod index 8a99f96..becce6f 100644 --- a/go.mod +++ b/go.mod @@ -1,45 +1,100 @@ module tailly_back_v2 -go 1.25rc2 +go 1.25rc3 require ( github.com/99designs/gqlgen v0.17.77 - github.com/aws/aws-sdk-go v1.55.7 + github.com/aws/aws-sdk-go v1.55.8 github.com/caarlos0/env/v8 v8.0.0 github.com/go-chi/chi/v5 v5.2.2 - github.com/golang-jwt/jwt/v5 v5.2.3 + github.com/golang-jwt/jwt/v5 v5.3.0 github.com/gorilla/websocket v1.5.3 + github.com/jackc/pgx/v4 v4.18.3 github.com/joho/godotenv v1.5.1 github.com/lib/pq v1.10.9 - github.com/prometheus/client_golang v1.22.0 + github.com/prometheus/client_golang v1.23.0 github.com/stretchr/testify v1.10.0 + github.com/testcontainers/testcontainers-go v0.38.0 github.com/vektah/gqlparser/v2 v2.5.30 - golang.org/x/crypto v0.40.0 - google.golang.org/grpc v1.74.2 - google.golang.org/protobuf v1.36.6 + golang.org/x/crypto v0.41.0 + google.golang.org/grpc v1.75.0 + google.golang.org/protobuf v1.36.8 gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df ) require ( + dario.cat/mergo v1.0.1 // indirect + github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect + github.com/Microsoft/go-winio v0.6.2 // indirect github.com/agnivade/levenshtein v1.2.1 // indirect github.com/beorn7/perks v1.0.1 // indirect + github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/containerd/errdefs v1.0.0 // indirect + github.com/containerd/errdefs/pkg v0.3.0 // indirect + github.com/containerd/log v0.1.0 // indirect + github.com/containerd/platforms v0.2.1 // indirect + github.com/cpuguy83/dockercfg v0.3.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/distribution/reference v0.6.0 // indirect + github.com/docker/docker v28.2.2+incompatible // indirect + github.com/docker/go-connections v0.5.0 // indirect + github.com/docker/go-units v0.5.0 // indirect + github.com/ebitengine/purego v0.8.4 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/go-logr/logr v1.4.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-viper/mapstructure/v2 v2.4.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect + github.com/jackc/chunkreader/v2 v2.0.1 // indirect + github.com/jackc/pgconn v1.14.3 // indirect + github.com/jackc/pgio v1.0.0 // indirect + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgproto3/v2 v2.3.3 // indirect + github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect + github.com/jackc/pgtype v1.14.0 // indirect + github.com/jackc/puddle v1.3.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect - github.com/kr/text v0.2.0 // indirect + github.com/klauspost/compress v1.18.0 // indirect + github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect + github.com/magiconair/properties v1.8.10 // indirect + github.com/moby/docker-image-spec v1.3.1 // indirect + github.com/moby/go-archive v0.1.0 // indirect + github.com/moby/patternmatcher v0.6.0 // indirect + github.com/moby/sys/sequential v0.6.0 // indirect + github.com/moby/sys/user v0.4.0 // indirect + github.com/moby/sys/userns v0.1.0 // indirect + github.com/moby/term v0.5.0 // indirect + github.com/morikuni/aec v1.0.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.1.1 // indirect + github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect github.com/prometheus/client_model v0.6.2 // indirect github.com/prometheus/common v0.65.0 // indirect github.com/prometheus/procfs v0.17.0 // indirect + github.com/shirou/gopsutil/v4 v4.25.5 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect github.com/sosodev/duration v1.3.1 // indirect - golang.org/x/net v0.42.0 // indirect - golang.org/x/sys v0.34.0 // indirect - golang.org/x/text v0.27.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20250721164621-a45f3dfb1074 // indirect + github.com/tklauser/go-sysconf v0.3.12 // indirect + github.com/tklauser/numcpus v0.6.1 // indirect + github.com/yusufpapurcu/wmi v1.2.4 // indirect + go.opentelemetry.io/auto/sdk v1.1.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect + go.opentelemetry.io/otel v1.37.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 // indirect + go.opentelemetry.io/otel/metric v1.37.0 // indirect + go.opentelemetry.io/otel/trace v1.37.0 // indirect + go.opentelemetry.io/proto/otlp v1.7.1 // indirect + golang.org/x/net v0.43.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/text v0.28.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250818200422-3122310a409c // indirect gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 1b0701b..3263bce 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,15 @@ +dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s= +dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/99designs/gqlgen v0.17.77 h1:zVW7iyRc9Z+qhvXx2wFFDpHub/E0I0Sz4/Ul2mQ61Pc= github.com/99designs/gqlgen v0.17.77/go.mod h1:yI/o31IauG2kX0IsskM4R894OCCG1jXJORhtLQqB7Oc= +github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6 h1:He8afgbRMd7mFxO99hRNu+6tazq8nFF9lIwo9JFroBk= +github.com/AdaLogics/go-fuzz-headers v0.0.0-20240806141605-e8a1dd7889d6/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= +github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= +github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/PuerkitoBio/goquery v1.10.3 h1:pFYcNSqHxBD06Fpj/KsbStFRsgRATgnf3LeXiUkhzPo= github.com/PuerkitoBio/goquery v1.10.3/go.mod h1:tMUX0zDMHXYlAQk6p35XxQMqMweEKB7iK7iLNd4RH4Y= github.com/agnivade/levenshtein v1.2.1 h1:EHBY3UOn1gwdy/VbFwgo4cxecRznFk7fKWN1KOX7eoM= @@ -10,114 +20,393 @@ github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kk github.com/andybalholm/cascadia v1.3.3/go.mod h1:xNd9bqTn98Ln4DwST8/nG+H0yuB8Hmgu1YHNnWw0GeA= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= -github.com/aws/aws-sdk-go v1.55.7 h1:UJrkFq7es5CShfBwlWAC8DA077vp8PyVbQd3lqLiztE= -github.com/aws/aws-sdk-go v1.55.7/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= +github.com/aws/aws-sdk-go v1.55.8 h1:JRmEUbU52aJQZ2AjX4q4Wu7t4uZjOu71uyNmaWlUkJQ= +github.com/aws/aws-sdk-go v1.55.8/go.mod h1:ZkViS9AqA6otK+JBBNH2++sx1sgxrPKcSzPPvQkUtXk= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/caarlos0/env/v8 v8.0.0 h1:POhxHhSpuxrLMIdvTGARuZqR4Jjm8AYmoi/JKlcScs0= github.com/caarlos0/env/v8 v8.0.0/go.mod h1:7K4wMY9bH0esiXSSHlfHLX5xKGQMnkH5Fk4TDSSSzfo= +github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= +github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= +github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= +github.com/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG8PI= +github.com/containerd/errdefs v1.0.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ/kCkyJ2k+M= +github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151Xdx3ZPPE= +github.com/containerd/errdefs/pkg v0.3.0/go.mod h1:NJw6s9HwNuRhnjJhM7pylWwMyAkmCQvQ4GpJHEqRLVk= +github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= +github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= +github.com/containerd/platforms v0.2.1 h1:zvwtM3rz2YHPQsF2CHYM8+KtB5dvhISiXh5ZpSBQv6A= +github.com/containerd/platforms v0.2.1/go.mod h1:XHCb+2/hzowdiut9rkudds9bE5yJ7npe7dG/wG+uFPw= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/cpuguy83/dockercfg v0.3.2 h1:DlJTyZGBDlXqUZ2Dk2Q3xHs/FtnooJJVaad2S9GKorA= +github.com/cpuguy83/dockercfg v0.3.2/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= +github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= 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/dgryski/trifles v0.0.0-20230903005119-f50d829f2e54 h1:SG7nF6SRlWhcT7cNTs5R6Hk4V2lcmLz2NsG2VnInyNo= github.com/dgryski/trifles v0.0.0-20230903005119-f50d829f2e54/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= +github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= +github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= +github.com/docker/docker v28.2.2+incompatible h1:CjwRSksz8Yo4+RmQ339Dp/D2tGO5JxwYeqtMOEe0LDw= +github.com/docker/docker v28.2.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= +github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= +github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/ebitengine/purego v0.8.4 h1:CF7LEKg5FFOsASUj0+QwaXf8Ht6TlFxg09+S9wz0omw= +github.com/ebitengine/purego v0.8.4/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/go-chi/chi/v5 v5.2.2 h1:CMwsvRVTbXVytCk1Wd72Zy1LAsAh9GxMmSNWLHCG618= github.com/go-chi/chi/v5 v5.2.2/go.mod h1:L2yAIGWB3H+phAw1NxKwWM+7eUH/lU8pOMm5hHcoops= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/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-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs= github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= -github.com/golang-jwt/jwt/v5 v5.2.3 h1:kkGXqQOBSDDWRhWNXTFpqGSCMyh/PLnqUvMGJPDJDs0= -github.com/golang-jwt/jwt/v5 v5.2.3/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= +github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo= +github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= 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/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 h1:X5VWvz21y3gzm9Nw/kaUeku/1+uBhcekkmy4IkffJww= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1/go.mod h1:Zanoh4+gvIgluNqcfMVTJueD4wSS5hT7zTt4Mrutd90= github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= +github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= +github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= +github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= +github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA= +github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE= +github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s= +github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= +github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY= +github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= +github.com/jackc/pgconn v1.14.3 h1:bVoTr12EGANZz66nZPkMInAV/KHD2TxH9npjXXgiB3w= +github.com/jackc/pgconn v1.14.3/go.mod h1:RZbme4uasqzybK2RK5c65VsHxoyaml09lx3tXOcO/VM= +github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= +github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= +github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= +github.com/jackc/pgmock v0.0.0-20201204152224-4fe30f7445fd/go.mod h1:hrBW0Enj2AZTNpt/7Y5rr2xe/9Mn757Wtb2xeBzPv2c= +github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65 h1:DadwsjnMwFjfWc9y5Wi/+Zz7xoE5ALHsRQlOctkOiHc= +github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak= +github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= +github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= +github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78= +github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA= +github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg= +github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= +github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= +github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.3.3 h1:1HLSx5H+tXR9pW3in3zaztoEwQYRC9SQaYUHjTSUOag= +github.com/jackc/pgproto3/v2 v2.3.3/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= +github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= +github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= +github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= +github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= +github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM= +github.com/jackc/pgtype v1.14.0 h1:y+xUdabmyMkJLyApYuPj38mW+aAIqCe5uuBB51rH3Vw= +github.com/jackc/pgtype v1.14.0/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= +github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= +github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= +github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= +github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= +github.com/jackc/pgx/v4 v4.18.3 h1:dE2/TrEsGX3RBprb3qryqSV9Y60iZN1C6i8IrmW9/BA= +github.com/jackc/pgx/v4 v4.18.3/go.mod h1:Ey4Oru5tH5sB6tV7hDmfWFahwF15Eb7DNXlRKx2CkVw= +github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle v1.3.0 h1:eHK/5clGOatcjX3oWGBO/MpxpbHzSwud5EWTSCI+MX0= +github.com/jackc/puddle v1.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= +github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= +github.com/magiconair/properties v1.8.10/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= +github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= +github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= +github.com/moby/go-archive v0.1.0 h1:Kk/5rdW/g+H8NHdJW2gsXyZ7UnzvJNOy6VKJqueWdcQ= +github.com/moby/go-archive v0.1.0/go.mod h1:G9B+YoujNohJmrIYFBpSd54GTUB4lt9S+xVQvsJyFuo= +github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk= +github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= +github.com/moby/sys/atomicwriter v0.1.0 h1:kw5D/EqkBwsBFi0ss9v1VG3wIkVhzGvLklJ+w3A14Sw= +github.com/moby/sys/atomicwriter v0.1.0/go.mod h1:Ul8oqv2ZMNHOceF643P6FKPXeCmYtlQMvpizfsSoaWs= +github.com/moby/sys/sequential v0.6.0 h1:qrx7XFUd/5DxtqcoH1h438hF5TmOvzC/lspjy7zgvCU= +github.com/moby/sys/sequential v0.6.0/go.mod h1:uyv8EUTrca5PnDsdMGXhZe6CCe8U/UiTWd+lL+7b/Ko= +github.com/moby/sys/user v0.4.0 h1:jhcMKit7SA80hivmFJcbB1vqmw//wU61Zdui2eQXuMs= +github.com/moby/sys/user v0.4.0/go.mod h1:bG+tYYYJgaMtRKgEmuueC0hJEAZWwtIbZTB+85uoHjs= +github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g= +github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28= +github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= +github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= +github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040= +github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 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/prometheus/client_golang v1.22.0 h1:rb93p9lokFEsctTys46VnV1kLCDpVZ0a/Y92Vm0Zc6Q= -github.com/prometheus/client_golang v1.22.0/go.mod h1:R7ljNsLXhuQXYZYtw6GAE9AZg8Y7vEW5scdCXrWRXC0= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= +github.com/prometheus/client_golang v1.23.0 h1:ust4zpdl9r4trLY/gSjlm07PuiBq2ynaXXlptpfy8Uc= +github.com/prometheus/client_golang v1.23.0/go.mod h1:i/o0R9ByOnHX0McrTMTyhYvKE4haaf2mW08I+jGAjEE= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= github.com/prometheus/common v0.65.0 h1:QDwzd+G1twt//Kwj/Ww6E9FQq1iVMmODnILtW1t2VzE= github.com/prometheus/common v0.65.0/go.mod h1:0gZns+BLRQ3V6NdaerOhMbwwRbNh9hkGINtQAsP5GS8= github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0= github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= +github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= +github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= +github.com/shirou/gopsutil/v4 v4.25.5 h1:rtd9piuSMGeU8g1RMXjZs9y9luK5BwtnG7dZaQUJAsc= +github.com/shirou/gopsutil/v4 v4.25.5/go.mod h1:PfybzyydfZcN+JMMjkF6Zb8Mq1A/VcogFFg7hj50W9c= +github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= +github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= +github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sosodev/duration v1.3.1 h1:qtHBDMQ6lvMQsL15g4aopM4HEfOaYuhWBw3NPTtlqq4= github.com/sosodev/duration v1.3.1/go.mod h1:RQIBBX0+fMLc/D9+Jb/fwvVmo0eZvDDEERAikUR6SDg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/testcontainers/testcontainers-go v0.38.0 h1:d7uEapLcv2P8AvH8ahLqDMMxda2W9gQN1nRbHS28HBw= +github.com/testcontainers/testcontainers-go v0.38.0/go.mod h1:C52c9MoHpWO+C4aqmgSU+hxlR5jlEayWtgYrb8Pzz1w= +github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= +github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= github.com/vektah/gqlparser/v2 v2.5.30 h1:EqLwGAFLIzt1wpx1IPpY67DwUujF1OfzgEyDsLrN6kE= github.com/vektah/gqlparser/v2 v2.5.30/go.mod h1:D1/VCZtV3LPnQrcPBeR/q5jkSQIPti0uYCP/RI0gIeo= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= +github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.36.0 h1:UumtzIklRBY6cI/lllNZlALOF5nNIzJVb16APdvgTXg= -go.opentelemetry.io/otel v1.36.0/go.mod h1:/TcFMXYjyRNh8khOAO9ybYkqaDBb/70aVwkNML4pP8E= -go.opentelemetry.io/otel/metric v1.36.0 h1:MoWPKVhQvJ+eeXWHFBOPoBOi20jh6Iq2CcCREuTYufE= -go.opentelemetry.io/otel/metric v1.36.0/go.mod h1:zC7Ks+yeyJt4xig9DEw9kuUFe5C3zLbVjV2PzT6qzbs= -go.opentelemetry.io/otel/sdk v1.36.0 h1:b6SYIuLRs88ztox4EyrvRti80uXIFy+Sqzoh9kFULbs= -go.opentelemetry.io/otel/sdk v1.36.0/go.mod h1:+lC+mTgD+MUWfjJubi2vvXWcVxyr9rmlshZni72pXeY= -go.opentelemetry.io/otel/sdk/metric v1.36.0 h1:r0ntwwGosWGaa0CrSt8cuNuTcccMXERFwHX4dThiPis= -go.opentelemetry.io/otel/sdk/metric v1.36.0/go.mod h1:qTNOhFDfKRwX0yXOqJYegL5WRaW376QbB7P4Pb0qva4= -go.opentelemetry.io/otel/trace v1.36.0 h1:ahxWNuqZjpdiFAyrIoQ4GIiAIhxAunQR6MUoKrsNd4w= -go.opentelemetry.io/otel/trace v1.36.0/go.mod h1:gQ+OnDZzrybY4k4seLzPAWNwVBBVlF2szhehOBB/tGA= -golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM= -golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= -golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= -golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= -golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= -golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= -golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250721164621-a45f3dfb1074 h1:qJW29YvkiJmXOYMu5Tf8lyrTp3dOS+K4z6IixtLaCf8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250721164621-a45f3dfb1074/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= -google.golang.org/grpc v1.74.2 h1:WoosgB65DlWVC9FqI82dGsZhWFNBSLjQ84bjROOpMu4= -google.golang.org/grpc v1.74.2/go.mod h1:CtQ+BGjaAIXHs/5YS3i473GqwBBa1zGQNevxdeBEXrM= -google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= -google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= +go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= +go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 h1:Ahq7pZmv87yiyn3jeFz/LekZmPLLdKejuO3NcK9MssM= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0/go.mod h1:MJTqhM0im3mRLw1i8uGHnCvUEeS7VwRyxlLC78PA18M= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0 h1:IeMeyr1aBvBiPVYihXIaeIZba6b8E1bYp7lbdxK8CQg= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0/go.mod h1:oVdCUtjq9MK9BlS7TtucsQwUcXcymNiEDjgDD2jMtZU= +go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= +go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= +go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI= +go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg= +go.opentelemetry.io/otel/sdk/metric v1.37.0 h1:90lI228XrB9jCMuSdA0673aubgRobVZFhbjxHHspCPc= +go.opentelemetry.io/otel/sdk/metric v1.37.0/go.mod h1:cNen4ZWfiD37l5NhS+Keb5RXVWZWpRE+9WyVCpbo5ps= +go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= +go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/proto/otlp v1.7.1 h1:gTOMpGDb0WTBOP8JaO72iL3auEZhVmAQg4ipjOVAtj4= +go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= +go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= +golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4= +golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= +golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 h1:vVKdlvoWBphwdxWKrFZEuM0kGgGLxUOYcY4U/2Vjg44= +golang.org/x/time v0.0.0-20220210224613-90d013bbcef8/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= +gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= +google.golang.org/genproto/googleapis/api v0.0.0-20250728155136-f173205681a0 h1:0UOBWO4dC+e51ui0NFKSPbkHHiQ4TmrEfEZMLDyRmY8= +google.golang.org/genproto/googleapis/api v0.0.0-20250728155136-f173205681a0/go.mod h1:8ytArBbtOy2xfht+y2fqKd5DRDJRUQhqbyEnQ4bDChs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250818200422-3122310a409c h1:qXWI/sQtv5UKboZ/zUk7h+mrf/lXORyI+n9DKDAusdg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250818200422-3122310a409c/go.mod h1:gw1tLEfykwDz2ET4a12jcXt4couGAm7IwsVaTy0Sflo= +google.golang.org/grpc v1.75.0 h1:+TW+dqTd2Biwe6KKfhE5JpiYIBWq865PhKGSXiivqt4= +google.golang.org/grpc v1.75.0/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ= +google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc= +google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk= gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/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/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AWRXxgwEyPp2z+p0+hgMuE= gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw= +gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +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= +gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q= +gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= diff --git a/internal/config/config.go b/internal/config/config.go index 7db1aad..2d229cc 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -1,9 +1,10 @@ package config import ( + "time" + "github.com/caarlos0/env/v8" "github.com/joho/godotenv" - "time" ) type Config struct { @@ -29,7 +30,8 @@ type Config struct { URL string `env:"AppURL,required"` } GRPC struct { - MessageServiceAddress string `env:"MESSAGE_SERVICE_ADDRESS"` + MessageServiceAddress string `env:"MESSAGE_SERVICE_ADDRESS"` + SubscribeServiceAddress string `env:"SUBSCRIBE_SERVICE_ADDRESS"` } } diff --git a/internal/http/graph/generated.go b/internal/http/graph/generated.go index 176c26d..4d39326 100644 --- a/internal/http/graph/generated.go +++ b/internal/http/graph/generated.go @@ -84,6 +84,35 @@ type ComplexityRoot struct { UserAgent func(childComplexity int) int } + FollowResult struct { + Message func(childComplexity int) int + Success func(childComplexity int) int + } + + Follower struct { + Avatar func(childComplexity int) int + CreatedAt func(childComplexity int) int + UserID func(childComplexity int) int + Username func(childComplexity int) int + } + + FollowersResponse struct { + Followers func(childComplexity int) int + TotalCount func(childComplexity int) int + } + + Following struct { + Avatar func(childComplexity int) int + CreatedAt func(childComplexity int) int + UserID func(childComplexity int) int + Username func(childComplexity int) int + } + + FollowingResponse struct { + Following func(childComplexity int) int + TotalCount func(childComplexity int) int + } + Like struct { CreatedAt func(childComplexity int) int ID func(childComplexity int) int @@ -91,6 +120,11 @@ type ComplexityRoot struct { User func(childComplexity int) int } + MarkNotificationReadResult struct { + Message func(childComplexity int) int + Success func(childComplexity int) int + } + Message struct { ChatID func(childComplexity int) int Content func(childComplexity int) int @@ -108,8 +142,10 @@ type ComplexityRoot struct { CreateComment func(childComplexity int, postID int, content string) int CreatePost func(childComplexity int, title string, content string) int DeletePost func(childComplexity int, id int) int + FollowUser func(childComplexity int, followingID int) int LikePost func(childComplexity int, postID int) int Login func(childComplexity int, input domain.LoginInput) int + MarkNotificationAsRead func(childComplexity int, notificationID int) int RefreshTokens func(childComplexity int, refreshToken string) int Register func(childComplexity int, input domain.RegisterInput) int RenameDevice func(childComplexity int, deviceID int, name string) int @@ -117,11 +153,18 @@ type ComplexityRoot struct { ResendEmailConfirmation func(childComplexity int) int SendMessage func(childComplexity int, chatID int, content string) int TerminateSession func(childComplexity int, sessionID int) int + UnfollowUser func(childComplexity int, followingID int) int UnlikePost func(childComplexity int, postID int) int UpdateMessageStatus func(childComplexity int, messageID int, status MessageStatus) int UpdateProfile func(childComplexity int, username string, email string, avatar string) int } + NotificationsResponse struct { + Notifications func(childComplexity int) int + TotalCount func(childComplexity int) int + UnreadCount func(childComplexity int) int + } + Post struct { Author func(childComplexity int) int CommentsCount func(childComplexity int) int @@ -136,17 +179,23 @@ type ComplexityRoot struct { } Query struct { - Comments func(childComplexity int, postID int) int - GetChat func(childComplexity int, user1Id int, user2Id int) int - GetChatMessages func(childComplexity int, chatID int, limit int, offset int) int - GetUserChats func(childComplexity int, userID int) int - GetUserPosts func(childComplexity int, userID int) int - Me func(childComplexity int) int - MySessions func(childComplexity int) int - Post func(childComplexity int, id int) int - Posts func(childComplexity int) int - User func(childComplexity int, id int) int - Users func(childComplexity int) int + Comments func(childComplexity int, postID int) int + GetChat func(childComplexity int, user1Id int, user2Id int) int + GetChatMessages func(childComplexity int, chatID int, limit int, offset int) int + GetFollowers func(childComplexity int, userID int, limit *int, offset *int) int + GetFollowersCount func(childComplexity int, userID int) int + GetFollowing func(childComplexity int, userID int, limit *int, offset *int) int + GetFollowingCount func(childComplexity int, userID int) int + GetSubscriptionNotifications func(childComplexity int, unreadOnly *bool, limit *int, offset *int) int + GetUserChats func(childComplexity int, userID int) int + GetUserPosts func(childComplexity int, userID int) int + IsFollowing func(childComplexity int, followingID int) int + Me func(childComplexity int) int + MySessions func(childComplexity int) int + Post func(childComplexity int, id int) int + Posts func(childComplexity int) int + User func(childComplexity int, id int) int + Users func(childComplexity int) int } Session struct { @@ -161,6 +210,16 @@ type ComplexityRoot struct { MessageStream func(childComplexity int, userID int) int } + SubscriptionNotification struct { + CreatedAt func(childComplexity int) int + ExpiresAt func(childComplexity int) int + FollowerAvatar func(childComplexity int) int + FollowerID func(childComplexity int) int + FollowerUsername func(childComplexity int) int + ID func(childComplexity int) int + IsRead func(childComplexity int) int + } + Tokens struct { AccessToken func(childComplexity int) int AccessTokenExpires func(childComplexity int) int @@ -169,14 +228,25 @@ type ComplexityRoot struct { RefreshTokenExpires func(childComplexity int) int } + UnfollowResult struct { + Message func(childComplexity int) int + Success func(childComplexity int) int + } + User struct { - Avatar func(childComplexity int) int - CreatedAt func(childComplexity int) int - Email func(childComplexity int) int - EmailConfirmedAt func(childComplexity int) int - ID func(childComplexity int) int - UpdatedAt func(childComplexity int) int - Username func(childComplexity int) int + Avatar func(childComplexity int) int + CreatedAt func(childComplexity int) int + Email func(childComplexity int) int + EmailConfirmedAt func(childComplexity int) int + Followers func(childComplexity int, limit *int, offset *int) int + FollowersCount func(childComplexity int) int + Following func(childComplexity int, limit *int, offset *int) int + FollowingCount func(childComplexity int) int + ID func(childComplexity int) int + IsFollowing func(childComplexity int, userID int) int + SubscriptionNotifications func(childComplexity int, unreadOnly *bool, limit *int, offset *int) int + UpdatedAt func(childComplexity int) int + Username func(childComplexity int) int } } @@ -221,6 +291,9 @@ type MutationResolver interface { ConfirmEmail(ctx context.Context, token string) (bool, error) ResendEmailConfirmation(ctx context.Context) (bool, error) DeletePost(ctx context.Context, id int) (bool, error) + FollowUser(ctx context.Context, followingID int) (*FollowResult, error) + UnfollowUser(ctx context.Context, followingID int) (*UnfollowResult, error) + MarkNotificationAsRead(ctx context.Context, notificationID int) (*MarkNotificationReadResult, error) } type PostResolver interface { Author(ctx context.Context, obj *domain.Post) (*domain.User, error) @@ -243,6 +316,12 @@ type QueryResolver interface { GetUserChats(ctx context.Context, userID int) ([]*domain.Chat, error) MySessions(ctx context.Context) ([]*domain.Session, error) Comments(ctx context.Context, postID int) ([]*domain.Comment, error) + GetFollowersCount(ctx context.Context, userID int) (int, error) + GetFollowingCount(ctx context.Context, userID int) (int, error) + IsFollowing(ctx context.Context, followingID int) (bool, error) + GetFollowers(ctx context.Context, userID int, limit *int, offset *int) (*FollowersResponse, error) + GetFollowing(ctx context.Context, userID int, limit *int, offset *int) (*FollowingResponse, error) + GetSubscriptionNotifications(ctx context.Context, unreadOnly *bool, limit *int, offset *int) (*NotificationsResponse, error) } type SessionResolver interface { StartedAt(ctx context.Context, obj *domain.Session) (string, error) @@ -259,6 +338,12 @@ type UserResolver interface { EmailConfirmedAt(ctx context.Context, obj *domain.User) (*string, error) CreatedAt(ctx context.Context, obj *domain.User) (string, error) UpdatedAt(ctx context.Context, obj *domain.User) (string, error) + FollowersCount(ctx context.Context, obj *domain.User) (int, error) + FollowingCount(ctx context.Context, obj *domain.User) (int, error) + IsFollowing(ctx context.Context, obj *domain.User, userID int) (bool, error) + Followers(ctx context.Context, obj *domain.User, limit *int, offset *int) (*FollowersResponse, error) + Following(ctx context.Context, obj *domain.User, limit *int, offset *int) (*FollowingResponse, error) + SubscriptionNotifications(ctx context.Context, obj *domain.User, unreadOnly *bool, limit *int, offset *int) (*NotificationsResponse, error) } type executableSchema struct { @@ -399,6 +484,104 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Device.UserAgent(childComplexity), true + case "FollowResult.message": + if e.complexity.FollowResult.Message == nil { + break + } + + return e.complexity.FollowResult.Message(childComplexity), true + + case "FollowResult.success": + if e.complexity.FollowResult.Success == nil { + break + } + + return e.complexity.FollowResult.Success(childComplexity), true + + case "Follower.avatar": + if e.complexity.Follower.Avatar == nil { + break + } + + return e.complexity.Follower.Avatar(childComplexity), true + + case "Follower.createdAt": + if e.complexity.Follower.CreatedAt == nil { + break + } + + return e.complexity.Follower.CreatedAt(childComplexity), true + + case "Follower.userId": + if e.complexity.Follower.UserID == nil { + break + } + + return e.complexity.Follower.UserID(childComplexity), true + + case "Follower.username": + if e.complexity.Follower.Username == nil { + break + } + + return e.complexity.Follower.Username(childComplexity), true + + case "FollowersResponse.followers": + if e.complexity.FollowersResponse.Followers == nil { + break + } + + return e.complexity.FollowersResponse.Followers(childComplexity), true + + case "FollowersResponse.totalCount": + if e.complexity.FollowersResponse.TotalCount == nil { + break + } + + return e.complexity.FollowersResponse.TotalCount(childComplexity), true + + case "Following.avatar": + if e.complexity.Following.Avatar == nil { + break + } + + return e.complexity.Following.Avatar(childComplexity), true + + case "Following.createdAt": + if e.complexity.Following.CreatedAt == nil { + break + } + + return e.complexity.Following.CreatedAt(childComplexity), true + + case "Following.userId": + if e.complexity.Following.UserID == nil { + break + } + + return e.complexity.Following.UserID(childComplexity), true + + case "Following.username": + if e.complexity.Following.Username == nil { + break + } + + return e.complexity.Following.Username(childComplexity), true + + case "FollowingResponse.following": + if e.complexity.FollowingResponse.Following == nil { + break + } + + return e.complexity.FollowingResponse.Following(childComplexity), true + + case "FollowingResponse.totalCount": + if e.complexity.FollowingResponse.TotalCount == nil { + break + } + + return e.complexity.FollowingResponse.TotalCount(childComplexity), true + case "Like.createdAt": if e.complexity.Like.CreatedAt == nil { break @@ -427,6 +610,20 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Like.User(childComplexity), true + case "MarkNotificationReadResult.message": + if e.complexity.MarkNotificationReadResult.Message == nil { + break + } + + return e.complexity.MarkNotificationReadResult.Message(childComplexity), true + + case "MarkNotificationReadResult.success": + if e.complexity.MarkNotificationReadResult.Success == nil { + break + } + + return e.complexity.MarkNotificationReadResult.Success(childComplexity), true + case "Message.chatId": if e.complexity.Message.ChatID == nil { break @@ -548,6 +745,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Mutation.DeletePost(childComplexity, args["id"].(int)), true + case "Mutation.followUser": + if e.complexity.Mutation.FollowUser == nil { + break + } + + args, err := ec.field_Mutation_followUser_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.FollowUser(childComplexity, args["followingId"].(int)), true + case "Mutation.likePost": if e.complexity.Mutation.LikePost == nil { break @@ -572,6 +781,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Mutation.Login(childComplexity, args["input"].(domain.LoginInput)), true + case "Mutation.markNotificationAsRead": + if e.complexity.Mutation.MarkNotificationAsRead == nil { + break + } + + args, err := ec.field_Mutation_markNotificationAsRead_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.MarkNotificationAsRead(childComplexity, args["notificationId"].(int)), true + case "Mutation.refreshTokens": if e.complexity.Mutation.RefreshTokens == nil { break @@ -646,6 +867,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Mutation.TerminateSession(childComplexity, args["sessionId"].(int)), true + case "Mutation.unfollowUser": + if e.complexity.Mutation.UnfollowUser == nil { + break + } + + args, err := ec.field_Mutation_unfollowUser_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UnfollowUser(childComplexity, args["followingId"].(int)), true + case "Mutation.unlikePost": if e.complexity.Mutation.UnlikePost == nil { break @@ -682,6 +915,27 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Mutation.UpdateProfile(childComplexity, args["username"].(string), args["email"].(string), args["avatar"].(string)), true + case "NotificationsResponse.notifications": + if e.complexity.NotificationsResponse.Notifications == nil { + break + } + + return e.complexity.NotificationsResponse.Notifications(childComplexity), true + + case "NotificationsResponse.totalCount": + if e.complexity.NotificationsResponse.TotalCount == nil { + break + } + + return e.complexity.NotificationsResponse.TotalCount(childComplexity), true + + case "NotificationsResponse.unreadCount": + if e.complexity.NotificationsResponse.UnreadCount == nil { + break + } + + return e.complexity.NotificationsResponse.UnreadCount(childComplexity), true + case "Post.author": if e.complexity.Post.Author == nil { break @@ -788,6 +1042,66 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Query.GetChatMessages(childComplexity, args["chatId"].(int), args["limit"].(int), args["offset"].(int)), true + case "Query.getFollowers": + if e.complexity.Query.GetFollowers == nil { + break + } + + args, err := ec.field_Query_getFollowers_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.GetFollowers(childComplexity, args["userId"].(int), args["limit"].(*int), args["offset"].(*int)), true + + case "Query.getFollowersCount": + if e.complexity.Query.GetFollowersCount == nil { + break + } + + args, err := ec.field_Query_getFollowersCount_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.GetFollowersCount(childComplexity, args["userId"].(int)), true + + case "Query.getFollowing": + if e.complexity.Query.GetFollowing == nil { + break + } + + args, err := ec.field_Query_getFollowing_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.GetFollowing(childComplexity, args["userId"].(int), args["limit"].(*int), args["offset"].(*int)), true + + case "Query.getFollowingCount": + if e.complexity.Query.GetFollowingCount == nil { + break + } + + args, err := ec.field_Query_getFollowingCount_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.GetFollowingCount(childComplexity, args["userId"].(int)), true + + case "Query.getSubscriptionNotifications": + if e.complexity.Query.GetSubscriptionNotifications == nil { + break + } + + args, err := ec.field_Query_getSubscriptionNotifications_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.GetSubscriptionNotifications(childComplexity, args["unreadOnly"].(*bool), args["limit"].(*int), args["offset"].(*int)), true + case "Query.getUserChats": if e.complexity.Query.GetUserChats == nil { break @@ -812,6 +1126,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Query.GetUserPosts(childComplexity, args["userId"].(int)), true + case "Query.isFollowing": + if e.complexity.Query.IsFollowing == nil { + break + } + + args, err := ec.field_Query_isFollowing_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Query.IsFollowing(childComplexity, args["followingId"].(int)), true + case "Query.me": if e.complexity.Query.Me == nil { break @@ -911,6 +1237,55 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Subscription.MessageStream(childComplexity, args["userId"].(int)), true + case "SubscriptionNotification.createdAt": + if e.complexity.SubscriptionNotification.CreatedAt == nil { + break + } + + return e.complexity.SubscriptionNotification.CreatedAt(childComplexity), true + + case "SubscriptionNotification.expiresAt": + if e.complexity.SubscriptionNotification.ExpiresAt == nil { + break + } + + return e.complexity.SubscriptionNotification.ExpiresAt(childComplexity), true + + case "SubscriptionNotification.followerAvatar": + if e.complexity.SubscriptionNotification.FollowerAvatar == nil { + break + } + + return e.complexity.SubscriptionNotification.FollowerAvatar(childComplexity), true + + case "SubscriptionNotification.followerId": + if e.complexity.SubscriptionNotification.FollowerID == nil { + break + } + + return e.complexity.SubscriptionNotification.FollowerID(childComplexity), true + + case "SubscriptionNotification.followerUsername": + if e.complexity.SubscriptionNotification.FollowerUsername == nil { + break + } + + return e.complexity.SubscriptionNotification.FollowerUsername(childComplexity), true + + case "SubscriptionNotification.id": + if e.complexity.SubscriptionNotification.ID == nil { + break + } + + return e.complexity.SubscriptionNotification.ID(childComplexity), true + + case "SubscriptionNotification.isRead": + if e.complexity.SubscriptionNotification.IsRead == nil { + break + } + + return e.complexity.SubscriptionNotification.IsRead(childComplexity), true + case "Tokens.accessToken": if e.complexity.Tokens.AccessToken == nil { break @@ -946,6 +1321,20 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Tokens.RefreshTokenExpires(childComplexity), true + case "UnfollowResult.message": + if e.complexity.UnfollowResult.Message == nil { + break + } + + return e.complexity.UnfollowResult.Message(childComplexity), true + + case "UnfollowResult.success": + if e.complexity.UnfollowResult.Success == nil { + break + } + + return e.complexity.UnfollowResult.Success(childComplexity), true + case "User.avatar": if e.complexity.User.Avatar == nil { break @@ -974,6 +1363,44 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.User.EmailConfirmedAt(childComplexity), true + case "User.followers": + if e.complexity.User.Followers == nil { + break + } + + args, err := ec.field_User_followers_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.User.Followers(childComplexity, args["limit"].(*int), args["offset"].(*int)), true + + case "User.followersCount": + if e.complexity.User.FollowersCount == nil { + break + } + + return e.complexity.User.FollowersCount(childComplexity), true + + case "User.following": + if e.complexity.User.Following == nil { + break + } + + args, err := ec.field_User_following_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.User.Following(childComplexity, args["limit"].(*int), args["offset"].(*int)), true + + case "User.followingCount": + if e.complexity.User.FollowingCount == nil { + break + } + + return e.complexity.User.FollowingCount(childComplexity), true + case "User.id": if e.complexity.User.ID == nil { break @@ -981,6 +1408,30 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.User.ID(childComplexity), true + case "User.isFollowing": + if e.complexity.User.IsFollowing == nil { + break + } + + args, err := ec.field_User_isFollowing_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.User.IsFollowing(childComplexity, args["userId"].(int)), true + + case "User.subscriptionNotifications": + if e.complexity.User.SubscriptionNotifications == nil { + break + } + + args, err := ec.field_User_subscriptionNotifications_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.User.SubscriptionNotifications(childComplexity, args["unreadOnly"].(*bool), args["limit"].(*int), args["offset"].(*int)), true + case "User.updatedAt": if e.complexity.User.UpdatedAt == nil { break @@ -1244,6 +1695,17 @@ func (ec *executionContext) field_Mutation_deletePost_args(ctx context.Context, return args, nil } +func (ec *executionContext) field_Mutation_followUser_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := processArgField(ctx, rawArgs, "followingId", ec.unmarshalNInt2int) + if err != nil { + return nil, err + } + args["followingId"] = arg0 + return args, nil +} + func (ec *executionContext) field_Mutation_likePost_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -1266,6 +1728,17 @@ func (ec *executionContext) field_Mutation_login_args(ctx context.Context, rawAr return args, nil } +func (ec *executionContext) field_Mutation_markNotificationAsRead_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := processArgField(ctx, rawArgs, "notificationId", ec.unmarshalNInt2int) + if err != nil { + return nil, err + } + args["notificationId"] = arg0 + return args, nil +} + func (ec *executionContext) field_Mutation_refreshTokens_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -1331,6 +1804,17 @@ func (ec *executionContext) field_Mutation_terminateSession_args(ctx context.Con return args, nil } +func (ec *executionContext) field_Mutation_unfollowUser_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := processArgField(ctx, rawArgs, "followingId", ec.unmarshalNInt2int) + if err != nil { + return nil, err + } + args["followingId"] = arg0 + return args, nil +} + func (ec *executionContext) field_Mutation_unlikePost_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -1438,6 +1922,91 @@ func (ec *executionContext) field_Query_getChat_args(ctx context.Context, rawArg return args, nil } +func (ec *executionContext) field_Query_getFollowersCount_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := processArgField(ctx, rawArgs, "userId", ec.unmarshalNInt2int) + if err != nil { + return nil, err + } + args["userId"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_getFollowers_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := processArgField(ctx, rawArgs, "userId", ec.unmarshalNInt2int) + if err != nil { + return nil, err + } + args["userId"] = arg0 + arg1, err := processArgField(ctx, rawArgs, "limit", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["limit"] = arg1 + arg2, err := processArgField(ctx, rawArgs, "offset", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["offset"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Query_getFollowingCount_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := processArgField(ctx, rawArgs, "userId", ec.unmarshalNInt2int) + if err != nil { + return nil, err + } + args["userId"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Query_getFollowing_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := processArgField(ctx, rawArgs, "userId", ec.unmarshalNInt2int) + if err != nil { + return nil, err + } + args["userId"] = arg0 + arg1, err := processArgField(ctx, rawArgs, "limit", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["limit"] = arg1 + arg2, err := processArgField(ctx, rawArgs, "offset", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["offset"] = arg2 + return args, nil +} + +func (ec *executionContext) field_Query_getSubscriptionNotifications_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := processArgField(ctx, rawArgs, "unreadOnly", ec.unmarshalOBoolean2ᚖbool) + if err != nil { + return nil, err + } + args["unreadOnly"] = arg0 + arg1, err := processArgField(ctx, rawArgs, "limit", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["limit"] = arg1 + arg2, err := processArgField(ctx, rawArgs, "offset", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["offset"] = arg2 + return args, nil +} + func (ec *executionContext) field_Query_getUserChats_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -1460,6 +2029,17 @@ func (ec *executionContext) field_Query_getUserPosts_args(ctx context.Context, r return args, nil } +func (ec *executionContext) field_Query_isFollowing_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := processArgField(ctx, rawArgs, "followingId", ec.unmarshalNInt2int) + if err != nil { + return nil, err + } + args["followingId"] = arg0 + return args, nil +} + func (ec *executionContext) field_Query_post_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -1493,6 +2073,70 @@ func (ec *executionContext) field_Subscription_messageStream_args(ctx context.Co return args, nil } +func (ec *executionContext) field_User_followers_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := processArgField(ctx, rawArgs, "limit", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["limit"] = arg0 + arg1, err := processArgField(ctx, rawArgs, "offset", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["offset"] = arg1 + return args, nil +} + +func (ec *executionContext) field_User_following_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := processArgField(ctx, rawArgs, "limit", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["limit"] = arg0 + arg1, err := processArgField(ctx, rawArgs, "offset", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["offset"] = arg1 + return args, nil +} + +func (ec *executionContext) field_User_isFollowing_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := processArgField(ctx, rawArgs, "userId", ec.unmarshalNInt2int) + if err != nil { + return nil, err + } + args["userId"] = arg0 + return args, nil +} + +func (ec *executionContext) field_User_subscriptionNotifications_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := processArgField(ctx, rawArgs, "unreadOnly", ec.unmarshalOBoolean2ᚖbool) + if err != nil { + return nil, err + } + args["unreadOnly"] = arg0 + arg1, err := processArgField(ctx, rawArgs, "limit", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["limit"] = arg1 + arg2, err := processArgField(ctx, rawArgs, "offset", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["offset"] = arg2 + return args, nil +} + func (ec *executionContext) field___Directive_args_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -2029,6 +2673,18 @@ func (ec *executionContext) fieldContext_Comment_author(_ context.Context, field return ec.fieldContext_User_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_User_updatedAt(ctx, field) + case "followersCount": + return ec.fieldContext_User_followersCount(ctx, field) + case "followingCount": + return ec.fieldContext_User_followingCount(ctx, field) + case "isFollowing": + return ec.fieldContext_User_isFollowing(ctx, field) + case "followers": + return ec.fieldContext_User_followers(ctx, field) + case "following": + return ec.fieldContext_User_following(ctx, field) + case "subscriptionNotifications": + return ec.fieldContext_User_subscriptionNotifications(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type User", field.Name) }, @@ -2344,6 +3000,642 @@ func (ec *executionContext) fieldContext_Device_lastActiveAt(_ context.Context, return fc, nil } +func (ec *executionContext) _FollowResult_success(ctx context.Context, field graphql.CollectedField, obj *FollowResult) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_FollowResult_success(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Success, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_FollowResult_success(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "FollowResult", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _FollowResult_message(ctx context.Context, field graphql.CollectedField, obj *FollowResult) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_FollowResult_message(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Message, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_FollowResult_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "FollowResult", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Follower_userId(ctx context.Context, field graphql.CollectedField, obj *Follower) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Follower_userId(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.UserID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Follower_userId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Follower", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Follower_username(ctx context.Context, field graphql.CollectedField, obj *Follower) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Follower_username(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Username, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Follower_username(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Follower", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Follower_avatar(ctx context.Context, field graphql.CollectedField, obj *Follower) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Follower_avatar(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Avatar, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Follower_avatar(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Follower", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Follower_createdAt(ctx context.Context, field graphql.CollectedField, obj *Follower) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Follower_createdAt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedAt, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Follower_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Follower", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _FollowersResponse_followers(ctx context.Context, field graphql.CollectedField, obj *FollowersResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_FollowersResponse_followers(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Followers, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*Follower) + fc.Result = res + return ec.marshalNFollower2ᚕᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐFollowerᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_FollowersResponse_followers(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "FollowersResponse", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "userId": + return ec.fieldContext_Follower_userId(ctx, field) + case "username": + return ec.fieldContext_Follower_username(ctx, field) + case "avatar": + return ec.fieldContext_Follower_avatar(ctx, field) + case "createdAt": + return ec.fieldContext_Follower_createdAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Follower", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _FollowersResponse_totalCount(ctx context.Context, field graphql.CollectedField, obj *FollowersResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_FollowersResponse_totalCount(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.TotalCount, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_FollowersResponse_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "FollowersResponse", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Following_userId(ctx context.Context, field graphql.CollectedField, obj *Following) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Following_userId(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.UserID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Following_userId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Following", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Following_username(ctx context.Context, field graphql.CollectedField, obj *Following) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Following_username(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Username, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Following_username(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Following", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Following_avatar(ctx context.Context, field graphql.CollectedField, obj *Following) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Following_avatar(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Avatar, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Following_avatar(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Following", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Following_createdAt(ctx context.Context, field graphql.CollectedField, obj *Following) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Following_createdAt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedAt, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Following_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Following", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _FollowingResponse_following(ctx context.Context, field graphql.CollectedField, obj *FollowingResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_FollowingResponse_following(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Following, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*Following) + fc.Result = res + return ec.marshalNFollowing2ᚕᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐFollowingᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_FollowingResponse_following(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "FollowingResponse", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "userId": + return ec.fieldContext_Following_userId(ctx, field) + case "username": + return ec.fieldContext_Following_username(ctx, field) + case "avatar": + return ec.fieldContext_Following_avatar(ctx, field) + case "createdAt": + return ec.fieldContext_Following_createdAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Following", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _FollowingResponse_totalCount(ctx context.Context, field graphql.CollectedField, obj *FollowingResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_FollowingResponse_totalCount(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.TotalCount, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_FollowingResponse_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "FollowingResponse", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _Like_id(ctx context.Context, field graphql.CollectedField, obj *domain.Like) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Like_id(ctx, field) if err != nil { @@ -2507,6 +3799,18 @@ func (ec *executionContext) fieldContext_Like_user(_ context.Context, field grap return ec.fieldContext_User_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_User_updatedAt(ctx, field) + case "followersCount": + return ec.fieldContext_User_followersCount(ctx, field) + case "followingCount": + return ec.fieldContext_User_followingCount(ctx, field) + case "isFollowing": + return ec.fieldContext_User_isFollowing(ctx, field) + case "followers": + return ec.fieldContext_User_followers(ctx, field) + case "following": + return ec.fieldContext_User_following(ctx, field) + case "subscriptionNotifications": + return ec.fieldContext_User_subscriptionNotifications(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type User", field.Name) }, @@ -2558,6 +3862,94 @@ func (ec *executionContext) fieldContext_Like_createdAt(_ context.Context, field return fc, nil } +func (ec *executionContext) _MarkNotificationReadResult_success(ctx context.Context, field graphql.CollectedField, obj *MarkNotificationReadResult) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MarkNotificationReadResult_success(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Success, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_MarkNotificationReadResult_success(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "MarkNotificationReadResult", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _MarkNotificationReadResult_message(ctx context.Context, field graphql.CollectedField, obj *MarkNotificationReadResult) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_MarkNotificationReadResult_message(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Message, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_MarkNotificationReadResult_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "MarkNotificationReadResult", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _Message_id(ctx context.Context, field graphql.CollectedField, obj *domain.Message) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Message_id(ctx, field) if err != nil { @@ -2919,6 +4311,18 @@ func (ec *executionContext) fieldContext_Mutation_register(ctx context.Context, return ec.fieldContext_User_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_User_updatedAt(ctx, field) + case "followersCount": + return ec.fieldContext_User_followersCount(ctx, field) + case "followingCount": + return ec.fieldContext_User_followingCount(ctx, field) + case "isFollowing": + return ec.fieldContext_User_isFollowing(ctx, field) + case "followers": + return ec.fieldContext_User_followers(ctx, field) + case "following": + return ec.fieldContext_User_following(ctx, field) + case "subscriptionNotifications": + return ec.fieldContext_User_subscriptionNotifications(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type User", field.Name) }, @@ -3390,6 +4794,18 @@ func (ec *executionContext) fieldContext_Mutation_updateProfile(ctx context.Cont return ec.fieldContext_User_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_User_updatedAt(ctx, field) + case "followersCount": + return ec.fieldContext_User_followersCount(ctx, field) + case "followingCount": + return ec.fieldContext_User_followingCount(ctx, field) + case "isFollowing": + return ec.fieldContext_User_isFollowing(ctx, field) + case "followers": + return ec.fieldContext_User_followers(ctx, field) + case "following": + return ec.fieldContext_User_following(ctx, field) + case "subscriptionNotifications": + return ec.fieldContext_User_subscriptionNotifications(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type User", field.Name) }, @@ -3994,6 +5410,337 @@ func (ec *executionContext) fieldContext_Mutation_deletePost(ctx context.Context return fc, nil } +func (ec *executionContext) _Mutation_followUser(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_followUser(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().FollowUser(rctx, fc.Args["followingId"].(int)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*FollowResult) + fc.Result = res + return ec.marshalNFollowResult2ᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐFollowResult(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_followUser(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "success": + return ec.fieldContext_FollowResult_success(ctx, field) + case "message": + return ec.fieldContext_FollowResult_message(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type FollowResult", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_followUser_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_unfollowUser(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_unfollowUser(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UnfollowUser(rctx, fc.Args["followingId"].(int)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*UnfollowResult) + fc.Result = res + return ec.marshalNUnfollowResult2ᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐUnfollowResult(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_unfollowUser(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "success": + return ec.fieldContext_UnfollowResult_success(ctx, field) + case "message": + return ec.fieldContext_UnfollowResult_message(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UnfollowResult", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_unfollowUser_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_markNotificationAsRead(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_markNotificationAsRead(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().MarkNotificationAsRead(rctx, fc.Args["notificationId"].(int)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*MarkNotificationReadResult) + fc.Result = res + return ec.marshalNMarkNotificationReadResult2ᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐMarkNotificationReadResult(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_markNotificationAsRead(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "success": + return ec.fieldContext_MarkNotificationReadResult_success(ctx, field) + case "message": + return ec.fieldContext_MarkNotificationReadResult_message(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type MarkNotificationReadResult", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_markNotificationAsRead_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _NotificationsResponse_notifications(ctx context.Context, field graphql.CollectedField, obj *NotificationsResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NotificationsResponse_notifications(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Notifications, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.([]*SubscriptionNotification) + fc.Result = res + return ec.marshalNSubscriptionNotification2ᚕᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐSubscriptionNotificationᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NotificationsResponse_notifications(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NotificationsResponse", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_SubscriptionNotification_id(ctx, field) + case "followerId": + return ec.fieldContext_SubscriptionNotification_followerId(ctx, field) + case "followerUsername": + return ec.fieldContext_SubscriptionNotification_followerUsername(ctx, field) + case "followerAvatar": + return ec.fieldContext_SubscriptionNotification_followerAvatar(ctx, field) + case "isRead": + return ec.fieldContext_SubscriptionNotification_isRead(ctx, field) + case "createdAt": + return ec.fieldContext_SubscriptionNotification_createdAt(ctx, field) + case "expiresAt": + return ec.fieldContext_SubscriptionNotification_expiresAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type SubscriptionNotification", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _NotificationsResponse_totalCount(ctx context.Context, field graphql.CollectedField, obj *NotificationsResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NotificationsResponse_totalCount(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.TotalCount, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NotificationsResponse_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NotificationsResponse", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _NotificationsResponse_unreadCount(ctx context.Context, field graphql.CollectedField, obj *NotificationsResponse) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_NotificationsResponse_unreadCount(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.UnreadCount, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_NotificationsResponse_unreadCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "NotificationsResponse", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _Post_id(ctx context.Context, field graphql.CollectedField, obj *domain.Post) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Post_id(ctx, field) if err != nil { @@ -4179,6 +5926,18 @@ func (ec *executionContext) fieldContext_Post_author(_ context.Context, field gr return ec.fieldContext_User_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_User_updatedAt(ctx, field) + case "followersCount": + return ec.fieldContext_User_followersCount(ctx, field) + case "followingCount": + return ec.fieldContext_User_followingCount(ctx, field) + case "isFollowing": + return ec.fieldContext_User_isFollowing(ctx, field) + case "followers": + return ec.fieldContext_User_followers(ctx, field) + case "following": + return ec.fieldContext_User_following(ctx, field) + case "subscriptionNotifications": + return ec.fieldContext_User_subscriptionNotifications(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type User", field.Name) }, @@ -4513,6 +6272,18 @@ func (ec *executionContext) fieldContext_Query_me(_ context.Context, field graph return ec.fieldContext_User_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_User_updatedAt(ctx, field) + case "followersCount": + return ec.fieldContext_User_followersCount(ctx, field) + case "followingCount": + return ec.fieldContext_User_followingCount(ctx, field) + case "isFollowing": + return ec.fieldContext_User_isFollowing(ctx, field) + case "followers": + return ec.fieldContext_User_followers(ctx, field) + case "following": + return ec.fieldContext_User_following(ctx, field) + case "subscriptionNotifications": + return ec.fieldContext_User_subscriptionNotifications(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type User", field.Name) }, @@ -4793,6 +6564,18 @@ func (ec *executionContext) fieldContext_Query_user(ctx context.Context, field g return ec.fieldContext_User_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_User_updatedAt(ctx, field) + case "followersCount": + return ec.fieldContext_User_followersCount(ctx, field) + case "followingCount": + return ec.fieldContext_User_followingCount(ctx, field) + case "isFollowing": + return ec.fieldContext_User_isFollowing(ctx, field) + case "followers": + return ec.fieldContext_User_followers(ctx, field) + case "following": + return ec.fieldContext_User_following(ctx, field) + case "subscriptionNotifications": + return ec.fieldContext_User_subscriptionNotifications(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type User", field.Name) }, @@ -4864,6 +6647,18 @@ func (ec *executionContext) fieldContext_Query_users(_ context.Context, field gr return ec.fieldContext_User_createdAt(ctx, field) case "updatedAt": return ec.fieldContext_User_updatedAt(ctx, field) + case "followersCount": + return ec.fieldContext_User_followersCount(ctx, field) + case "followingCount": + return ec.fieldContext_User_followingCount(ctx, field) + case "isFollowing": + return ec.fieldContext_User_isFollowing(ctx, field) + case "followers": + return ec.fieldContext_User_followers(ctx, field) + case "following": + return ec.fieldContext_User_following(ctx, field) + case "subscriptionNotifications": + return ec.fieldContext_User_subscriptionNotifications(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type User", field.Name) }, @@ -5205,6 +7000,356 @@ func (ec *executionContext) fieldContext_Query_comments(ctx context.Context, fie return fc, nil } +func (ec *executionContext) _Query_getFollowersCount(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_getFollowersCount(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().GetFollowersCount(rctx, fc.Args["userId"].(int)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_getFollowersCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_getFollowersCount_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_getFollowingCount(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_getFollowingCount(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().GetFollowingCount(rctx, fc.Args["userId"].(int)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_getFollowingCount(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_getFollowingCount_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_isFollowing(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_isFollowing(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().IsFollowing(rctx, fc.Args["followingId"].(int)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_isFollowing(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_isFollowing_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_getFollowers(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_getFollowers(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().GetFollowers(rctx, fc.Args["userId"].(int), fc.Args["limit"].(*int), fc.Args["offset"].(*int)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*FollowersResponse) + fc.Result = res + return ec.marshalNFollowersResponse2ᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐFollowersResponse(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_getFollowers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "followers": + return ec.fieldContext_FollowersResponse_followers(ctx, field) + case "totalCount": + return ec.fieldContext_FollowersResponse_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type FollowersResponse", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_getFollowers_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_getFollowing(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_getFollowing(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().GetFollowing(rctx, fc.Args["userId"].(int), fc.Args["limit"].(*int), fc.Args["offset"].(*int)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*FollowingResponse) + fc.Result = res + return ec.marshalNFollowingResponse2ᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐFollowingResponse(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_getFollowing(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "following": + return ec.fieldContext_FollowingResponse_following(ctx, field) + case "totalCount": + return ec.fieldContext_FollowingResponse_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type FollowingResponse", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_getFollowing_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_getSubscriptionNotifications(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_getSubscriptionNotifications(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().GetSubscriptionNotifications(rctx, fc.Args["unreadOnly"].(*bool), fc.Args["limit"].(*int), fc.Args["offset"].(*int)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*NotificationsResponse) + fc.Result = res + return ec.marshalNNotificationsResponse2ᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐNotificationsResponse(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_getSubscriptionNotifications(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "notifications": + return ec.fieldContext_NotificationsResponse_notifications(ctx, field) + case "totalCount": + return ec.fieldContext_NotificationsResponse_totalCount(ctx, field) + case "unreadCount": + return ec.fieldContext_NotificationsResponse_unreadCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type NotificationsResponse", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_getSubscriptionNotifications_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query___type(ctx, field) if err != nil { @@ -5653,6 +7798,314 @@ func (ec *executionContext) fieldContext_Subscription_messageStream(ctx context. return fc, nil } +func (ec *executionContext) _SubscriptionNotification_id(ctx context.Context, field graphql.CollectedField, obj *SubscriptionNotification) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SubscriptionNotification_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.ID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SubscriptionNotification_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SubscriptionNotification", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _SubscriptionNotification_followerId(ctx context.Context, field graphql.CollectedField, obj *SubscriptionNotification) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SubscriptionNotification_followerId(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.FollowerID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SubscriptionNotification_followerId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SubscriptionNotification", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _SubscriptionNotification_followerUsername(ctx context.Context, field graphql.CollectedField, obj *SubscriptionNotification) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SubscriptionNotification_followerUsername(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.FollowerUsername, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SubscriptionNotification_followerUsername(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SubscriptionNotification", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _SubscriptionNotification_followerAvatar(ctx context.Context, field graphql.CollectedField, obj *SubscriptionNotification) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SubscriptionNotification_followerAvatar(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.FollowerAvatar, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SubscriptionNotification_followerAvatar(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SubscriptionNotification", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _SubscriptionNotification_isRead(ctx context.Context, field graphql.CollectedField, obj *SubscriptionNotification) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SubscriptionNotification_isRead(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.IsRead, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SubscriptionNotification_isRead(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SubscriptionNotification", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _SubscriptionNotification_createdAt(ctx context.Context, field graphql.CollectedField, obj *SubscriptionNotification) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SubscriptionNotification_createdAt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedAt, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SubscriptionNotification_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SubscriptionNotification", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _SubscriptionNotification_expiresAt(ctx context.Context, field graphql.CollectedField, obj *SubscriptionNotification) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SubscriptionNotification_expiresAt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.ExpiresAt, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_SubscriptionNotification_expiresAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "SubscriptionNotification", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _Tokens_accessToken(ctx context.Context, field graphql.CollectedField, obj *domain.Tokens) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Tokens_accessToken(ctx, field) if err != nil { @@ -5873,6 +8326,94 @@ func (ec *executionContext) fieldContext_Tokens_emailConfirmed(_ context.Context return fc, nil } +func (ec *executionContext) _UnfollowResult_success(ctx context.Context, field graphql.CollectedField, obj *UnfollowResult) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UnfollowResult_success(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Success, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UnfollowResult_success(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UnfollowResult", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _UnfollowResult_message(ctx context.Context, field graphql.CollectedField, obj *UnfollowResult) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UnfollowResult_message(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Message, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UnfollowResult_message(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UnfollowResult", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *domain.User) (ret graphql.Marshaler) { fc, err := ec.fieldContext_User_id(ctx, field) if err != nil { @@ -6178,6 +8719,334 @@ func (ec *executionContext) fieldContext_User_updatedAt(_ context.Context, field return fc, nil } +func (ec *executionContext) _User_followersCount(ctx context.Context, field graphql.CollectedField, obj *domain.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_followersCount(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.User().FollowersCount(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_followersCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _User_followingCount(ctx context.Context, field graphql.CollectedField, obj *domain.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_followingCount(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.User().FollowingCount(rctx, obj) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(int) + fc.Result = res + return ec.marshalNInt2int(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_followingCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Int does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _User_isFollowing(ctx context.Context, field graphql.CollectedField, obj *domain.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_isFollowing(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.User().IsFollowing(rctx, obj, fc.Args["userId"].(int)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(bool) + fc.Result = res + return ec.marshalNBoolean2bool(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_isFollowing(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Boolean does not have child fields") + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_User_isFollowing_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _User_followers(ctx context.Context, field graphql.CollectedField, obj *domain.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_followers(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.User().Followers(rctx, obj, fc.Args["limit"].(*int), fc.Args["offset"].(*int)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*FollowersResponse) + fc.Result = res + return ec.marshalNFollowersResponse2ᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐFollowersResponse(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_followers(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "followers": + return ec.fieldContext_FollowersResponse_followers(ctx, field) + case "totalCount": + return ec.fieldContext_FollowersResponse_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type FollowersResponse", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_User_followers_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _User_following(ctx context.Context, field graphql.CollectedField, obj *domain.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_following(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.User().Following(rctx, obj, fc.Args["limit"].(*int), fc.Args["offset"].(*int)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*FollowingResponse) + fc.Result = res + return ec.marshalNFollowingResponse2ᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐFollowingResponse(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_following(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "following": + return ec.fieldContext_FollowingResponse_following(ctx, field) + case "totalCount": + return ec.fieldContext_FollowingResponse_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type FollowingResponse", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_User_following_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _User_subscriptionNotifications(ctx context.Context, field graphql.CollectedField, obj *domain.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_subscriptionNotifications(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.User().SubscriptionNotifications(rctx, obj, fc.Args["unreadOnly"].(*bool), fc.Args["limit"].(*int), fc.Args["offset"].(*int)) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*NotificationsResponse) + fc.Result = res + return ec.marshalNNotificationsResponse2ᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐNotificationsResponse(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_User_subscriptionNotifications(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "notifications": + return ec.fieldContext_NotificationsResponse_notifications(ctx, field) + case "totalCount": + return ec.fieldContext_NotificationsResponse_totalCount(ctx, field) + case "unreadCount": + return ec.fieldContext_NotificationsResponse_unreadCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type NotificationsResponse", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_User_subscriptionNotifications_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Directive_name(ctx, field) if err != nil { @@ -8613,6 +11482,246 @@ func (ec *executionContext) _Device(ctx context.Context, sel ast.SelectionSet, o return out } +var followResultImplementors = []string{"FollowResult"} + +func (ec *executionContext) _FollowResult(ctx context.Context, sel ast.SelectionSet, obj *FollowResult) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, followResultImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("FollowResult") + case "success": + out.Values[i] = ec._FollowResult_success(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "message": + out.Values[i] = ec._FollowResult_message(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var followerImplementors = []string{"Follower"} + +func (ec *executionContext) _Follower(ctx context.Context, sel ast.SelectionSet, obj *Follower) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, followerImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Follower") + case "userId": + out.Values[i] = ec._Follower_userId(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "username": + out.Values[i] = ec._Follower_username(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "avatar": + out.Values[i] = ec._Follower_avatar(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createdAt": + out.Values[i] = ec._Follower_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var followersResponseImplementors = []string{"FollowersResponse"} + +func (ec *executionContext) _FollowersResponse(ctx context.Context, sel ast.SelectionSet, obj *FollowersResponse) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, followersResponseImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("FollowersResponse") + case "followers": + out.Values[i] = ec._FollowersResponse_followers(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "totalCount": + out.Values[i] = ec._FollowersResponse_totalCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var followingImplementors = []string{"Following"} + +func (ec *executionContext) _Following(ctx context.Context, sel ast.SelectionSet, obj *Following) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, followingImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Following") + case "userId": + out.Values[i] = ec._Following_userId(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "username": + out.Values[i] = ec._Following_username(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "avatar": + out.Values[i] = ec._Following_avatar(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createdAt": + out.Values[i] = ec._Following_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var followingResponseImplementors = []string{"FollowingResponse"} + +func (ec *executionContext) _FollowingResponse(ctx context.Context, sel ast.SelectionSet, obj *FollowingResponse) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, followingResponseImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("FollowingResponse") + case "following": + out.Values[i] = ec._FollowingResponse_following(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "totalCount": + out.Values[i] = ec._FollowingResponse_totalCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + var likeImplementors = []string{"Like"} func (ec *executionContext) _Like(ctx context.Context, sel ast.SelectionSet, obj *domain.Like) graphql.Marshaler { @@ -8760,6 +11869,50 @@ func (ec *executionContext) _Like(ctx context.Context, sel ast.SelectionSet, obj return out } +var markNotificationReadResultImplementors = []string{"MarkNotificationReadResult"} + +func (ec *executionContext) _MarkNotificationReadResult(ctx context.Context, sel ast.SelectionSet, obj *MarkNotificationReadResult) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, markNotificationReadResultImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("MarkNotificationReadResult") + case "success": + out.Values[i] = ec._MarkNotificationReadResult_success(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "message": + out.Values[i] = ec._MarkNotificationReadResult_message(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + var messageImplementors = []string{"Message"} func (ec *executionContext) _Message(ctx context.Context, sel ast.SelectionSet, obj *domain.Message) graphql.Marshaler { @@ -9036,6 +12189,76 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) if out.Values[i] == graphql.Null { out.Invalids++ } + case "followUser": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_followUser(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "unfollowUser": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_unfollowUser(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "markNotificationAsRead": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_markNotificationAsRead(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var notificationsResponseImplementors = []string{"NotificationsResponse"} + +func (ec *executionContext) _NotificationsResponse(ctx context.Context, sel ast.SelectionSet, obj *NotificationsResponse) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, notificationsResponseImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("NotificationsResponse") + case "notifications": + out.Values[i] = ec._NotificationsResponse_notifications(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "totalCount": + out.Values[i] = ec._NotificationsResponse_totalCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "unreadCount": + out.Values[i] = ec._NotificationsResponse_unreadCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -9620,6 +12843,138 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "getFollowersCount": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_getFollowersCount(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "getFollowingCount": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_getFollowingCount(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "isFollowing": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_isFollowing(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "getFollowers": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_getFollowers(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "getFollowing": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_getFollowing(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "getSubscriptionNotifications": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_getSubscriptionNotifications(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "__type": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { @@ -9793,6 +13148,75 @@ func (ec *executionContext) _Subscription(ctx context.Context, sel ast.Selection } } +var subscriptionNotificationImplementors = []string{"SubscriptionNotification"} + +func (ec *executionContext) _SubscriptionNotification(ctx context.Context, sel ast.SelectionSet, obj *SubscriptionNotification) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, subscriptionNotificationImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("SubscriptionNotification") + case "id": + out.Values[i] = ec._SubscriptionNotification_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "followerId": + out.Values[i] = ec._SubscriptionNotification_followerId(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "followerUsername": + out.Values[i] = ec._SubscriptionNotification_followerUsername(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "followerAvatar": + out.Values[i] = ec._SubscriptionNotification_followerAvatar(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "isRead": + out.Values[i] = ec._SubscriptionNotification_isRead(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createdAt": + out.Values[i] = ec._SubscriptionNotification_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "expiresAt": + out.Values[i] = ec._SubscriptionNotification_expiresAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + var tokensImplementors = []string{"Tokens"} func (ec *executionContext) _Tokens(ctx context.Context, sel ast.SelectionSet, obj *domain.Tokens) graphql.Marshaler { @@ -9914,6 +13338,50 @@ func (ec *executionContext) _Tokens(ctx context.Context, sel ast.SelectionSet, o return out } +var unfollowResultImplementors = []string{"UnfollowResult"} + +func (ec *executionContext) _UnfollowResult(ctx context.Context, sel ast.SelectionSet, obj *UnfollowResult) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, unfollowResultImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("UnfollowResult") + case "success": + out.Values[i] = ec._UnfollowResult_success(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "message": + out.Values[i] = ec._UnfollowResult_message(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + var userImplementors = []string{"User"} func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj *domain.User) graphql.Marshaler { @@ -10049,6 +13517,222 @@ func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj continue } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "followersCount": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._User_followersCount(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "followingCount": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._User_followingCount(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "isFollowing": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._User_isFollowing(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "followers": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._User_followers(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "following": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._User_following(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "subscriptionNotifications": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._User_subscriptionNotifications(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) default: panic("unknown field " + strconv.Quote(field.Name)) @@ -10554,6 +14238,156 @@ func (ec *executionContext) marshalNDevice2ᚖtailly_back_v2ᚋinternalᚋdomain return ec._Device(ctx, sel, v) } +func (ec *executionContext) marshalNFollowResult2tailly_back_v2ᚋinternalᚋhttpᚋgraphᚐFollowResult(ctx context.Context, sel ast.SelectionSet, v FollowResult) graphql.Marshaler { + return ec._FollowResult(ctx, sel, &v) +} + +func (ec *executionContext) marshalNFollowResult2ᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐFollowResult(ctx context.Context, sel ast.SelectionSet, v *FollowResult) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._FollowResult(ctx, sel, v) +} + +func (ec *executionContext) marshalNFollower2ᚕᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐFollowerᚄ(ctx context.Context, sel ast.SelectionSet, v []*Follower) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNFollower2ᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐFollower(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNFollower2ᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐFollower(ctx context.Context, sel ast.SelectionSet, v *Follower) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Follower(ctx, sel, v) +} + +func (ec *executionContext) marshalNFollowersResponse2tailly_back_v2ᚋinternalᚋhttpᚋgraphᚐFollowersResponse(ctx context.Context, sel ast.SelectionSet, v FollowersResponse) graphql.Marshaler { + return ec._FollowersResponse(ctx, sel, &v) +} + +func (ec *executionContext) marshalNFollowersResponse2ᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐFollowersResponse(ctx context.Context, sel ast.SelectionSet, v *FollowersResponse) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._FollowersResponse(ctx, sel, v) +} + +func (ec *executionContext) marshalNFollowing2ᚕᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐFollowingᚄ(ctx context.Context, sel ast.SelectionSet, v []*Following) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNFollowing2ᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐFollowing(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNFollowing2ᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐFollowing(ctx context.Context, sel ast.SelectionSet, v *Following) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Following(ctx, sel, v) +} + +func (ec *executionContext) marshalNFollowingResponse2tailly_back_v2ᚋinternalᚋhttpᚋgraphᚐFollowingResponse(ctx context.Context, sel ast.SelectionSet, v FollowingResponse) graphql.Marshaler { + return ec._FollowingResponse(ctx, sel, &v) +} + +func (ec *executionContext) marshalNFollowingResponse2ᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐFollowingResponse(ctx context.Context, sel ast.SelectionSet, v *FollowingResponse) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._FollowingResponse(ctx, sel, v) +} + func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v any) (int, error) { res, err := graphql.UnmarshalInt(v) return res, graphql.ErrorOnPath(ctx, err) @@ -10633,6 +14467,20 @@ func (ec *executionContext) unmarshalNLoginInput2tailly_back_v2ᚋinternalᚋdom return res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) marshalNMarkNotificationReadResult2tailly_back_v2ᚋinternalᚋhttpᚋgraphᚐMarkNotificationReadResult(ctx context.Context, sel ast.SelectionSet, v MarkNotificationReadResult) graphql.Marshaler { + return ec._MarkNotificationReadResult(ctx, sel, &v) +} + +func (ec *executionContext) marshalNMarkNotificationReadResult2ᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐMarkNotificationReadResult(ctx context.Context, sel ast.SelectionSet, v *MarkNotificationReadResult) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._MarkNotificationReadResult(ctx, sel, v) +} + func (ec *executionContext) marshalNMessage2tailly_back_v2ᚋinternalᚋdomainᚐMessage(ctx context.Context, sel ast.SelectionSet, v domain.Message) graphql.Marshaler { return ec._Message(ctx, sel, &v) } @@ -10701,6 +14549,20 @@ func (ec *executionContext) marshalNMessageStatus2tailly_back_v2ᚋinternalᚋht return v } +func (ec *executionContext) marshalNNotificationsResponse2tailly_back_v2ᚋinternalᚋhttpᚋgraphᚐNotificationsResponse(ctx context.Context, sel ast.SelectionSet, v NotificationsResponse) graphql.Marshaler { + return ec._NotificationsResponse(ctx, sel, &v) +} + +func (ec *executionContext) marshalNNotificationsResponse2ᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐNotificationsResponse(ctx context.Context, sel ast.SelectionSet, v *NotificationsResponse) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._NotificationsResponse(ctx, sel, v) +} + func (ec *executionContext) marshalNPost2tailly_back_v2ᚋinternalᚋdomainᚐPost(ctx context.Context, sel ast.SelectionSet, v domain.Post) graphql.Marshaler { return ec._Post(ctx, sel, &v) } @@ -10834,6 +14696,60 @@ func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.S return res } +func (ec *executionContext) marshalNSubscriptionNotification2ᚕᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐSubscriptionNotificationᚄ(ctx context.Context, sel ast.SelectionSet, v []*SubscriptionNotification) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNSubscriptionNotification2ᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐSubscriptionNotification(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNSubscriptionNotification2ᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐSubscriptionNotification(ctx context.Context, sel ast.SelectionSet, v *SubscriptionNotification) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._SubscriptionNotification(ctx, sel, v) +} + func (ec *executionContext) marshalNTokens2tailly_back_v2ᚋinternalᚋdomainᚐTokens(ctx context.Context, sel ast.SelectionSet, v domain.Tokens) graphql.Marshaler { return ec._Tokens(ctx, sel, &v) } @@ -10848,6 +14764,20 @@ func (ec *executionContext) marshalNTokens2ᚖtailly_back_v2ᚋinternalᚋdomain return ec._Tokens(ctx, sel, v) } +func (ec *executionContext) marshalNUnfollowResult2tailly_back_v2ᚋinternalᚋhttpᚋgraphᚐUnfollowResult(ctx context.Context, sel ast.SelectionSet, v UnfollowResult) graphql.Marshaler { + return ec._UnfollowResult(ctx, sel, &v) +} + +func (ec *executionContext) marshalNUnfollowResult2ᚖtailly_back_v2ᚋinternalᚋhttpᚋgraphᚐUnfollowResult(ctx context.Context, sel ast.SelectionSet, v *UnfollowResult) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._UnfollowResult(ctx, sel, v) +} + func (ec *executionContext) marshalNUser2tailly_back_v2ᚋinternalᚋdomainᚐUser(ctx context.Context, sel ast.SelectionSet, v domain.User) graphql.Marshaler { return ec._User(ctx, sel, &v) } @@ -11189,6 +15119,24 @@ func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast return res } +func (ec *executionContext) unmarshalOInt2ᚖint(ctx context.Context, v any) (*int, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalInt(v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOInt2ᚖint(ctx context.Context, sel ast.SelectionSet, v *int) graphql.Marshaler { + if v == nil { + return graphql.Null + } + _ = sel + _ = ctx + res := graphql.MarshalInt(*v) + return res +} + func (ec *executionContext) marshalOMessage2ᚖtailly_back_v2ᚋinternalᚋdomainᚐMessage(ctx context.Context, sel ast.SelectionSet, v *domain.Message) graphql.Marshaler { if v == nil { return graphql.Null diff --git a/internal/http/graph/messages_resolvers.go b/internal/http/graph/messages_resolvers.go index 46aeeb0..4795245 100644 --- a/internal/http/graph/messages_resolvers.go +++ b/internal/http/graph/messages_resolvers.go @@ -5,7 +5,6 @@ import ( "fmt" "log" "tailly_back_v2/internal/domain" - "tailly_back_v2/internal/http/middleware" "tailly_back_v2/proto" "time" ) @@ -19,17 +18,6 @@ type subscriptionResolver struct{ *Resolver } // CreateChat is the resolver for the createChat field. func (r *mutationResolver) CreateChat(ctx context.Context, user1Id int, user2Id int) (*domain.Chat, error) { - start := time.Now() - success := false - - defer func() { - duration := time.Since(start) - middleware.IncGQLOperation("mutation", "createChat", success, duration) - if !success { - middleware.IncError("gql_operation", "createChat", "error") - } - }() - // Просто вызываем gRPC метод, вся логика уже там res, err := r.MessageClient.CreateChat(ctx, &proto.CreateChatRequest{ User1Id: int32(user1Id), @@ -39,24 +27,12 @@ func (r *mutationResolver) CreateChat(ctx context.Context, user1Id int, user2Id return nil, fmt.Errorf("failed to create chat: %w", err) } - success = true // Преобразуем proto-чат в domain-модель return protoChatToDomain(res.Chat), nil } // SendMessage реализация мутации для отправки сообщения func (r *mutationResolver) SendMessage(ctx context.Context, chatID int, content string) (*domain.Message, error) { - start := time.Now() - success := false - - defer func() { - duration := time.Since(start) - middleware.IncGQLOperation("mutation", "sendMessage", success, duration) - if !success { - middleware.IncError("gql_operation", "sendMessage", "error") - } - }() - // Получаем senderID из контекста senderID, err := getUserIDFromContext(ctx) if err != nil { @@ -71,25 +47,11 @@ func (r *mutationResolver) SendMessage(ctx context.Context, chatID int, content if err != nil { return nil, fmt.Errorf("failed to send message: %w", err) } - - success = true - middleware.IncWebSocketMessage("outgoing", "chat_message") return protoMessageToDomain(res.Message), nil } // UpdateMessageStatus реализация мутации для обновления статуса сообщения func (r *mutationResolver) UpdateMessageStatus(ctx context.Context, messageID int, status MessageStatus) (*domain.Message, error) { - start := time.Now() - success := false - - defer func() { - duration := time.Since(start) - middleware.IncGQLOperation("mutation", "updateMessageStatus", success, duration) - if !success { - middleware.IncError("gql_operation", "updateMessageStatus", "error") - } - }() - var statusStr string switch status { case MessageStatusSent: @@ -110,23 +72,11 @@ func (r *mutationResolver) UpdateMessageStatus(ctx context.Context, messageID in return nil, fmt.Errorf("failed to update message status: %w", err) } - success = true return protoMessageToDomain(res.Message), nil } // GetChat реализация запроса для получения чата func (r *queryResolver) GetChat(ctx context.Context, user1Id int, user2Id int) (*domain.Chat, error) { - start := time.Now() - success := false - - defer func() { - duration := time.Since(start) - middleware.IncGQLOperation("query", "getChat", success, duration) - if !success { - middleware.IncError("gql_operation", "getChat", "error") - } - }() - res, err := r.MessageClient.GetChat(ctx, &proto.GetChatRequest{ User1Id: int32(user1Id), User2Id: int32(user2Id), @@ -134,24 +84,11 @@ func (r *queryResolver) GetChat(ctx context.Context, user1Id int, user2Id int) ( if err != nil { return nil, fmt.Errorf("failed to get chat: %w", err) } - - success = true return protoChatToDomain(res.Chat), nil } // GetChatMessages реализация запроса для получения сообщений чата func (r *queryResolver) GetChatMessages(ctx context.Context, chatID int, limit int, offset int) ([]*domain.Message, error) { - start := time.Now() - success := false - - defer func() { - duration := time.Since(start) - middleware.IncGQLOperation("query", "getChatMessages", success, duration) - if !success { - middleware.IncError("gql_operation", "getChatMessages", "error") - } - }() - res, err := r.MessageClient.GetChatMessages(ctx, &proto.GetChatMessagesRequest{ ChatId: int32(chatID), Limit: int32(limit), @@ -160,58 +97,30 @@ func (r *queryResolver) GetChatMessages(ctx context.Context, chatID int, limit i if err != nil { return nil, fmt.Errorf("failed to get chat messages: %w", err) } - var messages []*domain.Message for _, msg := range res.Messages { messages = append(messages, protoMessageToDomain(msg)) } - - success = true return messages, nil } // GetUserChats реализация запроса для получения чатов пользователя func (r *queryResolver) GetUserChats(ctx context.Context, userID int) ([]*domain.Chat, error) { - start := time.Now() - success := false - - defer func() { - duration := time.Since(start) - middleware.IncGQLOperation("query", "getUserChats", success, duration) - if !success { - middleware.IncError("gql_operation", "getUserChats", "error") - } - }() - res, err := r.MessageClient.GetUserChats(ctx, &proto.GetUserChatsRequest{ UserId: int32(userID), }) if err != nil { return nil, fmt.Errorf("failed to get user chats: %w", err) } - var chats []*domain.Chat for _, chat := range res.Chats { chats = append(chats, protoChatToDomain(chat)) } - - success = true return chats, nil } // MessageStream реализация подписки на новые сообщения func (r *subscriptionResolver) MessageStream(ctx context.Context, userID int) (<-chan *domain.Message, error) { - start := time.Now() - success := false - - defer func() { - duration := time.Since(start) - middleware.IncGQLOperation("subscription", "messageStream", success, duration) - if !success { - middleware.IncError("gql_operation", "messageStream", "error") - } - }() - messageChan := make(chan *domain.Message, 100) go func() { @@ -227,14 +136,12 @@ func (r *subscriptionResolver) MessageStream(ctx context.Context, userID int) (< err := r.runMessageStream(ctx, userID, messageChan) if err != nil { log.Printf("MessageStream error: %v, reconnecting...", err) - middleware.IncError("websocket_stream", "messageStream", "warning") } time.Sleep(2 * time.Second) // Задержка перед переподключением } } }() - success = true return messageChan, nil } @@ -248,7 +155,6 @@ func (r *subscriptionResolver) runMessageStream(ctx context.Context, userID int, }) if err != nil { log.Printf("Failed to mark messages as delivered: %v", err) - middleware.IncError("message_status", "updateStatus", "warning") } streamCtx, cancel := context.WithCancel(ctx) @@ -269,7 +175,6 @@ func (r *subscriptionResolver) runMessageStream(ctx context.Context, userID int, case <-heartbeat.C: // Отправляем ping для поддержания соединения if err := stream.Context().Err(); err != nil { - middleware.IncError("websocket_heartbeat", "messageStream", "error") return fmt.Errorf("connection lost: %w", err) } case <-ctx.Done(): @@ -277,7 +182,6 @@ func (r *subscriptionResolver) runMessageStream(ctx context.Context, userID int, default: msg, err := stream.Recv() if err != nil { - middleware.IncError("websocket_receive", "messageStream", "error") return fmt.Errorf("receive error: %w", err) } @@ -285,7 +189,6 @@ func (r *subscriptionResolver) runMessageStream(ctx context.Context, userID int, select { case messageChan <- protoMessageToDomain(msg.Message): log.Printf("Delivered message %d to user %d", msg.Message.Id, userID) - middleware.IncWebSocketMessage("incoming", "chat_message") case <-ctx.Done(): return nil } diff --git a/internal/http/graph/models_gen.go b/internal/http/graph/models_gen.go index 02e8ed7..03e4f88 100644 --- a/internal/http/graph/models_gen.go +++ b/internal/http/graph/models_gen.go @@ -9,15 +9,70 @@ import ( "strconv" ) +type FollowResult struct { + Success bool `json:"success"` + Message string `json:"message"` +} + +type Follower struct { + UserID int `json:"userId"` + Username string `json:"username"` + Avatar string `json:"avatar"` + CreatedAt string `json:"createdAt"` +} + +type FollowersResponse struct { + Followers []*Follower `json:"followers"` + TotalCount int `json:"totalCount"` +} + +type Following struct { + UserID int `json:"userId"` + Username string `json:"username"` + Avatar string `json:"avatar"` + CreatedAt string `json:"createdAt"` +} + +type FollowingResponse struct { + Following []*Following `json:"following"` + TotalCount int `json:"totalCount"` +} + +type MarkNotificationReadResult struct { + Success bool `json:"success"` + Message string `json:"message"` +} + type Mutation struct { } +type NotificationsResponse struct { + Notifications []*SubscriptionNotification `json:"notifications"` + TotalCount int `json:"totalCount"` + UnreadCount int `json:"unreadCount"` +} + type Query struct { } type Subscription struct { } +type SubscriptionNotification struct { + ID int `json:"id"` + FollowerID int `json:"followerId"` + FollowerUsername string `json:"followerUsername"` + FollowerAvatar string `json:"followerAvatar"` + IsRead bool `json:"isRead"` + CreatedAt string `json:"createdAt"` + ExpiresAt string `json:"expiresAt"` +} + +type UnfollowResult struct { + Success bool `json:"success"` + Message string `json:"message"` +} + type MessageStatus string const ( diff --git a/internal/http/graph/resolver.go b/internal/http/graph/resolver.go index 5a2a0bd..6bbebdf 100644 --- a/internal/http/graph/resolver.go +++ b/internal/http/graph/resolver.go @@ -15,20 +15,23 @@ import ( // It serves as dependency injection for your app, add any dependencies you require here. type Resolver struct { - Services *service.Services - DeviceRepo repository.DeviceRepository // Добавляем репозиторий устройств напрямую - MessageClient proto.MessageServiceClient + Services *service.Services + DeviceRepo repository.DeviceRepository // Добавляем репозиторий устройств напрямую + MessageClient proto.MessageServiceClient + SubscribeClient proto.SubscribeServiceClient } func NewResolver( services *service.Services, db *sql.DB, // Принимаем подключение к БД messageClient proto.MessageServiceClient, + subscribeClient proto.SubscribeServiceClient, ) *Resolver { return &Resolver{ - Services: services, - DeviceRepo: repository.NewDeviceRepository(db), - MessageClient: messageClient, + Services: services, + DeviceRepo: repository.NewDeviceRepository(db), + MessageClient: messageClient, + SubscribeClient: subscribeClient, } } diff --git a/internal/http/graph/schema.graphql b/internal/http/graph/schema.graphql index 93224ed..1cc8057 100644 --- a/internal/http/graph/schema.graphql +++ b/internal/http/graph/schema.graphql @@ -7,6 +7,16 @@ type User { emailConfirmedAt: String # Дата подтверждения email (может быть null) createdAt: String! # Дата создания updatedAt: String! # Дата обновления + followersCount: Int! + followingCount: Int! + isFollowing(userId: Int!): Boolean! + followers(limit: Int = 20, offset: Int = 0): FollowersResponse! + following(limit: Int = 20, offset: Int = 0): FollowingResponse! + subscriptionNotifications( + unreadOnly: Boolean = false + limit: Int = 20 + offset: Int = 0 + ): NotificationsResponse! } # Пост в блоге @@ -104,6 +114,62 @@ type Device { lastActiveAt: String! } +# типы для подписок +type Follower { + userId: Int! + username: String! + avatar: String! + createdAt: String! +} + +type Following { + userId: Int! + username: String! + avatar: String! + createdAt: String! +} + +type SubscriptionNotification { + id: Int! + followerId: Int! + followerUsername: String! + followerAvatar: String! + isRead: Boolean! + createdAt: String! + expiresAt: String! +} + +type FollowersResponse { + followers: [Follower!]! + totalCount: Int! +} + +type FollowingResponse { + following: [Following!]! + totalCount: Int! +} + +type NotificationsResponse { + notifications: [SubscriptionNotification!]! + totalCount: Int! + unreadCount: Int! +} + +type FollowResult { + success: Boolean! + message: String! +} + +type UnfollowResult { + success: Boolean! + message: String! +} + +type MarkNotificationReadResult { + success: Boolean! + message: String! +} + # Запросы (получение данных) type Query { me: User! # Получить текущего пользователя @@ -117,6 +183,27 @@ type Query { getUserChats(userId: Int!): [Chat!]! mySessions: [Session!]! comments(postID: Int!): [Comment!]! + # Получить количество подписчиков + getFollowersCount(userId: Int!): Int! + + # Получить количество подписок + getFollowingCount(userId: Int!): Int! + + # Проверить подписку + isFollowing(followingId: Int!): Boolean! + + # Получить список подписчиков + getFollowers(userId: Int!, limit: Int = 20, offset: Int = 0): FollowersResponse! + + # Получить список подписок + getFollowing(userId: Int!, limit: Int = 20, offset: Int = 0): FollowingResponse! + + # Получить уведомления о подписках + getSubscriptionNotifications( + unreadOnly: Boolean = false + limit: Int = 20 + offset: Int = 0 + ): NotificationsResponse! } # Мутации (изменение данных) @@ -155,6 +242,9 @@ type Mutation { # Повторная отправка подтверждения email resendEmailConfirmation: Boolean! deletePost(id: Int!): Boolean! + followUser(followingId: Int!): FollowResult! + unfollowUser(followingId: Int!): UnfollowResult! + markNotificationAsRead(notificationId: Int!): MarkNotificationReadResult! } type Subscription { diff --git a/internal/http/graph/subscriber_resolvers.go b/internal/http/graph/subscriber_resolvers.go new file mode 100644 index 0000000..f3e05bf --- /dev/null +++ b/internal/http/graph/subscriber_resolvers.go @@ -0,0 +1,240 @@ +package graph + +import ( + "context" + "fmt" + "tailly_back_v2/proto" +) + +// FollowUser is the resolver for the followUser field. +func (r *mutationResolver) FollowUser(ctx context.Context, followingID int) (*FollowResult, error) { + followerID, err := getUserIDFromContext(ctx) + if err != nil { + return nil, fmt.Errorf("authentication required: %w", err) + } + + res, err := r.SubscribeClient.FollowUser(ctx, &proto.FollowRequest{ + FollowerId: int32(followerID), + FollowingId: int32(followingID), + }) + if err != nil { + return nil, fmt.Errorf("failed to follow user: %w", err) + } + return &FollowResult{Success: res.Success, Message: res.Message}, nil +} + +// UnfollowUser is the resolver for the unfollowUser field. +func (r *mutationResolver) UnfollowUser(ctx context.Context, followingID int) (*UnfollowResult, error) { + followerID, err := getUserIDFromContext(ctx) + if err != nil { + return nil, fmt.Errorf("authentication required: %w", err) + } + + res, err := r.SubscribeClient.UnfollowUser(ctx, &proto.UnfollowRequest{ + FollowerId: int32(followerID), + FollowingId: int32(followingID), + }) + if err != nil { + return nil, fmt.Errorf("failed to unfollow user: %w", err) + } + + return &UnfollowResult{Success: res.Success, Message: res.Message}, nil +} + +// MarkNotificationAsRead is the resolver for the markNotificationAsRead field. +func (r *mutationResolver) MarkNotificationAsRead(ctx context.Context, notificationID int) (*MarkNotificationReadResult, error) { + userID, err := getUserIDFromContext(ctx) + if err != nil { + return nil, fmt.Errorf("authentication required: %w", err) + } + + res, err := r.SubscribeClient.MarkNotificationAsRead(ctx, &proto.MarkNotificationReadRequest{ + UserId: int32(userID), + NotificationId: int32(notificationID), + }) + if err != nil { + return nil, fmt.Errorf("failed to unfollow user: %w", err) + } + + return &MarkNotificationReadResult{Success: res.Success, Message: res.Message}, nil +} + +// GetFollowersCount is the resolver for the getFollowersCount field. +func (r *queryResolver) GetFollowersCount(ctx context.Context, userID int) (int, error) { + + res, err := r.SubscribeClient.GetFollowersCount(ctx, &proto.GetCountRequest{ + UserId: int32(userID), + }) + if err != nil { + return 0, fmt.Errorf("failed to get followers count: %w", err) + } + + return int(res.Count), nil +} + +// GetFollowingCount is the resolver for the getFollowingCount field. +func (r *queryResolver) GetFollowingCount(ctx context.Context, userID int) (int, error) { + res, err := r.SubscribeClient.GetFollowingCount(ctx, &proto.GetCountRequest{ + UserId: int32(userID), + }) + if err != nil { + return 0, fmt.Errorf("failed to get following count: %w", err) + } + + return int(res.Count), nil +} + +// IsFollowing is the resolver for the isFollowing field. +func (r *queryResolver) IsFollowing(ctx context.Context, followingID int) (bool, error) { + followerID, err := getUserIDFromContext(ctx) + if err != nil { + return false, fmt.Errorf("authentication required: %w", err) + } + + res, err := r.SubscribeClient.IsFollowing(ctx, &proto.IsFollowingRequest{ + FollowerId: int32(followerID), + FollowingId: int32(followingID), + }) + if err != nil { + return false, fmt.Errorf("failed to check subscription status: %w", err) + } + + return res.IsFollowing, nil +} + +// GetFollowers is the resolver for the getFollowers field. +func (r *queryResolver) GetFollowers(ctx context.Context, userID int, limit *int, offset *int) (*FollowersResponse, error) { + + limitVal := 20 + if limit != nil { + limitVal = *limit + } + + offsetVal := 0 + if offset != nil { + offsetVal = *offset + } + + res, err := r.SubscribeClient.GetFollowers(ctx, &proto.GetFollowersRequest{ + UserId: int32(userID), + Limit: int32(limitVal), + Offset: int32(offsetVal), + }) + if err != nil { + return nil, fmt.Errorf("failed to get followers: %w", err) + } + + return &FollowersResponse{ + Followers: convertProtoFollowersToGraphQL(res.Followers), + TotalCount: int(res.TotalCount), + }, nil +} + +// Вспомогательная функция для преобразования +func convertProtoFollowersToGraphQL(protoFollowers []*proto.GetFollowersResponse_Follower) []*Follower { + var followers []*Follower + for _, pf := range protoFollowers { + followers = append(followers, &Follower{ + UserID: int(pf.UserId), + Username: pf.Username, + Avatar: pf.Avatar, + }) + } + return followers +} + +// GetFollowing is the resolver for the getFollowing field. +func (r *queryResolver) GetFollowing(ctx context.Context, userID int, limit *int, offset *int) (*FollowingResponse, error) { + + limitVal := 20 + if limit != nil { + limitVal = *limit + } + + offsetVal := 0 + if offset != nil { + offsetVal = *offset + } + + res, err := r.SubscribeClient.GetFollowing(ctx, &proto.GetFollowingRequest{ + UserId: int32(userID), + Limit: int32(limitVal), + Offset: int32(offsetVal), + }) + if err != nil { + return nil, fmt.Errorf("failed to get following: %w", err) + } + + return &FollowingResponse{ + Following: convertProtoFollowingToGraphQL(res.Following), + TotalCount: int(res.TotalCount), + }, nil +} + +// Вспомогательная функция для преобразования +func convertProtoFollowingToGraphQL(protoFollowing []*proto.GetFollowingResponse_Following) []*Following { + var following []*Following + for _, pf := range protoFollowing { + following = append(following, &Following{ + UserID: int(pf.UserId), + Username: pf.Username, + Avatar: pf.Avatar, + }) + } + return following +} + +// GetSubscriptionNotifications is the resolver for the getSubscriptionNotifications field. +func (r *queryResolver) GetSubscriptionNotifications(ctx context.Context, unreadOnly *bool, limit *int, offset *int) (*NotificationsResponse, error) { + + userID, err := getUserIDFromContext(ctx) + if err != nil { + return nil, fmt.Errorf("authentication required: %w", err) + } + + unreadOnlyVal := false + if unreadOnly != nil { + unreadOnlyVal = *unreadOnly + } + + limitVal := 20 + if limit != nil { + limitVal = *limit + } + + offsetVal := 0 + if offset != nil { + offsetVal = *offset + } + + res, err := r.SubscribeClient.GetSubscriptionNotifications(ctx, &proto.GetNotificationsRequest{ + UserId: int32(userID), + UnreadOnly: unreadOnlyVal, + Limit: int32(limitVal), + Offset: int32(offsetVal), + }) + if err != nil { + return nil, fmt.Errorf("failed to get notifications: %w", err) + } + + return &NotificationsResponse{ + Notifications: convertProtoNotificationsToGraphQL(res.Notifications), + TotalCount: int(res.TotalCount), + UnreadCount: int(res.UnreadCount), + }, nil +} +func convertProtoNotificationsToGraphQL(protoNotifs []*proto.GetNotificationsResponse_Notification) []*SubscriptionNotification { + var notifications []*SubscriptionNotification + for _, pn := range protoNotifs { + notifications = append(notifications, &SubscriptionNotification{ + ID: int(pn.Id), + FollowerID: int(pn.FollowerId), + FollowerUsername: pn.FollowerUsername, + FollowerAvatar: pn.FollowerAvatar, + IsRead: pn.IsRead, + CreatedAt: pn.CreatedAt, + ExpiresAt: pn.ExpiresAt, + }) + } + return notifications +} diff --git a/internal/http/graph/user_resolvers.go b/internal/http/graph/user_resolvers.go index d6ace49..46c6e1a 100644 --- a/internal/http/graph/user_resolvers.go +++ b/internal/http/graph/user_resolvers.go @@ -6,6 +6,7 @@ import ( "fmt" "tailly_back_v2/internal/domain" "tailly_back_v2/internal/service" + "tailly_back_v2/proto" "time" ) @@ -118,3 +119,140 @@ func (r *queryResolver) Users(ctx context.Context) ([]*domain.User, error) { } return users, nil } + +// FollowersCount is the resolver for the followersCount field. +func (r *userResolver) FollowersCount(ctx context.Context, obj *domain.User) (int, error) { + res, err := r.SubscribeClient.GetFollowersCount(ctx, &proto.GetCountRequest{ + UserId: int32(obj.ID), + }) + if err != nil { + return 0, fmt.Errorf("failed to get followers count: %w", err) + } + return int(res.Count), nil +} + +// FollowingCount is the resolver for the followingCount field. +func (r *userResolver) FollowingCount(ctx context.Context, obj *domain.User) (int, error) { + res, err := r.SubscribeClient.GetFollowingCount(ctx, &proto.GetCountRequest{ + UserId: int32(obj.ID), + }) + if err != nil { + return 0, fmt.Errorf("failed to get following count: %w", err) + } + return int(res.Count), nil +} + +// IsFollowing is the resolver for the isFollowing field. +func (r *userResolver) IsFollowing(ctx context.Context, obj *domain.User, userID int) (bool, error) { + currentUserID, err := getUserIDFromContext(ctx) + if err != nil { + return false, fmt.Errorf("authentication required: %w", err) + } + + res, err := r.SubscribeClient.IsFollowing(ctx, &proto.IsFollowingRequest{ + FollowerId: int32(currentUserID), + FollowingId: int32(userID), + }) + if err != nil { + return false, fmt.Errorf("failed to check subscription status: %w", err) + } + return res.IsFollowing, nil +} + +// Followers is the resolver for the followers field. +func (r *userResolver) Followers(ctx context.Context, obj *domain.User, limit *int, offset *int) (*FollowersResponse, error) { + limitVal := 20 + if limit != nil { + limitVal = *limit + } + + offsetVal := 0 + if offset != nil { + offsetVal = *offset + } + + res, err := r.SubscribeClient.GetFollowers(ctx, &proto.GetFollowersRequest{ + UserId: int32(obj.ID), + Limit: int32(limitVal), + Offset: int32(offsetVal), + }) + if err != nil { + return nil, fmt.Errorf("failed to get followers: %w", err) + } + + return &FollowersResponse{ + Followers: convertProtoFollowersToGraphQL(res.Followers), + TotalCount: int(res.TotalCount), + }, nil +} + +// Following is the resolver for the following field. +func (r *userResolver) Following(ctx context.Context, obj *domain.User, limit *int, offset *int) (*FollowingResponse, error) { + limitVal := 20 + if limit != nil { + limitVal = *limit + } + + offsetVal := 0 + if offset != nil { + offsetVal = *offset + } + + res, err := r.SubscribeClient.GetFollowing(ctx, &proto.GetFollowingRequest{ + UserId: int32(obj.ID), + Limit: int32(limitVal), + Offset: int32(offsetVal), + }) + if err != nil { + return nil, fmt.Errorf("failed to get following: %w", err) + } + + return &FollowingResponse{ + Following: convertProtoFollowingToGraphQL(res.Following), + TotalCount: int(res.TotalCount), + }, nil +} + +// SubscriptionNotifications is the resolver for the subscriptionNotifications field. +func (r *userResolver) SubscriptionNotifications(ctx context.Context, obj *domain.User, unreadOnly *bool, limit *int, offset *int) (*NotificationsResponse, error) { + currentUserID, err := getUserIDFromContext(ctx) + if err != nil { + return nil, fmt.Errorf("authentication required: %w", err) + } + + // Можно смотреть только свои уведомления + if obj.ID != currentUserID { + return nil, fmt.Errorf("access denied: can only view your own notifications") + } + + unreadOnlyVal := false + if unreadOnly != nil { + unreadOnlyVal = *unreadOnly + } + + limitVal := 20 + if limit != nil { + limitVal = *limit + } + + offsetVal := 0 + if offset != nil { + offsetVal = *offset + } + + res, err := r.SubscribeClient.GetSubscriptionNotifications(ctx, &proto.GetNotificationsRequest{ + UserId: int32(obj.ID), + UnreadOnly: unreadOnlyVal, + Limit: int32(limitVal), + Offset: int32(offsetVal), + }) + if err != nil { + return nil, fmt.Errorf("failed to get notifications: %w", err) + } + + return &NotificationsResponse{ + Notifications: convertProtoNotificationsToGraphQL(res.Notifications), + TotalCount: int(res.TotalCount), + UnreadCount: int(res.UnreadCount), + }, nil +} diff --git a/internal/http/middleware/metrics.go b/internal/http/middleware/metrics.go index c3aaa49..4eca91d 100644 --- a/internal/http/middleware/metrics.go +++ b/internal/http/middleware/metrics.go @@ -10,128 +10,29 @@ import ( ) var ( - // HTTP метрики httpRequestsTotal = promauto.NewCounterVec( prometheus.CounterOpts{ Name: "http_requests_total", Help: "Total number of HTTP requests", }, - []string{"method", "path", "status", "handler"}, + []string{"method", "path", "status"}, ) httpRequestDuration = promauto.NewHistogramVec( prometheus.HistogramOpts{ Name: "http_request_duration_seconds", Help: "Duration of HTTP requests", - Buckets: []float64{0.01, 0.05, 0.1, 0.5, 1, 2.5, 5, 10}, + Buckets: []float64{0.1, 0.5, 1, 2.5, 5, 10}, }, - []string{"method", "path", "handler"}, + []string{"method", "path"}, ) - // GraphQL специфичные метрики - gqlOperationsTotal = promauto.NewCounterVec( - prometheus.CounterOpts{ - Name: "graphql_operations_total", - Help: "Total number of GraphQL operations", + httpResponseSize = promauto.NewSummaryVec( + prometheus.SummaryOpts{ + Name: "http_response_size_bytes", + Help: "Size of HTTP responses", }, - []string{"operation", "type", "name", "success"}, - ) - - gqlOperationDuration = promauto.NewHistogramVec( - prometheus.HistogramOpts{ - Name: "graphql_operation_duration_seconds", - Help: "Duration of GraphQL operations", - Buckets: []float64{0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1, 2, 5}, - }, - []string{"operation", "name"}, - ) - - // Бизнес метрики - usersTotal = promauto.NewGauge( - prometheus.GaugeOpts{ - Name: "users_total", - Help: "Total number of registered users", - }, - ) - - postsTotal = promauto.NewGauge( - prometheus.GaugeOpts{ - Name: "posts_total", - Help: "Total number of posts", - }, - ) - - commentsTotal = promauto.NewGauge( - prometheus.GaugeOpts{ - Name: "comments_total", - Help: "Total number of comments", - }, - ) - - messagesTotal = promauto.NewGauge( - prometheus.GaugeOpts{ - Name: "messages_total", - Help: "Total number of messages", - }, - ) - - activeWebsockets = promauto.NewGauge( - prometheus.GaugeOpts{ - Name: "websocket_connections_active", - Help: "Number of active WebSocket connections", - }, - ) - - websocketMessagesTotal = promauto.NewCounterVec( - prometheus.CounterOpts{ - Name: "websocket_messages_total", - Help: "Total number of WebSocket messages", - }, - []string{"direction", "type"}, - ) - - // Метрики ошибок - errorsTotal = promauto.NewCounterVec( - prometheus.CounterOpts{ - Name: "errors_total", - Help: "Total number of errors by type", - }, - []string{"type", "source", "severity"}, - ) - - // Метрики базы данных - dbQueriesTotal = promauto.NewCounterVec( - prometheus.CounterOpts{ - Name: "db_queries_total", - Help: "Total number of database queries", - }, - []string{"operation", "table", "success"}, - ) - - dbQueryDuration = promauto.NewHistogramVec( - prometheus.HistogramOpts{ - Name: "db_query_duration_seconds", - Help: "Duration of database queries", - Buckets: []float64{0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1, 2}, - }, - []string{"operation", "table"}, - ) - - // Метрики кэша - cacheHitsTotal = promauto.NewCounterVec( - prometheus.CounterOpts{ - Name: "cache_hits_total", - Help: "Total number of cache hits", - }, - []string{"type", "name"}, - ) - - cacheMissesTotal = promauto.NewCounterVec( - prometheus.CounterOpts{ - Name: "cache_misses_total", - Help: "Total number of cache misses", - }, - []string{"type", "name"}, + []string{"method", "path"}, ) ) @@ -146,108 +47,21 @@ func MetricsMiddleware(next http.Handler) http.Handler { duration := time.Since(start).Seconds() status := strconv.Itoa(rw.status) - // Определяем handler type - handlerType := "http" - if r.URL.Path == "/query" { - handlerType = "graphql" - } else if r.URL.Path == "/ws" { - handlerType = "websocket" - } - + // Регистрируем метрики httpRequestsTotal.WithLabelValues( r.Method, r.URL.Path, status, - handlerType, ).Inc() httpRequestDuration.WithLabelValues( r.Method, r.URL.Path, - handlerType, ).Observe(duration) + + httpResponseSize.WithLabelValues( + r.Method, + r.URL.Path, + ).Observe(float64(rw.size)) }) } - -// GraphQLMetricsMiddleware для отслеживания GraphQL операций -func GraphQLMetricsMiddleware() func(http.Handler) http.Handler { - return func(next http.Handler) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.URL.Path != "/query" { - next.ServeHTTP(w, r) - return - } - - // Здесь можно парсить GraphQL запрос и извлекать информацию об операции - // Для простоты пока пропускаем - next.ServeHTTP(w, r) - }) - } -} - -// Вспомогательные функции для обновления метрик - -func IncGQLOperation(operationType, operationName string, success bool, duration time.Duration) { - status := "false" - if success { - status = "true" - } - - gqlOperationsTotal.WithLabelValues( - operationType, // operation - operationName, // type (возможно нужно переименовать) - operationName, // name (дублирование) - status, // success - ).Inc() - - gqlOperationDuration.WithLabelValues( - operationType, - operationName, - ).Observe(duration.Seconds()) -} - -func IncWebSocketMessage(direction, messageType string) { - websocketMessagesTotal.WithLabelValues(direction, messageType).Inc() -} - -func SetActiveWebsockets(count int) { - activeWebsockets.Set(float64(count)) -} - -func IncError(errorType, source, severity string) { - errorsTotal.WithLabelValues(errorType, source, severity).Inc() -} - -func IncDBQuery(operation, table string, success bool, duration time.Duration) { - status := "false" - if success { - status = "true" - } - - dbQueriesTotal.WithLabelValues(operation, table, status).Inc() - dbQueryDuration.WithLabelValues(operation, table).Observe(duration.Seconds()) -} - -func IncCacheHit(cacheType, cacheName string) { - cacheHitsTotal.WithLabelValues(cacheType, cacheName).Inc() -} - -func IncCacheMiss(cacheType, cacheName string) { - cacheMissesTotal.WithLabelValues(cacheType, cacheName).Inc() -} - -func SetUsersCount(count int) { - usersTotal.Set(float64(count)) -} - -func SetPostsCount(count int) { - postsTotal.Set(float64(count)) -} - -func SetCommentsCount(count int) { - commentsTotal.Set(float64(count)) -} - -func SetMessagesCount(count int) { - messagesTotal.Set(float64(count)) -} diff --git a/internal/http/server.go b/internal/http/server.go index 9f16cfc..7b5e336 100644 --- a/internal/http/server.go +++ b/internal/http/server.go @@ -66,7 +66,7 @@ func (s *Server) configureRouter() { s.router.Use(middleware.CORS(allowedOrigins)) // Основной GraphQL обработчик - resolver := graph.NewResolver(s.services, s.db, s.services.Messages) + resolver := graph.NewResolver(s.services, s.db, s.services.Messages, s.services.Subscribe) srv := handler.NewDefaultServer(graph.NewExecutableSchema(graph.Config{ Resolvers: resolver, })) diff --git a/internal/service/services.go b/internal/service/services.go index ddbcea7..ccd88ea 100644 --- a/internal/service/services.go +++ b/internal/service/services.go @@ -6,29 +6,31 @@ import ( ) type Services struct { - Auth AuthService - User UserService - Post PostService - Comment CommentService - Like LikeService - Session SessionService - Mail MailService - Recovery RecoveryService - Audit AuditService - Messages proto.MessageServiceClient + Auth AuthService + User UserService + Post PostService + Comment CommentService + Like LikeService + Session SessionService + Mail MailService + Recovery RecoveryService + Audit AuditService + Messages proto.MessageServiceClient + Subscribe proto.SubscribeServiceClient } -func NewServices(authService AuthService, userService UserService, postService PostService, commentService CommentService, likeService LikeService, mailService MailService, auditService AuditService, recoveryService RecoveryService, sessionService SessionService, messages proto.MessageServiceClient) *Services { +func NewServices(authService AuthService, userService UserService, postService PostService, commentService CommentService, likeService LikeService, mailService MailService, auditService AuditService, recoveryService RecoveryService, sessionService SessionService, messages proto.MessageServiceClient, subscribe proto.SubscribeServiceClient) *Services { return &Services{ - Auth: authService, - User: userService, - Post: postService, - Comment: commentService, - Like: likeService, - Session: sessionService, - Mail: mailService, - Recovery: recoveryService, - Audit: auditService, - Messages: messages, + Auth: authService, + User: userService, + Post: postService, + Comment: commentService, + Like: likeService, + Session: sessionService, + Mail: mailService, + Recovery: recoveryService, + Audit: auditService, + Messages: messages, + Subscribe: subscribe, } } diff --git a/proto/subscribe.pb.go b/proto/subscribe.pb.go new file mode 100644 index 0000000..ec10ef4 --- /dev/null +++ b/proto/subscribe.pb.go @@ -0,0 +1,1304 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.6 +// protoc v3.21.12 +// source: subscribe.proto + +package proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type GetCountRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId int32 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetCountRequest) Reset() { + *x = GetCountRequest{} + mi := &file_subscribe_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetCountRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCountRequest) ProtoMessage() {} + +func (x *GetCountRequest) ProtoReflect() protoreflect.Message { + mi := &file_subscribe_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCountRequest.ProtoReflect.Descriptor instead. +func (*GetCountRequest) Descriptor() ([]byte, []int) { + return file_subscribe_proto_rawDescGZIP(), []int{0} +} + +func (x *GetCountRequest) GetUserId() int32 { + if x != nil { + return x.UserId + } + return 0 +} + +// Ответ с количеством +type GetCountResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Count int32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetCountResponse) Reset() { + *x = GetCountResponse{} + mi := &file_subscribe_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetCountResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCountResponse) ProtoMessage() {} + +func (x *GetCountResponse) ProtoReflect() protoreflect.Message { + mi := &file_subscribe_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCountResponse.ProtoReflect.Descriptor instead. +func (*GetCountResponse) Descriptor() ([]byte, []int) { + return file_subscribe_proto_rawDescGZIP(), []int{1} +} + +func (x *GetCountResponse) GetCount() int32 { + if x != nil { + return x.Count + } + return 0 +} + +// Запрос на подписку +type FollowRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + FollowerId int32 `protobuf:"varint,1,opt,name=follower_id,json=followerId,proto3" json:"follower_id,omitempty"` // ID пользователя, который подписывается + FollowingId int32 `protobuf:"varint,2,opt,name=following_id,json=followingId,proto3" json:"following_id,omitempty"` // ID пользователя, на которого подписываются + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FollowRequest) Reset() { + *x = FollowRequest{} + mi := &file_subscribe_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FollowRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FollowRequest) ProtoMessage() {} + +func (x *FollowRequest) ProtoReflect() protoreflect.Message { + mi := &file_subscribe_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FollowRequest.ProtoReflect.Descriptor instead. +func (*FollowRequest) Descriptor() ([]byte, []int) { + return file_subscribe_proto_rawDescGZIP(), []int{2} +} + +func (x *FollowRequest) GetFollowerId() int32 { + if x != nil { + return x.FollowerId + } + return 0 +} + +func (x *FollowRequest) GetFollowingId() int32 { + if x != nil { + return x.FollowingId + } + return 0 +} + +// Ответ на подписку +type FollowResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // Успешность операции + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` // Сообщение (например, об ошибке) + SubscriptionId int32 `protobuf:"varint,3,opt,name=subscription_id,json=subscriptionId,proto3" json:"subscription_id,omitempty"` // ID созданной подписки + NotificationId int32 `protobuf:"varint,4,opt,name=notification_id,json=notificationId,proto3" json:"notification_id,omitempty"` // ID созданного уведомления + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FollowResponse) Reset() { + *x = FollowResponse{} + mi := &file_subscribe_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FollowResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FollowResponse) ProtoMessage() {} + +func (x *FollowResponse) ProtoReflect() protoreflect.Message { + mi := &file_subscribe_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FollowResponse.ProtoReflect.Descriptor instead. +func (*FollowResponse) Descriptor() ([]byte, []int) { + return file_subscribe_proto_rawDescGZIP(), []int{3} +} + +func (x *FollowResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *FollowResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *FollowResponse) GetSubscriptionId() int32 { + if x != nil { + return x.SubscriptionId + } + return 0 +} + +func (x *FollowResponse) GetNotificationId() int32 { + if x != nil { + return x.NotificationId + } + return 0 +} + +// Запрос на отписку +type UnfollowRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + FollowerId int32 `protobuf:"varint,1,opt,name=follower_id,json=followerId,proto3" json:"follower_id,omitempty"` + FollowingId int32 `protobuf:"varint,2,opt,name=following_id,json=followingId,proto3" json:"following_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UnfollowRequest) Reset() { + *x = UnfollowRequest{} + mi := &file_subscribe_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UnfollowRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnfollowRequest) ProtoMessage() {} + +func (x *UnfollowRequest) ProtoReflect() protoreflect.Message { + mi := &file_subscribe_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UnfollowRequest.ProtoReflect.Descriptor instead. +func (*UnfollowRequest) Descriptor() ([]byte, []int) { + return file_subscribe_proto_rawDescGZIP(), []int{4} +} + +func (x *UnfollowRequest) GetFollowerId() int32 { + if x != nil { + return x.FollowerId + } + return 0 +} + +func (x *UnfollowRequest) GetFollowingId() int32 { + if x != nil { + return x.FollowingId + } + return 0 +} + +// Ответ на отписку +type UnfollowResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UnfollowResponse) Reset() { + *x = UnfollowResponse{} + mi := &file_subscribe_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UnfollowResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnfollowResponse) ProtoMessage() {} + +func (x *UnfollowResponse) ProtoReflect() protoreflect.Message { + mi := &file_subscribe_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UnfollowResponse.ProtoReflect.Descriptor instead. +func (*UnfollowResponse) Descriptor() ([]byte, []int) { + return file_subscribe_proto_rawDescGZIP(), []int{5} +} + +func (x *UnfollowResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *UnfollowResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +// Запрос на получение подписчиков +type GetFollowersRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId int32 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // ID пользователя, чьих подписчиков запрашиваем + Limit int32 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` // Лимит (для пагинации) + Offset int32 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"` // Смещение (для пагинации) + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetFollowersRequest) Reset() { + *x = GetFollowersRequest{} + mi := &file_subscribe_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetFollowersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFollowersRequest) ProtoMessage() {} + +func (x *GetFollowersRequest) ProtoReflect() protoreflect.Message { + mi := &file_subscribe_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFollowersRequest.ProtoReflect.Descriptor instead. +func (*GetFollowersRequest) Descriptor() ([]byte, []int) { + return file_subscribe_proto_rawDescGZIP(), []int{6} +} + +func (x *GetFollowersRequest) GetUserId() int32 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *GetFollowersRequest) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *GetFollowersRequest) GetOffset() int32 { + if x != nil { + return x.Offset + } + return 0 +} + +// Ответ с подписчиками +type GetFollowersResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Followers []*GetFollowersResponse_Follower `protobuf:"bytes,1,rep,name=followers,proto3" json:"followers,omitempty"` // Список подписчиков + TotalCount int32 `protobuf:"varint,2,opt,name=total_count,json=totalCount,proto3" json:"total_count,omitempty"` // Общее количество подписчиков + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetFollowersResponse) Reset() { + *x = GetFollowersResponse{} + mi := &file_subscribe_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetFollowersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFollowersResponse) ProtoMessage() {} + +func (x *GetFollowersResponse) ProtoReflect() protoreflect.Message { + mi := &file_subscribe_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFollowersResponse.ProtoReflect.Descriptor instead. +func (*GetFollowersResponse) Descriptor() ([]byte, []int) { + return file_subscribe_proto_rawDescGZIP(), []int{7} +} + +func (x *GetFollowersResponse) GetFollowers() []*GetFollowersResponse_Follower { + if x != nil { + return x.Followers + } + return nil +} + +func (x *GetFollowersResponse) GetTotalCount() int32 { + if x != nil { + return x.TotalCount + } + return 0 +} + +// Запрос на получение подписок +type GetFollowingRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId int32 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // ID пользователя, чьи подписки запрашиваем + Limit int32 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` + Offset int32 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetFollowingRequest) Reset() { + *x = GetFollowingRequest{} + mi := &file_subscribe_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetFollowingRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFollowingRequest) ProtoMessage() {} + +func (x *GetFollowingRequest) ProtoReflect() protoreflect.Message { + mi := &file_subscribe_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFollowingRequest.ProtoReflect.Descriptor instead. +func (*GetFollowingRequest) Descriptor() ([]byte, []int) { + return file_subscribe_proto_rawDescGZIP(), []int{8} +} + +func (x *GetFollowingRequest) GetUserId() int32 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *GetFollowingRequest) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *GetFollowingRequest) GetOffset() int32 { + if x != nil { + return x.Offset + } + return 0 +} + +// Ответ с подписками +type GetFollowingResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Following []*GetFollowingResponse_Following `protobuf:"bytes,1,rep,name=following,proto3" json:"following,omitempty"` // Список подписок + TotalCount int32 `protobuf:"varint,2,opt,name=total_count,json=totalCount,proto3" json:"total_count,omitempty"` // Общее количество подписок + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetFollowingResponse) Reset() { + *x = GetFollowingResponse{} + mi := &file_subscribe_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetFollowingResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFollowingResponse) ProtoMessage() {} + +func (x *GetFollowingResponse) ProtoReflect() protoreflect.Message { + mi := &file_subscribe_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFollowingResponse.ProtoReflect.Descriptor instead. +func (*GetFollowingResponse) Descriptor() ([]byte, []int) { + return file_subscribe_proto_rawDescGZIP(), []int{9} +} + +func (x *GetFollowingResponse) GetFollowing() []*GetFollowingResponse_Following { + if x != nil { + return x.Following + } + return nil +} + +func (x *GetFollowingResponse) GetTotalCount() int32 { + if x != nil { + return x.TotalCount + } + return 0 +} + +// Запрос на проверку подписки +type IsFollowingRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + FollowerId int32 `protobuf:"varint,1,opt,name=follower_id,json=followerId,proto3" json:"follower_id,omitempty"` + FollowingId int32 `protobuf:"varint,2,opt,name=following_id,json=followingId,proto3" json:"following_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *IsFollowingRequest) Reset() { + *x = IsFollowingRequest{} + mi := &file_subscribe_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *IsFollowingRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IsFollowingRequest) ProtoMessage() {} + +func (x *IsFollowingRequest) ProtoReflect() protoreflect.Message { + mi := &file_subscribe_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IsFollowingRequest.ProtoReflect.Descriptor instead. +func (*IsFollowingRequest) Descriptor() ([]byte, []int) { + return file_subscribe_proto_rawDescGZIP(), []int{10} +} + +func (x *IsFollowingRequest) GetFollowerId() int32 { + if x != nil { + return x.FollowerId + } + return 0 +} + +func (x *IsFollowingRequest) GetFollowingId() int32 { + if x != nil { + return x.FollowingId + } + return 0 +} + +// Ответ на проверку подписки +type IsFollowingResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + IsFollowing bool `protobuf:"varint,1,opt,name=is_following,json=isFollowing,proto3" json:"is_following,omitempty"` // true - подписан, false - не подписан + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *IsFollowingResponse) Reset() { + *x = IsFollowingResponse{} + mi := &file_subscribe_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *IsFollowingResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IsFollowingResponse) ProtoMessage() {} + +func (x *IsFollowingResponse) ProtoReflect() protoreflect.Message { + mi := &file_subscribe_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IsFollowingResponse.ProtoReflect.Descriptor instead. +func (*IsFollowingResponse) Descriptor() ([]byte, []int) { + return file_subscribe_proto_rawDescGZIP(), []int{11} +} + +func (x *IsFollowingResponse) GetIsFollowing() bool { + if x != nil { + return x.IsFollowing + } + return false +} + +// Запрос на получение уведомлений +type GetNotificationsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId int32 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // ID пользователя, чьи уведомления запрашиваем + UnreadOnly bool `protobuf:"varint,2,opt,name=unread_only,json=unreadOnly,proto3" json:"unread_only,omitempty"` // Только непрочитанные + Limit int32 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` + Offset int32 `protobuf:"varint,4,opt,name=offset,proto3" json:"offset,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetNotificationsRequest) Reset() { + *x = GetNotificationsRequest{} + mi := &file_subscribe_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetNotificationsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetNotificationsRequest) ProtoMessage() {} + +func (x *GetNotificationsRequest) ProtoReflect() protoreflect.Message { + mi := &file_subscribe_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetNotificationsRequest.ProtoReflect.Descriptor instead. +func (*GetNotificationsRequest) Descriptor() ([]byte, []int) { + return file_subscribe_proto_rawDescGZIP(), []int{12} +} + +func (x *GetNotificationsRequest) GetUserId() int32 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *GetNotificationsRequest) GetUnreadOnly() bool { + if x != nil { + return x.UnreadOnly + } + return false +} + +func (x *GetNotificationsRequest) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *GetNotificationsRequest) GetOffset() int32 { + if x != nil { + return x.Offset + } + return 0 +} + +// Ответ с уведомлениями +type GetNotificationsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Notifications []*GetNotificationsResponse_Notification `protobuf:"bytes,1,rep,name=notifications,proto3" json:"notifications,omitempty"` + TotalCount int32 `protobuf:"varint,2,opt,name=total_count,json=totalCount,proto3" json:"total_count,omitempty"` + UnreadCount int32 `protobuf:"varint,3,opt,name=unread_count,json=unreadCount,proto3" json:"unread_count,omitempty"` // Количество непрочитанных уведомлений + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetNotificationsResponse) Reset() { + *x = GetNotificationsResponse{} + mi := &file_subscribe_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetNotificationsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetNotificationsResponse) ProtoMessage() {} + +func (x *GetNotificationsResponse) ProtoReflect() protoreflect.Message { + mi := &file_subscribe_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetNotificationsResponse.ProtoReflect.Descriptor instead. +func (*GetNotificationsResponse) Descriptor() ([]byte, []int) { + return file_subscribe_proto_rawDescGZIP(), []int{13} +} + +func (x *GetNotificationsResponse) GetNotifications() []*GetNotificationsResponse_Notification { + if x != nil { + return x.Notifications + } + return nil +} + +func (x *GetNotificationsResponse) GetTotalCount() int32 { + if x != nil { + return x.TotalCount + } + return 0 +} + +func (x *GetNotificationsResponse) GetUnreadCount() int32 { + if x != nil { + return x.UnreadCount + } + return 0 +} + +// Запрос на пометку уведомления как прочитанного +type MarkNotificationReadRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + NotificationId int32 `protobuf:"varint,1,opt,name=notification_id,json=notificationId,proto3" json:"notification_id,omitempty"` + UserId int32 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // Для проверки прав + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MarkNotificationReadRequest) Reset() { + *x = MarkNotificationReadRequest{} + mi := &file_subscribe_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MarkNotificationReadRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MarkNotificationReadRequest) ProtoMessage() {} + +func (x *MarkNotificationReadRequest) ProtoReflect() protoreflect.Message { + mi := &file_subscribe_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MarkNotificationReadRequest.ProtoReflect.Descriptor instead. +func (*MarkNotificationReadRequest) Descriptor() ([]byte, []int) { + return file_subscribe_proto_rawDescGZIP(), []int{14} +} + +func (x *MarkNotificationReadRequest) GetNotificationId() int32 { + if x != nil { + return x.NotificationId + } + return 0 +} + +func (x *MarkNotificationReadRequest) GetUserId() int32 { + if x != nil { + return x.UserId + } + return 0 +} + +// Ответ на пометку уведомления +type MarkNotificationReadResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MarkNotificationReadResponse) Reset() { + *x = MarkNotificationReadResponse{} + mi := &file_subscribe_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MarkNotificationReadResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MarkNotificationReadResponse) ProtoMessage() {} + +func (x *MarkNotificationReadResponse) ProtoReflect() protoreflect.Message { + mi := &file_subscribe_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MarkNotificationReadResponse.ProtoReflect.Descriptor instead. +func (*MarkNotificationReadResponse) Descriptor() ([]byte, []int) { + return file_subscribe_proto_rawDescGZIP(), []int{15} +} + +func (x *MarkNotificationReadResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *MarkNotificationReadResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type GetFollowersResponse_Follower struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId int32 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` + Avatar string `protobuf:"bytes,3,opt,name=avatar,proto3" json:"avatar,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetFollowersResponse_Follower) Reset() { + *x = GetFollowersResponse_Follower{} + mi := &file_subscribe_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetFollowersResponse_Follower) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFollowersResponse_Follower) ProtoMessage() {} + +func (x *GetFollowersResponse_Follower) ProtoReflect() protoreflect.Message { + mi := &file_subscribe_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFollowersResponse_Follower.ProtoReflect.Descriptor instead. +func (*GetFollowersResponse_Follower) Descriptor() ([]byte, []int) { + return file_subscribe_proto_rawDescGZIP(), []int{7, 0} +} + +func (x *GetFollowersResponse_Follower) GetUserId() int32 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *GetFollowersResponse_Follower) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *GetFollowersResponse_Follower) GetAvatar() string { + if x != nil { + return x.Avatar + } + return "" +} + +type GetFollowingResponse_Following struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId int32 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` + Avatar string `protobuf:"bytes,3,opt,name=avatar,proto3" json:"avatar,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetFollowingResponse_Following) Reset() { + *x = GetFollowingResponse_Following{} + mi := &file_subscribe_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetFollowingResponse_Following) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFollowingResponse_Following) ProtoMessage() {} + +func (x *GetFollowingResponse_Following) ProtoReflect() protoreflect.Message { + mi := &file_subscribe_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFollowingResponse_Following.ProtoReflect.Descriptor instead. +func (*GetFollowingResponse_Following) Descriptor() ([]byte, []int) { + return file_subscribe_proto_rawDescGZIP(), []int{9, 0} +} + +func (x *GetFollowingResponse_Following) GetUserId() int32 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *GetFollowingResponse_Following) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *GetFollowingResponse_Following) GetAvatar() string { + if x != nil { + return x.Avatar + } + return "" +} + +type GetNotificationsResponse_Notification struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + SubscriptionId int32 `protobuf:"varint,2,opt,name=subscription_id,json=subscriptionId,proto3" json:"subscription_id,omitempty"` + FollowerId int32 `protobuf:"varint,3,opt,name=follower_id,json=followerId,proto3" json:"follower_id,omitempty"` + FollowerUsername string `protobuf:"bytes,4,opt,name=follower_username,json=followerUsername,proto3" json:"follower_username,omitempty"` + FollowerAvatar string `protobuf:"bytes,5,opt,name=follower_avatar,json=followerAvatar,proto3" json:"follower_avatar,omitempty"` + IsRead bool `protobuf:"varint,6,opt,name=is_read,json=isRead,proto3" json:"is_read,omitempty"` + CreatedAt string `protobuf:"bytes,7,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + ExpiresAt string `protobuf:"bytes,8,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetNotificationsResponse_Notification) Reset() { + *x = GetNotificationsResponse_Notification{} + mi := &file_subscribe_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetNotificationsResponse_Notification) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetNotificationsResponse_Notification) ProtoMessage() {} + +func (x *GetNotificationsResponse_Notification) ProtoReflect() protoreflect.Message { + mi := &file_subscribe_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetNotificationsResponse_Notification.ProtoReflect.Descriptor instead. +func (*GetNotificationsResponse_Notification) Descriptor() ([]byte, []int) { + return file_subscribe_proto_rawDescGZIP(), []int{13, 0} +} + +func (x *GetNotificationsResponse_Notification) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *GetNotificationsResponse_Notification) GetSubscriptionId() int32 { + if x != nil { + return x.SubscriptionId + } + return 0 +} + +func (x *GetNotificationsResponse_Notification) GetFollowerId() int32 { + if x != nil { + return x.FollowerId + } + return 0 +} + +func (x *GetNotificationsResponse_Notification) GetFollowerUsername() string { + if x != nil { + return x.FollowerUsername + } + return "" +} + +func (x *GetNotificationsResponse_Notification) GetFollowerAvatar() string { + if x != nil { + return x.FollowerAvatar + } + return "" +} + +func (x *GetNotificationsResponse_Notification) GetIsRead() bool { + if x != nil { + return x.IsRead + } + return false +} + +func (x *GetNotificationsResponse_Notification) GetCreatedAt() string { + if x != nil { + return x.CreatedAt + } + return "" +} + +func (x *GetNotificationsResponse_Notification) GetExpiresAt() string { + if x != nil { + return x.ExpiresAt + } + return "" +} + +var File_subscribe_proto protoreflect.FileDescriptor + +const file_subscribe_proto_rawDesc = "" + + "\n" + + "\x0fsubscribe.proto\x12\x05proto\"*\n" + + "\x0fGetCountRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\x05R\x06userId\"(\n" + + "\x10GetCountResponse\x12\x14\n" + + "\x05count\x18\x01 \x01(\x05R\x05count\"S\n" + + "\rFollowRequest\x12\x1f\n" + + "\vfollower_id\x18\x01 \x01(\x05R\n" + + "followerId\x12!\n" + + "\ffollowing_id\x18\x02 \x01(\x05R\vfollowingId\"\x96\x01\n" + + "\x0eFollowResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x18\n" + + "\amessage\x18\x02 \x01(\tR\amessage\x12'\n" + + "\x0fsubscription_id\x18\x03 \x01(\x05R\x0esubscriptionId\x12'\n" + + "\x0fnotification_id\x18\x04 \x01(\x05R\x0enotificationId\"U\n" + + "\x0fUnfollowRequest\x12\x1f\n" + + "\vfollower_id\x18\x01 \x01(\x05R\n" + + "followerId\x12!\n" + + "\ffollowing_id\x18\x02 \x01(\x05R\vfollowingId\"F\n" + + "\x10UnfollowResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x18\n" + + "\amessage\x18\x02 \x01(\tR\amessage\"\\\n" + + "\x13GetFollowersRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\x05R\x06userId\x12\x14\n" + + "\x05limit\x18\x02 \x01(\x05R\x05limit\x12\x16\n" + + "\x06offset\x18\x03 \x01(\x05R\x06offset\"\xd4\x01\n" + + "\x14GetFollowersResponse\x12B\n" + + "\tfollowers\x18\x01 \x03(\v2$.proto.GetFollowersResponse.FollowerR\tfollowers\x12\x1f\n" + + "\vtotal_count\x18\x02 \x01(\x05R\n" + + "totalCount\x1aW\n" + + "\bFollower\x12\x17\n" + + "\auser_id\x18\x01 \x01(\x05R\x06userId\x12\x1a\n" + + "\busername\x18\x02 \x01(\tR\busername\x12\x16\n" + + "\x06avatar\x18\x03 \x01(\tR\x06avatar\"\\\n" + + "\x13GetFollowingRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\x05R\x06userId\x12\x14\n" + + "\x05limit\x18\x02 \x01(\x05R\x05limit\x12\x16\n" + + "\x06offset\x18\x03 \x01(\x05R\x06offset\"\xd6\x01\n" + + "\x14GetFollowingResponse\x12C\n" + + "\tfollowing\x18\x01 \x03(\v2%.proto.GetFollowingResponse.FollowingR\tfollowing\x12\x1f\n" + + "\vtotal_count\x18\x02 \x01(\x05R\n" + + "totalCount\x1aX\n" + + "\tFollowing\x12\x17\n" + + "\auser_id\x18\x01 \x01(\x05R\x06userId\x12\x1a\n" + + "\busername\x18\x02 \x01(\tR\busername\x12\x16\n" + + "\x06avatar\x18\x03 \x01(\tR\x06avatar\"X\n" + + "\x12IsFollowingRequest\x12\x1f\n" + + "\vfollower_id\x18\x01 \x01(\x05R\n" + + "followerId\x12!\n" + + "\ffollowing_id\x18\x02 \x01(\x05R\vfollowingId\"8\n" + + "\x13IsFollowingResponse\x12!\n" + + "\fis_following\x18\x01 \x01(\bR\visFollowing\"\x81\x01\n" + + "\x17GetNotificationsRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\x05R\x06userId\x12\x1f\n" + + "\vunread_only\x18\x02 \x01(\bR\n" + + "unreadOnly\x12\x14\n" + + "\x05limit\x18\x03 \x01(\x05R\x05limit\x12\x16\n" + + "\x06offset\x18\x04 \x01(\x05R\x06offset\"\xca\x03\n" + + "\x18GetNotificationsResponse\x12R\n" + + "\rnotifications\x18\x01 \x03(\v2,.proto.GetNotificationsResponse.NotificationR\rnotifications\x12\x1f\n" + + "\vtotal_count\x18\x02 \x01(\x05R\n" + + "totalCount\x12!\n" + + "\funread_count\x18\x03 \x01(\x05R\vunreadCount\x1a\x95\x02\n" + + "\fNotification\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x05R\x02id\x12'\n" + + "\x0fsubscription_id\x18\x02 \x01(\x05R\x0esubscriptionId\x12\x1f\n" + + "\vfollower_id\x18\x03 \x01(\x05R\n" + + "followerId\x12+\n" + + "\x11follower_username\x18\x04 \x01(\tR\x10followerUsername\x12'\n" + + "\x0ffollower_avatar\x18\x05 \x01(\tR\x0efollowerAvatar\x12\x17\n" + + "\ais_read\x18\x06 \x01(\bR\x06isRead\x12\x1d\n" + + "\n" + + "created_at\x18\a \x01(\tR\tcreatedAt\x12\x1d\n" + + "\n" + + "expires_at\x18\b \x01(\tR\texpiresAt\"_\n" + + "\x1bMarkNotificationReadRequest\x12'\n" + + "\x0fnotification_id\x18\x01 \x01(\x05R\x0enotificationId\x12\x17\n" + + "\auser_id\x18\x02 \x01(\x05R\x06userId\"R\n" + + "\x1cMarkNotificationReadResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x18\n" + + "\amessage\x18\x02 \x01(\tR\amessage2\xb6\x05\n" + + "\x10SubscribeService\x129\n" + + "\n" + + "FollowUser\x12\x14.proto.FollowRequest\x1a\x15.proto.FollowResponse\x12?\n" + + "\fUnfollowUser\x12\x16.proto.UnfollowRequest\x1a\x17.proto.UnfollowResponse\x12G\n" + + "\fGetFollowers\x12\x1a.proto.GetFollowersRequest\x1a\x1b.proto.GetFollowersResponse\x12G\n" + + "\fGetFollowing\x12\x1a.proto.GetFollowingRequest\x1a\x1b.proto.GetFollowingResponse\x12D\n" + + "\vIsFollowing\x12\x19.proto.IsFollowingRequest\x1a\x1a.proto.IsFollowingResponse\x12_\n" + + "\x1cGetSubscriptionNotifications\x12\x1e.proto.GetNotificationsRequest\x1a\x1f.proto.GetNotificationsResponse\x12a\n" + + "\x16MarkNotificationAsRead\x12\".proto.MarkNotificationReadRequest\x1a#.proto.MarkNotificationReadResponse\x12D\n" + + "\x11GetFollowersCount\x12\x16.proto.GetCountRequest\x1a\x17.proto.GetCountResponse\x12D\n" + + "\x11GetFollowingCount\x12\x16.proto.GetCountRequest\x1a\x17.proto.GetCountResponseB\tZ\a.;protob\x06proto3" + +var ( + file_subscribe_proto_rawDescOnce sync.Once + file_subscribe_proto_rawDescData []byte +) + +func file_subscribe_proto_rawDescGZIP() []byte { + file_subscribe_proto_rawDescOnce.Do(func() { + file_subscribe_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_subscribe_proto_rawDesc), len(file_subscribe_proto_rawDesc))) + }) + return file_subscribe_proto_rawDescData +} + +var file_subscribe_proto_msgTypes = make([]protoimpl.MessageInfo, 19) +var file_subscribe_proto_goTypes = []any{ + (*GetCountRequest)(nil), // 0: proto.GetCountRequest + (*GetCountResponse)(nil), // 1: proto.GetCountResponse + (*FollowRequest)(nil), // 2: proto.FollowRequest + (*FollowResponse)(nil), // 3: proto.FollowResponse + (*UnfollowRequest)(nil), // 4: proto.UnfollowRequest + (*UnfollowResponse)(nil), // 5: proto.UnfollowResponse + (*GetFollowersRequest)(nil), // 6: proto.GetFollowersRequest + (*GetFollowersResponse)(nil), // 7: proto.GetFollowersResponse + (*GetFollowingRequest)(nil), // 8: proto.GetFollowingRequest + (*GetFollowingResponse)(nil), // 9: proto.GetFollowingResponse + (*IsFollowingRequest)(nil), // 10: proto.IsFollowingRequest + (*IsFollowingResponse)(nil), // 11: proto.IsFollowingResponse + (*GetNotificationsRequest)(nil), // 12: proto.GetNotificationsRequest + (*GetNotificationsResponse)(nil), // 13: proto.GetNotificationsResponse + (*MarkNotificationReadRequest)(nil), // 14: proto.MarkNotificationReadRequest + (*MarkNotificationReadResponse)(nil), // 15: proto.MarkNotificationReadResponse + (*GetFollowersResponse_Follower)(nil), // 16: proto.GetFollowersResponse.Follower + (*GetFollowingResponse_Following)(nil), // 17: proto.GetFollowingResponse.Following + (*GetNotificationsResponse_Notification)(nil), // 18: proto.GetNotificationsResponse.Notification +} +var file_subscribe_proto_depIdxs = []int32{ + 16, // 0: proto.GetFollowersResponse.followers:type_name -> proto.GetFollowersResponse.Follower + 17, // 1: proto.GetFollowingResponse.following:type_name -> proto.GetFollowingResponse.Following + 18, // 2: proto.GetNotificationsResponse.notifications:type_name -> proto.GetNotificationsResponse.Notification + 2, // 3: proto.SubscribeService.FollowUser:input_type -> proto.FollowRequest + 4, // 4: proto.SubscribeService.UnfollowUser:input_type -> proto.UnfollowRequest + 6, // 5: proto.SubscribeService.GetFollowers:input_type -> proto.GetFollowersRequest + 8, // 6: proto.SubscribeService.GetFollowing:input_type -> proto.GetFollowingRequest + 10, // 7: proto.SubscribeService.IsFollowing:input_type -> proto.IsFollowingRequest + 12, // 8: proto.SubscribeService.GetSubscriptionNotifications:input_type -> proto.GetNotificationsRequest + 14, // 9: proto.SubscribeService.MarkNotificationAsRead:input_type -> proto.MarkNotificationReadRequest + 0, // 10: proto.SubscribeService.GetFollowersCount:input_type -> proto.GetCountRequest + 0, // 11: proto.SubscribeService.GetFollowingCount:input_type -> proto.GetCountRequest + 3, // 12: proto.SubscribeService.FollowUser:output_type -> proto.FollowResponse + 5, // 13: proto.SubscribeService.UnfollowUser:output_type -> proto.UnfollowResponse + 7, // 14: proto.SubscribeService.GetFollowers:output_type -> proto.GetFollowersResponse + 9, // 15: proto.SubscribeService.GetFollowing:output_type -> proto.GetFollowingResponse + 11, // 16: proto.SubscribeService.IsFollowing:output_type -> proto.IsFollowingResponse + 13, // 17: proto.SubscribeService.GetSubscriptionNotifications:output_type -> proto.GetNotificationsResponse + 15, // 18: proto.SubscribeService.MarkNotificationAsRead:output_type -> proto.MarkNotificationReadResponse + 1, // 19: proto.SubscribeService.GetFollowersCount:output_type -> proto.GetCountResponse + 1, // 20: proto.SubscribeService.GetFollowingCount:output_type -> proto.GetCountResponse + 12, // [12:21] is the sub-list for method output_type + 3, // [3:12] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_subscribe_proto_init() } +func file_subscribe_proto_init() { + if File_subscribe_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_subscribe_proto_rawDesc), len(file_subscribe_proto_rawDesc)), + NumEnums: 0, + NumMessages: 19, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_subscribe_proto_goTypes, + DependencyIndexes: file_subscribe_proto_depIdxs, + MessageInfos: file_subscribe_proto_msgTypes, + }.Build() + File_subscribe_proto = out.File + file_subscribe_proto_goTypes = nil + file_subscribe_proto_depIdxs = nil +} diff --git a/proto/subscribe.proto b/proto/subscribe.proto new file mode 100644 index 0000000..8dd9127 --- /dev/null +++ b/proto/subscribe.proto @@ -0,0 +1,154 @@ +syntax = "proto3"; + +package proto; + +option go_package = ".;proto"; + +// Сервис для работы с подписками +service SubscribeService { + // Подписаться на пользователя + rpc FollowUser (FollowRequest) returns (FollowResponse); + + // Отписаться от пользователя + rpc UnfollowUser (UnfollowRequest) returns (UnfollowResponse); + + // Получить список подписчиков пользователя + rpc GetFollowers (GetFollowersRequest) returns (GetFollowersResponse); + + // Получить список подписок пользователя + rpc GetFollowing (GetFollowingRequest) returns (GetFollowingResponse); + + // Проверить, подписан ли пользователь на другого + rpc IsFollowing (IsFollowingRequest) returns (IsFollowingResponse); + + // Получить уведомления о подписках для пользователя + rpc GetSubscriptionNotifications (GetNotificationsRequest) returns (GetNotificationsResponse); + + // Пометить уведомление как прочитанное + rpc MarkNotificationAsRead (MarkNotificationReadRequest) returns (MarkNotificationReadResponse); + + // Получить только КОЛИЧЕСТВО подписчиков + rpc GetFollowersCount (GetCountRequest) returns (GetCountResponse); + + // Получить только КОЛИЧЕСТВО подписок + rpc GetFollowingCount (GetCountRequest) returns (GetCountResponse); +} + +message GetCountRequest { + int32 user_id = 1; +} + +// Ответ с количеством +message GetCountResponse { + int32 count = 1; +} + +// Запрос на подписку +message FollowRequest { + int32 follower_id = 1; // ID пользователя, который подписывается + int32 following_id = 2; // ID пользователя, на которого подписываются +} + +// Ответ на подписку +message FollowResponse { + bool success = 1; // Успешность операции + string message = 2; // Сообщение (например, об ошибке) + int32 subscription_id = 3; // ID созданной подписки + int32 notification_id = 4; // ID созданного уведомления +} + +// Запрос на отписку +message UnfollowRequest { + int32 follower_id = 1; + int32 following_id = 2; +} + +// Ответ на отписку +message UnfollowResponse { + bool success = 1; + string message = 2; +} + +// Запрос на получение подписчиков +message GetFollowersRequest { + int32 user_id = 1; // ID пользователя, чьих подписчиков запрашиваем + int32 limit = 2; // Лимит (для пагинации) + int32 offset = 3; // Смещение (для пагинации) +} + +// Ответ с подписчиками +message GetFollowersResponse { + repeated Follower followers = 1; // Список подписчиков + int32 total_count = 2; // Общее количество подписчиков + message Follower { + int32 user_id = 1; + string username = 2; + string avatar = 3; + } +} + +// Запрос на получение подписок +message GetFollowingRequest { + int32 user_id = 1; // ID пользователя, чьи подписки запрашиваем + int32 limit = 2; + int32 offset = 3; +} + +// Ответ с подписками +message GetFollowingResponse { + repeated Following following = 1; // Список подписок + int32 total_count = 2; // Общее количество подписок + message Following { + int32 user_id = 1; + string username = 2; + string avatar = 3; + } +} + +// Запрос на проверку подписки +message IsFollowingRequest { + int32 follower_id = 1; + int32 following_id = 2; +} + +// Ответ на проверку подписки +message IsFollowingResponse { + bool is_following = 1; // true - подписан, false - не подписан +} + +// Запрос на получение уведомлений +message GetNotificationsRequest { + int32 user_id = 1; // ID пользователя, чьи уведомления запрашиваем + bool unread_only = 2; // Только непрочитанные + int32 limit = 3; + int32 offset = 4; +} + +// Ответ с уведомлениями +message GetNotificationsResponse { + repeated Notification notifications = 1; + int32 total_count = 2; + int32 unread_count = 3; // Количество непрочитанных уведомлений + message Notification { + int32 id = 1; + int32 subscription_id = 2; + int32 follower_id = 3; + string follower_username = 4; + string follower_avatar = 5; + bool is_read = 6; + string created_at = 7; + string expires_at = 8; + } +} + +// Запрос на пометку уведомления как прочитанного +message MarkNotificationReadRequest { + int32 notification_id = 1; + int32 user_id = 2; // Для проверки прав +} + +// Ответ на пометку уведомления +message MarkNotificationReadResponse { + bool success = 1; + string message = 2; +} \ No newline at end of file diff --git a/proto/subscribe_grpc.pb.go b/proto/subscribe_grpc.pb.go new file mode 100644 index 0000000..cbc8d88 --- /dev/null +++ b/proto/subscribe_grpc.pb.go @@ -0,0 +1,447 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v3.21.12 +// source: subscribe.proto + +package proto + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + SubscribeService_FollowUser_FullMethodName = "/proto.SubscribeService/FollowUser" + SubscribeService_UnfollowUser_FullMethodName = "/proto.SubscribeService/UnfollowUser" + SubscribeService_GetFollowers_FullMethodName = "/proto.SubscribeService/GetFollowers" + SubscribeService_GetFollowing_FullMethodName = "/proto.SubscribeService/GetFollowing" + SubscribeService_IsFollowing_FullMethodName = "/proto.SubscribeService/IsFollowing" + SubscribeService_GetSubscriptionNotifications_FullMethodName = "/proto.SubscribeService/GetSubscriptionNotifications" + SubscribeService_MarkNotificationAsRead_FullMethodName = "/proto.SubscribeService/MarkNotificationAsRead" + SubscribeService_GetFollowersCount_FullMethodName = "/proto.SubscribeService/GetFollowersCount" + SubscribeService_GetFollowingCount_FullMethodName = "/proto.SubscribeService/GetFollowingCount" +) + +// SubscribeServiceClient is the client API for SubscribeService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// Сервис для работы с подписками +type SubscribeServiceClient interface { + // Подписаться на пользователя + FollowUser(ctx context.Context, in *FollowRequest, opts ...grpc.CallOption) (*FollowResponse, error) + // Отписаться от пользователя + UnfollowUser(ctx context.Context, in *UnfollowRequest, opts ...grpc.CallOption) (*UnfollowResponse, error) + // Получить список подписчиков пользователя + GetFollowers(ctx context.Context, in *GetFollowersRequest, opts ...grpc.CallOption) (*GetFollowersResponse, error) + // Получить список подписок пользователя + GetFollowing(ctx context.Context, in *GetFollowingRequest, opts ...grpc.CallOption) (*GetFollowingResponse, error) + // Проверить, подписан ли пользователь на другого + IsFollowing(ctx context.Context, in *IsFollowingRequest, opts ...grpc.CallOption) (*IsFollowingResponse, error) + // Получить уведомления о подписках для пользователя + GetSubscriptionNotifications(ctx context.Context, in *GetNotificationsRequest, opts ...grpc.CallOption) (*GetNotificationsResponse, error) + // Пометить уведомление как прочитанное + MarkNotificationAsRead(ctx context.Context, in *MarkNotificationReadRequest, opts ...grpc.CallOption) (*MarkNotificationReadResponse, error) + // Получить только КОЛИЧЕСТВО подписчиков + GetFollowersCount(ctx context.Context, in *GetCountRequest, opts ...grpc.CallOption) (*GetCountResponse, error) + // Получить только КОЛИЧЕСТВО подписок + GetFollowingCount(ctx context.Context, in *GetCountRequest, opts ...grpc.CallOption) (*GetCountResponse, error) +} + +type subscribeServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewSubscribeServiceClient(cc grpc.ClientConnInterface) SubscribeServiceClient { + return &subscribeServiceClient{cc} +} + +func (c *subscribeServiceClient) FollowUser(ctx context.Context, in *FollowRequest, opts ...grpc.CallOption) (*FollowResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(FollowResponse) + err := c.cc.Invoke(ctx, SubscribeService_FollowUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *subscribeServiceClient) UnfollowUser(ctx context.Context, in *UnfollowRequest, opts ...grpc.CallOption) (*UnfollowResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UnfollowResponse) + err := c.cc.Invoke(ctx, SubscribeService_UnfollowUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *subscribeServiceClient) GetFollowers(ctx context.Context, in *GetFollowersRequest, opts ...grpc.CallOption) (*GetFollowersResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetFollowersResponse) + err := c.cc.Invoke(ctx, SubscribeService_GetFollowers_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *subscribeServiceClient) GetFollowing(ctx context.Context, in *GetFollowingRequest, opts ...grpc.CallOption) (*GetFollowingResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetFollowingResponse) + err := c.cc.Invoke(ctx, SubscribeService_GetFollowing_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *subscribeServiceClient) IsFollowing(ctx context.Context, in *IsFollowingRequest, opts ...grpc.CallOption) (*IsFollowingResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(IsFollowingResponse) + err := c.cc.Invoke(ctx, SubscribeService_IsFollowing_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *subscribeServiceClient) GetSubscriptionNotifications(ctx context.Context, in *GetNotificationsRequest, opts ...grpc.CallOption) (*GetNotificationsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetNotificationsResponse) + err := c.cc.Invoke(ctx, SubscribeService_GetSubscriptionNotifications_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *subscribeServiceClient) MarkNotificationAsRead(ctx context.Context, in *MarkNotificationReadRequest, opts ...grpc.CallOption) (*MarkNotificationReadResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MarkNotificationReadResponse) + err := c.cc.Invoke(ctx, SubscribeService_MarkNotificationAsRead_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *subscribeServiceClient) GetFollowersCount(ctx context.Context, in *GetCountRequest, opts ...grpc.CallOption) (*GetCountResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetCountResponse) + err := c.cc.Invoke(ctx, SubscribeService_GetFollowersCount_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *subscribeServiceClient) GetFollowingCount(ctx context.Context, in *GetCountRequest, opts ...grpc.CallOption) (*GetCountResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetCountResponse) + err := c.cc.Invoke(ctx, SubscribeService_GetFollowingCount_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SubscribeServiceServer is the server API for SubscribeService service. +// All implementations must embed UnimplementedSubscribeServiceServer +// for forward compatibility. +// +// Сервис для работы с подписками +type SubscribeServiceServer interface { + // Подписаться на пользователя + FollowUser(context.Context, *FollowRequest) (*FollowResponse, error) + // Отписаться от пользователя + UnfollowUser(context.Context, *UnfollowRequest) (*UnfollowResponse, error) + // Получить список подписчиков пользователя + GetFollowers(context.Context, *GetFollowersRequest) (*GetFollowersResponse, error) + // Получить список подписок пользователя + GetFollowing(context.Context, *GetFollowingRequest) (*GetFollowingResponse, error) + // Проверить, подписан ли пользователь на другого + IsFollowing(context.Context, *IsFollowingRequest) (*IsFollowingResponse, error) + // Получить уведомления о подписках для пользователя + GetSubscriptionNotifications(context.Context, *GetNotificationsRequest) (*GetNotificationsResponse, error) + // Пометить уведомление как прочитанное + MarkNotificationAsRead(context.Context, *MarkNotificationReadRequest) (*MarkNotificationReadResponse, error) + // Получить только КОЛИЧЕСТВО подписчиков + GetFollowersCount(context.Context, *GetCountRequest) (*GetCountResponse, error) + // Получить только КОЛИЧЕСТВО подписок + GetFollowingCount(context.Context, *GetCountRequest) (*GetCountResponse, error) + mustEmbedUnimplementedSubscribeServiceServer() +} + +// UnimplementedSubscribeServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedSubscribeServiceServer struct{} + +func (UnimplementedSubscribeServiceServer) FollowUser(context.Context, *FollowRequest) (*FollowResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FollowUser not implemented") +} +func (UnimplementedSubscribeServiceServer) UnfollowUser(context.Context, *UnfollowRequest) (*UnfollowResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UnfollowUser not implemented") +} +func (UnimplementedSubscribeServiceServer) GetFollowers(context.Context, *GetFollowersRequest) (*GetFollowersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetFollowers not implemented") +} +func (UnimplementedSubscribeServiceServer) GetFollowing(context.Context, *GetFollowingRequest) (*GetFollowingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetFollowing not implemented") +} +func (UnimplementedSubscribeServiceServer) IsFollowing(context.Context, *IsFollowingRequest) (*IsFollowingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method IsFollowing not implemented") +} +func (UnimplementedSubscribeServiceServer) GetSubscriptionNotifications(context.Context, *GetNotificationsRequest) (*GetNotificationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSubscriptionNotifications not implemented") +} +func (UnimplementedSubscribeServiceServer) MarkNotificationAsRead(context.Context, *MarkNotificationReadRequest) (*MarkNotificationReadResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MarkNotificationAsRead not implemented") +} +func (UnimplementedSubscribeServiceServer) GetFollowersCount(context.Context, *GetCountRequest) (*GetCountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetFollowersCount not implemented") +} +func (UnimplementedSubscribeServiceServer) GetFollowingCount(context.Context, *GetCountRequest) (*GetCountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetFollowingCount not implemented") +} +func (UnimplementedSubscribeServiceServer) mustEmbedUnimplementedSubscribeServiceServer() {} +func (UnimplementedSubscribeServiceServer) testEmbeddedByValue() {} + +// UnsafeSubscribeServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to SubscribeServiceServer will +// result in compilation errors. +type UnsafeSubscribeServiceServer interface { + mustEmbedUnimplementedSubscribeServiceServer() +} + +func RegisterSubscribeServiceServer(s grpc.ServiceRegistrar, srv SubscribeServiceServer) { + // If the following call pancis, it indicates UnimplementedSubscribeServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&SubscribeService_ServiceDesc, srv) +} + +func _SubscribeService_FollowUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FollowRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SubscribeServiceServer).FollowUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SubscribeService_FollowUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SubscribeServiceServer).FollowUser(ctx, req.(*FollowRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SubscribeService_UnfollowUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UnfollowRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SubscribeServiceServer).UnfollowUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SubscribeService_UnfollowUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SubscribeServiceServer).UnfollowUser(ctx, req.(*UnfollowRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SubscribeService_GetFollowers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetFollowersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SubscribeServiceServer).GetFollowers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SubscribeService_GetFollowers_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SubscribeServiceServer).GetFollowers(ctx, req.(*GetFollowersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SubscribeService_GetFollowing_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetFollowingRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SubscribeServiceServer).GetFollowing(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SubscribeService_GetFollowing_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SubscribeServiceServer).GetFollowing(ctx, req.(*GetFollowingRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SubscribeService_IsFollowing_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(IsFollowingRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SubscribeServiceServer).IsFollowing(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SubscribeService_IsFollowing_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SubscribeServiceServer).IsFollowing(ctx, req.(*IsFollowingRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SubscribeService_GetSubscriptionNotifications_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetNotificationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SubscribeServiceServer).GetSubscriptionNotifications(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SubscribeService_GetSubscriptionNotifications_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SubscribeServiceServer).GetSubscriptionNotifications(ctx, req.(*GetNotificationsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SubscribeService_MarkNotificationAsRead_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MarkNotificationReadRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SubscribeServiceServer).MarkNotificationAsRead(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SubscribeService_MarkNotificationAsRead_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SubscribeServiceServer).MarkNotificationAsRead(ctx, req.(*MarkNotificationReadRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SubscribeService_GetFollowersCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCountRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SubscribeServiceServer).GetFollowersCount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SubscribeService_GetFollowersCount_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SubscribeServiceServer).GetFollowersCount(ctx, req.(*GetCountRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SubscribeService_GetFollowingCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCountRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SubscribeServiceServer).GetFollowingCount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SubscribeService_GetFollowingCount_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SubscribeServiceServer).GetFollowingCount(ctx, req.(*GetCountRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// SubscribeService_ServiceDesc is the grpc.ServiceDesc for SubscribeService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var SubscribeService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "proto.SubscribeService", + HandlerType: (*SubscribeServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "FollowUser", + Handler: _SubscribeService_FollowUser_Handler, + }, + { + MethodName: "UnfollowUser", + Handler: _SubscribeService_UnfollowUser_Handler, + }, + { + MethodName: "GetFollowers", + Handler: _SubscribeService_GetFollowers_Handler, + }, + { + MethodName: "GetFollowing", + Handler: _SubscribeService_GetFollowing_Handler, + }, + { + MethodName: "IsFollowing", + Handler: _SubscribeService_IsFollowing_Handler, + }, + { + MethodName: "GetSubscriptionNotifications", + Handler: _SubscribeService_GetSubscriptionNotifications_Handler, + }, + { + MethodName: "MarkNotificationAsRead", + Handler: _SubscribeService_MarkNotificationAsRead_Handler, + }, + { + MethodName: "GetFollowersCount", + Handler: _SubscribeService_GetFollowersCount_Handler, + }, + { + MethodName: "GetFollowingCount", + Handler: _SubscribeService_GetFollowingCount_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "subscribe.proto", +}