From a910e6c624493112ea069f4ab42629d716078185 Mon Sep 17 00:00:00 2001 From: claude Date: Thu, 26 Mar 2026 13:28:51 +0000 Subject: [PATCH] feat: Refactor account service by integrating GetUsage method and removing Usage service --- go.mod | 10 -- go.sum | 45 ------- internal/api/proto/app/v1/account.pb.go | 11 +- internal/api/proto/app/v1/account_grpc.pb.go | 134 +++++-------------- internal/service/register.go | 1 - internal/service/service_core.go | 4 - proto/app/v1/account.proto | 3 - 7 files changed, 40 insertions(+), 168 deletions(-) diff --git a/go.mod b/go.mod index 7c7070b..98f3c79 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,6 @@ require ( github.com/aws/aws-sdk-go-v2/credentials v1.19.7 github.com/aws/aws-sdk-go-v2/service/s3 v1.95.1 github.com/eclipse/paho.mqtt.golang v1.5.1 - github.com/golang-jwt/jwt/v5 v5.3.0 github.com/google/uuid v1.6.0 github.com/lib/pq v1.11.2 github.com/redis/go-redis/v9 v9.17.2 @@ -45,7 +44,6 @@ require ( github.com/aws/smithy-go v1.24.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect - github.com/dustin/go-humanize v1.0.1 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-sql-driver/mysql v1.8.1 // indirect github.com/go-viper/mapstructure/v2 v2.4.0 // indirect @@ -56,11 +54,8 @@ require ( github.com/jackc/puddle/v2 v2.2.2 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect - github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-sqlite3 v1.14.22 // indirect - github.com/ncruces/go-strftime v1.0.0 // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect - github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/rogpeppe/go-internal v1.14.1 // indirect github.com/sagikazarmark/locafero v0.11.0 // indirect github.com/sony/gobreaker v1.0.0 @@ -71,7 +66,6 @@ require ( github.com/subosito/gotenv v1.6.0 // indirect go.uber.org/multierr v1.10.0 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect - golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 // indirect golang.org/x/mod v0.32.0 // indirect golang.org/x/net v0.49.0 // indirect golang.org/x/sync v0.19.0 // indirect @@ -82,8 +76,4 @@ require ( gorm.io/datatypes v1.2.4 gorm.io/driver/mysql v1.5.7 // indirect gorm.io/hints v1.1.0 // indirect - modernc.org/libc v1.67.6 // indirect - modernc.org/mathutil v1.7.1 // indirect - modernc.org/memory v1.11.0 // indirect - modernc.org/sqlite v1.46.1 ) diff --git a/go.sum b/go.sum index 2481972..673dd9b 100644 --- a/go.sum +++ b/go.sum @@ -51,8 +51,6 @@ 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/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= -github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/eclipse/paho.mqtt.golang v1.5.1 h1:/VSOv3oDLlpqR2Epjn1Q7b2bSTplJIeV2ISgCl2W7nE= github.com/eclipse/paho.mqtt.golang v1.5.1/go.mod h1:1/yJCneuyOoCOzKSsOTUc0AJfpsItBGWvYpBLimhArU= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= @@ -68,8 +66,6 @@ github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpv github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= 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.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo= -github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA= github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A= @@ -78,14 +74,10 @@ 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.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs= -github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA= 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/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/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= @@ -105,23 +97,17 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lib/pq v1.11.2 h1:x6gxUeu39V0BHZiugWe8LXZYZ+Utk7hSJGThs8sdzfs= github.com/lib/pq v1.11.2/go.mod h1:/p+8NSbOcwzAEI7wiMXFlgydTwcgTr3OSKMsD2BitpA= -github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= -github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-sqlite3 v1.14.8/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU= github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/microsoft/go-mssqldb v0.17.0 h1:Fto83dMZPnYv1Zwx5vHHxpNraeEaUlQ/hhHLgZiaenE= github.com/microsoft/go-mssqldb v0.17.0/go.mod h1:OkoNGhGEs8EZqchVTtochlXruEhEOaO4S0d2sB5aeGQ= -github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOFAw7w= -github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= 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/redis/go-redis/v9 v9.17.2 h1:P2EGsA4qVIM3Pp+aPocCJ7DguDHhqrXNhVcEp4ViluI= github.com/redis/go-redis/v9 v9.17.2/go.mod h1:u410H11HMLoB+TP67dz8rL9s6QW2j76l0//kSOd3370= -github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= -github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/sagikazarmark/locafero v0.11.0 h1:1iurJgmM9G3PA/I+wWYIOw/5SyBtxapeHDcg+AAIFXc= @@ -167,8 +153,6 @@ go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/crypto v0.47.0 h1:V6e3FRj+n4dbpw86FJ8Fv7XVOql7TEwpHapKoMJ/GO8= golang.org/x/crypto v0.47.0/go.mod h1:ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A= -golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 h1:mgKeJMpvi0yx/sU5GsxQ7p6s2wtOnGAHZWCHUM4KGzY= -golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546/go.mod h1:j/pmGrbnkbPtQfxEe5D0VQhZC6qKbfKifgD0oM7sR70= golang.org/x/mod v0.32.0 h1:9F4d3PHLljb6x//jOyokMv3eX+YDeepZSEo3mFJy93c= golang.org/x/mod v0.32.0/go.mod h1:SgipZ/3h2Ci89DlEtEXWUk/HteuRin+HHhN+WbNhguU= golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o= @@ -177,7 +161,6 @@ golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw= golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ= golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE= @@ -220,31 +203,3 @@ gorm.io/hints v1.1.0 h1:Lp4z3rxREufSdxn4qmkK3TLDltrM10FLTHiuqwDPvXw= gorm.io/hints v1.1.0/go.mod h1:lKQ0JjySsPBj3uslFzY3JhYDtqEwzm+G1hv8rWujB6Y= gorm.io/plugin/dbresolver v1.6.2 h1:F4b85TenghUeITqe3+epPSUtHH7RIk3fXr5l83DF8Pc= gorm.io/plugin/dbresolver v1.6.2/go.mod h1:tctw63jdrOezFR9HmrKnPkmig3m5Edem9fdxk9bQSzM= -modernc.org/cc/v4 v4.27.1 h1:9W30zRlYrefrDV2JE2O8VDtJ1yPGownxciz5rrbQZis= -modernc.org/cc/v4 v4.27.1/go.mod h1:uVtb5OGqUKpoLWhqwNQo/8LwvoiEBLvZXIQ/SmO6mL0= -modernc.org/ccgo/v4 v4.30.1 h1:4r4U1J6Fhj98NKfSjnPUN7Ze2c6MnAdL0hWw6+LrJpc= -modernc.org/ccgo/v4 v4.30.1/go.mod h1:bIOeI1JL54Utlxn+LwrFyjCx2n2RDiYEaJVSrgdrRfM= -modernc.org/fileutil v1.3.40 h1:ZGMswMNc9JOCrcrakF1HrvmergNLAmxOPjizirpfqBA= -modernc.org/fileutil v1.3.40/go.mod h1:HxmghZSZVAz/LXcMNwZPA/DRrQZEVP9VX0V4LQGQFOc= -modernc.org/gc/v2 v2.6.5 h1:nyqdV8q46KvTpZlsw66kWqwXRHdjIlJOhG6kxiV/9xI= -modernc.org/gc/v2 v2.6.5/go.mod h1:YgIahr1ypgfe7chRuJi2gD7DBQiKSLMPgBQe9oIiito= -modernc.org/gc/v3 v3.1.1 h1:k8T3gkXWY9sEiytKhcgyiZ2L0DTyCQ/nvX+LoCljoRE= -modernc.org/gc/v3 v3.1.1/go.mod h1:HFK/6AGESC7Ex+EZJhJ2Gni6cTaYpSMmU/cT9RmlfYY= -modernc.org/goabi0 v0.2.0 h1:HvEowk7LxcPd0eq6mVOAEMai46V+i7Jrj13t4AzuNks= -modernc.org/goabi0 v0.2.0/go.mod h1:CEFRnnJhKvWT1c1JTI3Avm+tgOWbkOu5oPA8eH8LnMI= -modernc.org/libc v1.67.6 h1:eVOQvpModVLKOdT+LvBPjdQqfrZq+pC39BygcT+E7OI= -modernc.org/libc v1.67.6/go.mod h1:JAhxUVlolfYDErnwiqaLvUqc8nfb2r6S6slAgZOnaiE= -modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU= -modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg= -modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI= -modernc.org/memory v1.11.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw= -modernc.org/opt v0.1.4 h1:2kNGMRiUjrp4LcaPuLY2PzUfqM/w9N23quVwhKt5Qm8= -modernc.org/opt v0.1.4/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns= -modernc.org/sortutil v1.2.1 h1:+xyoGf15mM3NMlPDnFqrteY07klSFxLElE2PVuWIJ7w= -modernc.org/sortutil v1.2.1/go.mod h1:7ZI3a3REbai7gzCLcotuw9AC4VZVpYMjDzETGsSMqJE= -modernc.org/sqlite v1.46.1 h1:eFJ2ShBLIEnUWlLy12raN0Z1plqmFX9Qe3rjQTKt6sU= -modernc.org/sqlite v1.46.1/go.mod h1:CzbrU2lSB1DKUusvwGz7rqEKIq+NUd8GWuBBZDs9/nA= -modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0= -modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A= -modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= -modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= diff --git a/internal/api/proto/app/v1/account.pb.go b/internal/api/proto/app/v1/account.pb.go index 7a00cf6..91fdc79 100644 --- a/internal/api/proto/app/v1/account.pb.go +++ b/internal/api/proto/app/v1/account.pb.go @@ -968,7 +968,7 @@ const file_app_v1_account_proto_rawDesc = "" + "\x1fMarkAllNotificationsReadRequest\"+\n" + "\x19DeleteNotificationRequest\x12\x0e\n" + "\x02id\x18\x01 \x01(\tR\x02id\"\x1b\n" + - "\x19ClearNotificationsRequest2\xc3\x04\n" + + "\x19ClearNotificationsRequest2\x90\x05\n" + "\aAccount\x12B\n" + "\x05GetMe\x12\x1b.stream.app.v1.GetMeRequest\x1a\x1c.stream.app.v1.GetMeResponse\x12K\n" + "\bUpdateMe\x12\x1e.stream.app.v1.UpdateMeRequest\x1a\x1f.stream.app.v1.UpdateMeResponse\x12J\n" + @@ -976,8 +976,7 @@ const file_app_v1_account_proto_rawDesc = "" + "\vClearMyData\x12!.stream.app.v1.ClearMyDataRequest\x1a\x1e.stream.app.v1.MessageResponse\x12B\n" + "\vGetUserById\x12\x1c.google.protobuf.StringValue\x1a\x13.stream.app.v1.User\"\x00\x12]\n" + "\x0eGetPreferences\x12$.stream.app.v1.GetPreferencesRequest\x1a%.stream.app.v1.GetPreferencesResponse\x12f\n" + - "\x11UpdatePreferences\x12'.stream.app.v1.UpdatePreferencesRequest\x1a(.stream.app.v1.UpdatePreferencesResponse2T\n" + - "\x05Usage\x12K\n" + + "\x11UpdatePreferences\x12'.stream.app.v1.UpdatePreferencesRequest\x1a(.stream.app.v1.UpdatePreferencesResponse\x12K\n" + "\bGetUsage\x12\x1e.stream.app.v1.GetUsageRequest\x1a\x1f.stream.app.v1.GetUsageResponse2\x87\x04\n" + "\rNotifications\x12f\n" + "\x11ListNotifications\x12'.stream.app.v1.ListNotificationsRequest\x1a(.stream.app.v1.ListNotificationsResponse\x12b\n" + @@ -1037,7 +1036,7 @@ var file_app_v1_account_proto_depIdxs = []int32{ 21, // 9: stream.app.v1.Account.GetUserById:input_type -> google.protobuf.StringValue 6, // 10: stream.app.v1.Account.GetPreferences:input_type -> stream.app.v1.GetPreferencesRequest 8, // 11: stream.app.v1.Account.UpdatePreferences:input_type -> stream.app.v1.UpdatePreferencesRequest - 10, // 12: stream.app.v1.Usage.GetUsage:input_type -> stream.app.v1.GetUsageRequest + 10, // 12: stream.app.v1.Account.GetUsage:input_type -> stream.app.v1.GetUsageRequest 12, // 13: stream.app.v1.Notifications.ListNotifications:input_type -> stream.app.v1.ListNotificationsRequest 14, // 14: stream.app.v1.Notifications.MarkNotificationRead:input_type -> stream.app.v1.MarkNotificationReadRequest 15, // 15: stream.app.v1.Notifications.MarkAllNotificationsRead:input_type -> stream.app.v1.MarkAllNotificationsReadRequest @@ -1050,7 +1049,7 @@ var file_app_v1_account_proto_depIdxs = []int32{ 18, // 22: stream.app.v1.Account.GetUserById:output_type -> stream.app.v1.User 7, // 23: stream.app.v1.Account.GetPreferences:output_type -> stream.app.v1.GetPreferencesResponse 9, // 24: stream.app.v1.Account.UpdatePreferences:output_type -> stream.app.v1.UpdatePreferencesResponse - 11, // 25: stream.app.v1.Usage.GetUsage:output_type -> stream.app.v1.GetUsageResponse + 11, // 25: stream.app.v1.Account.GetUsage:output_type -> stream.app.v1.GetUsageResponse 13, // 26: stream.app.v1.Notifications.ListNotifications:output_type -> stream.app.v1.ListNotificationsResponse 22, // 27: stream.app.v1.Notifications.MarkNotificationRead:output_type -> stream.app.v1.MessageResponse 22, // 28: stream.app.v1.Notifications.MarkAllNotificationsRead:output_type -> stream.app.v1.MessageResponse @@ -1079,7 +1078,7 @@ func file_app_v1_account_proto_init() { NumEnums: 0, NumMessages: 18, NumExtensions: 0, - NumServices: 3, + NumServices: 2, }, GoTypes: file_app_v1_account_proto_goTypes, DependencyIndexes: file_app_v1_account_proto_depIdxs, diff --git a/internal/api/proto/app/v1/account_grpc.pb.go b/internal/api/proto/app/v1/account_grpc.pb.go index 46e9abc..b6298a1 100644 --- a/internal/api/proto/app/v1/account_grpc.pb.go +++ b/internal/api/proto/app/v1/account_grpc.pb.go @@ -27,6 +27,7 @@ const ( Account_GetUserById_FullMethodName = "/stream.app.v1.Account/GetUserById" Account_GetPreferences_FullMethodName = "/stream.app.v1.Account/GetPreferences" Account_UpdatePreferences_FullMethodName = "/stream.app.v1.Account/UpdatePreferences" + Account_GetUsage_FullMethodName = "/stream.app.v1.Account/GetUsage" ) // AccountClient is the client API for Account service. @@ -40,6 +41,7 @@ type AccountClient interface { GetUserById(ctx context.Context, in *wrapperspb.StringValue, opts ...grpc.CallOption) (*User, error) GetPreferences(ctx context.Context, in *GetPreferencesRequest, opts ...grpc.CallOption) (*GetPreferencesResponse, error) UpdatePreferences(ctx context.Context, in *UpdatePreferencesRequest, opts ...grpc.CallOption) (*UpdatePreferencesResponse, error) + GetUsage(ctx context.Context, in *GetUsageRequest, opts ...grpc.CallOption) (*GetUsageResponse, error) } type accountClient struct { @@ -120,6 +122,16 @@ func (c *accountClient) UpdatePreferences(ctx context.Context, in *UpdatePrefere return out, nil } +func (c *accountClient) GetUsage(ctx context.Context, in *GetUsageRequest, opts ...grpc.CallOption) (*GetUsageResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetUsageResponse) + err := c.cc.Invoke(ctx, Account_GetUsage_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // AccountServer is the server API for Account service. // All implementations must embed UnimplementedAccountServer // for forward compatibility. @@ -131,6 +143,7 @@ type AccountServer interface { GetUserById(context.Context, *wrapperspb.StringValue) (*User, error) GetPreferences(context.Context, *GetPreferencesRequest) (*GetPreferencesResponse, error) UpdatePreferences(context.Context, *UpdatePreferencesRequest) (*UpdatePreferencesResponse, error) + GetUsage(context.Context, *GetUsageRequest) (*GetUsageResponse, error) mustEmbedUnimplementedAccountServer() } @@ -162,6 +175,9 @@ func (UnimplementedAccountServer) GetPreferences(context.Context, *GetPreference func (UnimplementedAccountServer) UpdatePreferences(context.Context, *UpdatePreferencesRequest) (*UpdatePreferencesResponse, error) { return nil, status.Error(codes.Unimplemented, "method UpdatePreferences not implemented") } +func (UnimplementedAccountServer) GetUsage(context.Context, *GetUsageRequest) (*GetUsageResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetUsage not implemented") +} func (UnimplementedAccountServer) mustEmbedUnimplementedAccountServer() {} func (UnimplementedAccountServer) testEmbeddedByValue() {} @@ -309,6 +325,24 @@ func _Account_UpdatePreferences_Handler(srv interface{}, ctx context.Context, de return interceptor(ctx, in, info, handler) } +func _Account_GetUsage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUsageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AccountServer).GetUsage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Account_GetUsage_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AccountServer).GetUsage(ctx, req.(*GetUsageRequest)) + } + return interceptor(ctx, in, info, handler) +} + // Account_ServiceDesc is the grpc.ServiceDesc for Account service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -344,107 +378,9 @@ var Account_ServiceDesc = grpc.ServiceDesc{ MethodName: "UpdatePreferences", Handler: _Account_UpdatePreferences_Handler, }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "app/v1/account.proto", -} - -const ( - Usage_GetUsage_FullMethodName = "/stream.app.v1.Usage/GetUsage" -) - -// UsageClient is the client API for Usage 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 UsageClient interface { - GetUsage(ctx context.Context, in *GetUsageRequest, opts ...grpc.CallOption) (*GetUsageResponse, error) -} - -type usageClient struct { - cc grpc.ClientConnInterface -} - -func NewUsageClient(cc grpc.ClientConnInterface) UsageClient { - return &usageClient{cc} -} - -func (c *usageClient) GetUsage(ctx context.Context, in *GetUsageRequest, opts ...grpc.CallOption) (*GetUsageResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(GetUsageResponse) - err := c.cc.Invoke(ctx, Usage_GetUsage_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -// UsageServer is the server API for Usage service. -// All implementations must embed UnimplementedUsageServer -// for forward compatibility. -type UsageServer interface { - GetUsage(context.Context, *GetUsageRequest) (*GetUsageResponse, error) - mustEmbedUnimplementedUsageServer() -} - -// UnimplementedUsageServer 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 UnimplementedUsageServer struct{} - -func (UnimplementedUsageServer) GetUsage(context.Context, *GetUsageRequest) (*GetUsageResponse, error) { - return nil, status.Error(codes.Unimplemented, "method GetUsage not implemented") -} -func (UnimplementedUsageServer) mustEmbedUnimplementedUsageServer() {} -func (UnimplementedUsageServer) testEmbeddedByValue() {} - -// UnsafeUsageServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to UsageServer will -// result in compilation errors. -type UnsafeUsageServer interface { - mustEmbedUnimplementedUsageServer() -} - -func RegisterUsageServer(s grpc.ServiceRegistrar, srv UsageServer) { - // If the following call panics, it indicates UnimplementedUsageServer 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(&Usage_ServiceDesc, srv) -} - -func _Usage_GetUsage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetUsageRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(UsageServer).GetUsage(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Usage_GetUsage_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(UsageServer).GetUsage(ctx, req.(*GetUsageRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// Usage_ServiceDesc is the grpc.ServiceDesc for Usage service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Usage_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "stream.app.v1.Usage", - HandlerType: (*UsageServer)(nil), - Methods: []grpc.MethodDesc{ { MethodName: "GetUsage", - Handler: _Usage_GetUsage_Handler, + Handler: _Account_GetUsage_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/internal/service/register.go b/internal/service/register.go index 9c01737..9d22816 100644 --- a/internal/service/register.go +++ b/internal/service/register.go @@ -8,7 +8,6 @@ import ( func Register(server grpc.ServiceRegistrar, services *Services) { appv1.RegisterAuthServer(server, services.AuthServer) appv1.RegisterAccountServer(server, services.AccountServer) - appv1.RegisterUsageServer(server, services.UsageServer) appv1.RegisterNotificationsServer(server, services.NotificationsServer) appv1.RegisterDomainsServer(server, services.DomainsServer) appv1.RegisterAdTemplatesServer(server, services.AdTemplatesServer) diff --git a/internal/service/service_core.go b/internal/service/service_core.go index 05a0e53..ddbb6c6 100644 --- a/internal/service/service_core.go +++ b/internal/service/service_core.go @@ -45,7 +45,6 @@ var allowedTermMonths = map[int32]struct{}{ type Services struct { appv1.AuthServer appv1.AccountServer - appv1.UsageServer appv1.NotificationsServer appv1.DomainsServer appv1.AdTemplatesServer @@ -58,7 +57,6 @@ type Services struct { type authAppService struct{ *appServices } type accountAppService struct{ *appServices } -type usageAppService struct{ *appServices } type notificationsAppService struct{ *appServices } type domainsAppService struct{ *appServices } type adTemplatesAppService struct{ *appServices } @@ -71,7 +69,6 @@ type adminAppService struct{ *appServices } type appServices struct { appv1.UnimplementedAuthServer appv1.UnimplementedAccountServer - appv1.UnimplementedUsageServer appv1.UnimplementedNotificationsServer appv1.UnimplementedDomainsServer appv1.UnimplementedAdTemplatesServer @@ -203,7 +200,6 @@ func NewServices(c *redis.RedisAdapter, db *gorm.DB, l logger.Logger, cfg *confi return &Services{ AuthServer: &authAppService{appServices: service}, AccountServer: &accountAppService{appServices: service}, - UsageServer: &usageAppService{appServices: service}, NotificationsServer: ¬ificationsAppService{appServices: service}, DomainsServer: &domainsAppService{appServices: service}, AdTemplatesServer: &adTemplatesAppService{appServices: service}, diff --git a/proto/app/v1/account.proto b/proto/app/v1/account.proto index 5e0b440..1b1acdd 100644 --- a/proto/app/v1/account.proto +++ b/proto/app/v1/account.proto @@ -14,9 +14,6 @@ service Account { rpc GetUserById (google.protobuf.StringValue) returns (User) {} rpc GetPreferences(GetPreferencesRequest) returns (GetPreferencesResponse); rpc UpdatePreferences(UpdatePreferencesRequest) returns (UpdatePreferencesResponse); -} - -service Usage { rpc GetUsage(GetUsageRequest) returns (GetUsageResponse); }