resonatecoop / user-api-old Goto Github PK
View Code? Open in Web Editor NEWMain Resonate User/Track API written in Go
License: GNU General Public License v3.0
Main Resonate User/Track API written in Go
License: GNU General Public License v3.0
Prerequisites:
The user-api has currently no authentication/authorization implemented.
The tools to implement that are already there:
Regarding the models, there are already:
role
with 4 predefined rolestenant
user
model already has auth related fields: Password
, Token
, RoleId
, TenantId
, LastLogin
and LastPasswordChange
but they need to be added to user protobuf.TODOs:
Server
struct need to have additional data fields: an RBACService
, a Securer
and an AuthService
:type AuthService interface {
GetUser(context.Context) *model.AuthUser
}
Requests authorization need to be implemented in there.
Please contact @blushi to discuss specifications.
Some inspiration from the Twisk project.
cmd/api/main.go
The current API doc is using API Blueprint description language. We'd like to switch to OpenAPI which will allow us to generate documentation automatically. See some indications below:
there's already an endpoint /openapi/swaggerui
that returns the list of Swagger specs in the browser. Currently it only shows the IAM and User services doc. The User doc has to be rebuilt and doc for the other services has to be added - based in the existing documentation
there's already a tool installed protoc-gen-twirp_swagger
that can generate swagger files from twirp services. You have first to add annotations to the proto file (see for instance https://github.com/resonatecoop/user-api/blob/master/rpc/iam/service.proto)
Then run
retool do protoc \
-I vendor/github.com/grpc-ecosystem/grpc-gateway/ \
-I vendor/ \
--proto_path=$GOPATH/src:. \
--twirp_out=. \
--go_out=. \
--twirp_swagger_out=openapi/ \
./rpc/track/service.proto
to autogenerate files (for the track service in this example)
As some services use types that are imported from other services, please respect this order to generate files: tag, address, track, trackgroup, user, usergroup
Finally, add service link to openapi/swagger.html
.
This social feed should return:
Various feed implementations should be discussed here first.
Should we build our one or look into third party services such as https://getstream.io/ for instance?
Go Version: go1.12.9 darwin/amd64
OS: osx 10.14.5
retool build
retool do protoc --proto_path=$GOPATH/src:. --twirp_out=. --go_out=. ./rpc/user/service.proto
This error is thrown:
protoc-gen-go: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--go_out: protoc-gen-go: Plugin failed with status code 1.
retool: fatal err: failed on 'protoc --proto_path=/Users/eburns/go/src:. --twirp_out=. --go_out=. ./rpc/helloworld/service.proto': exit status 1
It looks like retool doesn't clean up the /bin/
dir on sync or build, so when reproducing, you'd probably want to nuke that folder.
Every service should have a logging interface in some logging.go
wrapping around its implementation.
See for instance the one that is already implemented for the iam service and its declaration in cmd/api/main.go
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.