pigmice2733 / peregrine-backend Goto Github PK
View Code? Open in Web Editor NEWThe future of FRC scouting
License: GNU General Public License v3.0
The future of FRC scouting
License: GNU General Public License v3.0
The jest blackbox tests should be in CI.
We no longer use initials prefixes in branch names. They should just be descriptive. The README.md should be updated to reflect this.
The TBA API supports the ETag and If-None-Match HTTP headers. The TBA package should keep a map of URLs to ETags, send them in an If-None-Match HTTP header in any TBA request, set the ETag sent back, and handle a 304 Not Modified properly. You can take a look at the old code to sorta get an idea of what this would look like. The old code used If-Modified-Since which is a bit different but a similar idea.
@NathanJesudason @j10k11 do either of you want to attempt this now that you have peregrine setup locally? If it would be helpful, I can write the tests for this feature, so you can tell when you've got it working properly, or I can just pair program with one of you at robotics.
It would be nice if instead of a 404 the /
route served information about dependency (PostgreSQL, TBA) health.
We can use SQL migrations for seeding the DB. That would be a lot nicer than our current solution.
For an event like 2018abca
, all the match keys will start with 2018abca_
(e.g. 2018abca_qm2
, 2018abca_qm6
). The match keys should simply be the later part (qm2
, qm6
).
Right now almost every request involving matches requires a roundtrip request to TBA, there should be a time period (several hours probably) where the server will just respond with the data it already has, and during that period the data is updated via the TBA firehose.
There are lots of very complex store
functions that do not provide context to the errors they return. They should do that :)
It would be cool if the health check endpoint at /
served the service uptime.
So either:
mux.Vars
for eventKey
, matchKey
, bla, bla, bla to update events, matches, bla, bla, bla.ihttp.Update(fooHandler, ihttp.Deps{Events: true, Matches: false, Teams: true})
to update events, matches, bla, bla, bla.IMO it makes more sense to just define json
tags on store
types than have the types defined in two places. What do you think @brendanburkhart
And update the docs on the frontend repo.
Example:
{
"data": [
{
"id": 1,
"username": "franklin",
"firstName": "Franklin",
"lastName": "Harding",
"roles": {
"isAdmin": true,
"isVerified": true
},
"stars": null
}
]
}
Add the /event/{eventKey}/team/{team}/info
and the /event/{eventKey}/teams
endpoints.
https://github.com/Pigmice2733/peregrine-frontend/blob/dev/docs/docs.md#eventeventkeyteams
https://github.com/Pigmice2733/peregrine-frontend/blob/dev/docs/docs.md#eventeventkeyteamteaminfo
See the api docs
/event/{eventId}/info
https://github.com/Pigmice2733/peregrine-frontend/blob/master/docs/docs.md#eventeventkeyinfo
There are a lot of tests in api.test.js
now, it might make sense to separate them, e.g.: events.test.js
, matches.test.js
, etc, etc.
The applications should automatically deploy when a branch is merged (assuming all tests pass).
We should be providing context when we return ErrNoResults (that's the whole point of it being a type rather than just an error value), like this:
But we aren't doing that everywhere:
ErrNoResults(
for more.We should add steps on how to install PostgreSQL on Windows, manage it with pg_ctl
, and use psql
to create the peregrine
database since most of the new Peregrine developers will be using (bleh) Windows. Also some specific steps on how to use install/use dep would be nice since you just download a single binary rather than install it.
pg_ctl
peregrine
database with psql
We have a stupid amount of arguments in New
. We should probably refactor it so the user can construct the Server
struct themselves and then call server.Init()
or something.
We should add refresh tokens. This doesn't need to happen until after we get everything else done.
Per slack discussion.
If events/matches are created, they can't currently be changed. Admins should be able to update or delete events on their realm. Additionally it should not be possible to create a manual event that replaces a TBA event, they need to have different names.
Should happen at some point, no rush.
I put these together because I thought they should go together because stars is an easy feature dependent on users.
https://github.com/Pigmice2733/peregrine-frontend/blob/dev/docs/docs.md#authenticate
https://github.com/Pigmice2733/peregrine-frontend/blob/dev/docs/docs.md#usersuserid
https://github.com/Pigmice2733/peregrine-frontend/blob/dev/docs/docs.md#users
For example, Madtown Throwdown has many teams that bring multiple robots, where the extra/practice robots get their team numbers prefixed with 9
or 8
. So the team list route should return a combination of the teams list from TBA + the teams that are in matches
It would seem we're leaking SQL connections. This is high priority and should be fixed soon.
Oct 24 00:44:52 centos-s-1vcpu-1gb-nyc1-01 peregrine[8771]: {"error":"pq: remaining connection slots are reserved for non-replication superuser connections","level":"error","msg":"retrieving event data","time":"2018-10-24T00:44:52Z"}
Oct 24 00:53:31 centos-s-1vcpu-1gb-nyc1-01 peregrine[8771]: {"admin":false,"body_size":22,"level":"info","method":"GET","msg":"got request","remote_addr":"REDACTED:42086","request_time":0.005135046,"start_time":1540342411,"status_code":500,"time":"2018-10-24T00:53:31Z","url":"/events","u
Oct 24 00:53:31 centos-s-1vcpu-1gb-nyc1-01 peregrine[8771]: {"error":"pq: remaining connection slots are reserved for non-replication superuser connections","level":"error","msg":"retrieving event data","time":"2018-10-24T00:53:31Z"}
Oct 24 00:54:15 centos-s-1vcpu-1gb-nyc1-01 peregrine[8771]: {"admin":false,"body_size":22,"level":"info","method":"GET","msg":"got request","remote_addr":"REDACTED:42450","request_time":0.004834191,"start_time":1540342455,"status_code":500,"time":"2018-10-24T00:54:15Z","url":"/events","u
Oct 24 00:54:15 centos-s-1vcpu-1gb-nyc1-01 peregrine[8771]: {"error":"pq: remaining connection slots are reserved for non-replication superuser connections","level":"error","msg":"retrieving event data","time":"2018-10-24T00:54:15Z"}
Oct 24 00:54:16 centos-s-1vcpu-1gb-nyc1-01 peregrine[8771]: {"admin":false,"body_size":19,"level":"info","method":"GET","msg":"got request","remote_addr":"REDACTED:42450","request_time":0.000034252,"start_time":1540342456,"status_code":404,"time":"2018-10-24T00:54:16Z","url":"/favicon.ic
https://www.reddit.com/r/golang/comments/4j5ysh/reliably_detect_databasesql_connection_leaks/
It would be cool to log the User-Agent HTTP header.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent
See /event/{eventKey}/matches
in the API docs
https://github.com/Pigmice2733/peregrine-frontend/blob/master/docs/docs.md#eventeventkeymatches
Also, instead of having a bunch of postgres stuff we should just have like PRGN_PG_DSN
The matches are currently coming back in database-retrieval-order. They should be sent in order of the scheduled start date
This should probably be done by somebody that has contributed to this project before.
Currently, we use a separate statement for getting user stars, but we could just use a JOIN, similar to what was just done for matches in this PR, and it would be both faster and more readable.
If they aren't going to happen, tie-breaker matches are deleted from TBA. Deleted matches need to be removed from the database, but custom matches need to be left alone.
The GolangCI bot is pretty unreliable so we should stop using it and instead use circleci to run the golangci-lint cli tool.
We need a way to add events and matches via the API.
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.