generated from VLADIMIR/template
41 lines
1.7 KiB
Go
41 lines
1.7 KiB
Go
package app
|
|
|
|
import (
|
|
"context"
|
|
|
|
"evening_detective_server/docs"
|
|
proto "evening_detective_server/proto"
|
|
"google.golang.org/grpc/codes"
|
|
"google.golang.org/grpc/status"
|
|
)
|
|
|
|
// GetTerms возвращает текст Пользовательского соглашения (постоянный URL
|
|
// /api/terms, на который ссылается форма регистрации при акцепте).
|
|
func (s *server) GetTerms(_ context.Context, _ *proto.GetTermsReq) (*proto.GetTermsRsp, error) {
|
|
text, err := docs.FS.ReadFile("TERMS.md")
|
|
if err != nil {
|
|
return nil, status.Error(codes.Internal, "не удалось получить документ")
|
|
}
|
|
return &proto.GetTermsRsp{Text: string(text)}, nil
|
|
}
|
|
|
|
// GetPrivacy возвращает текст Политики конфиденциальности (постоянный URL
|
|
// /api/privacy).
|
|
func (s *server) GetPrivacy(_ context.Context, _ *proto.GetPrivacyReq) (*proto.GetPrivacyRsp, error) {
|
|
text, err := docs.FS.ReadFile("PRIVACY.md")
|
|
if err != nil {
|
|
return nil, status.Error(codes.Internal, "не удалось получить документ")
|
|
}
|
|
return &proto.GetPrivacyRsp{Text: string(text)}, nil
|
|
}
|
|
|
|
// GetConsent возвращает текст согласия на обработку персональных данных
|
|
// (постоянный URL /api/consent).
|
|
func (s *server) GetConsent(_ context.Context, _ *proto.GetConsentReq) (*proto.GetConsentRsp, error) {
|
|
text, err := docs.FS.ReadFile("CONSENT.md")
|
|
if err != nil {
|
|
return nil, status.Error(codes.Internal, "не удалось получить документ")
|
|
}
|
|
return &proto.GetConsentRsp{Text: string(text)}, nil
|
|
}
|