cobudget-old / cobudget-api Goto Github PK
View Code? Open in Web Editor NEWcobudget's back-end api
cobudget's back-end api
i'm keen on ironing out our API data models, then i plan to write a "vocab description" (enhanced json-schema) like i'm doing for valnet in order for us to have a single source of truth describing our API and our UI data models.
how do we feel about this design? i didn't include any computed properties or fancy queries like #25 because i'm of the opinion that an API should be a simple secure SCRUD interface for resource types and nothing more, the UI should handle computed properties and complex query views (the API is too slow to be reactive).
feedback is appreciated. :)
As an Admin, I want to be able to notify people in my group at key points in the funding round cycle,
So that I can get as much engagement as possible.
Simulates a "draft" and "publish" functionality. UI will be a button on the round (next to the edit button) which lets the app know to publish a stream of emails according to the date settings configured in that round. Should also indicate when something is "published" or "draft" - with a tag.
If round has been set to let people propose buckets - the proposal reminder goes out, otherwise, round simply sends out a funding email once it has started.
Just for a dev experience side of things, you should shit things out like the default usernames and passwords generated in bold and sparkles.
generated admin account email: '[email protected]', password: 'password'
generated user account email: '[email protected]', password: 'password'
This is probly both and API and UI issue? Will post in both.
so an admin can create buckets
Group can take a long time to serialize, as we calculate balance with every request. On the groups page we serialize group 3 times in total. Can we reduce this?
creates user. only works if you have an invitation. Must send invitation token along with CREATE request. Adds user to group after create.
Querying a 200 user group on production takes 4 seconds. It's most likely the same issue as we had with the group balance calculation, just in the Membership model.
Right now there is just one associated for a user and it never changes...
Should be more like this:
https://auth0.com/blog/2014/01/07/angularjs-authentication-with-cookies-vs-token/
hi, :)
it appears the bucket
<-> allocation
relation is inconsistent. in allocation.rb, allocations belong to buckets. in buckets.rb, allocations are not mentioned. in budgets.rb, budgets have many allocations.
i think the correct relations are for allocations to belong to buckets, buckets to have many allocations, and budgets to have many buckets. is this right or wrong?
cheers!
Hey guys,
We'd really like to use cobudget internally at MetaDev, and we'd definitley hack on it with you, too. So:
and check this when creating a bucket
With the latest merge to beta branch, I'm getting this from the API console:
ActionController::ParameterMissing (param is missing or the value is empty: bucket):
app/controllers/buckets_controller.rb:33:in bucket_params_create' app/controllers/buckets_controller.rb:16:in
create'
and this from the browser console:
POST http://localhost:3000/api/v1/buckets 400 (Bad Request)
(index):1
XMLHttpRequest cannot load http://localhost:3000/api/v1/buckets. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9000' is therefore not allowed access. The response had HTTP status code 400. base_records_interface.coffee:41
request failure! Object {data: null, status: 0, config: Object, statusText: ""}
angular.js:12330 Object {data: null, status: 0, config: Object, statusText: ""}(anonymous function) @ angular.js:12330$get @ angular.js:9109processQueue @ angular.js:14575(anonymous function) @ angular.js:14583$get.Scope.$eval @ angular.js:15846$get.Scope.$digest @ angular.js:15657$get.Scope.$apply @ angular.js:15951done @ angular.js:10364completeRequest @ angular.js:10536requestError @ angular.js:10487
angular.js:12330 Object {data: null, status: 0, config: Object, statusText: ""}
since the contribution model only allows amount_cents
greater_than
0, we can't currently reset a contribution to 0 if a user changes their mind by PUT'ing a new contribution, we need to be able to DELETE.
this happened in production:
014-12-04T03:01:21.400684+00:00 app[web.1]: FloatDomainError (NaN):
2014-12-04T03:01:21.400686+00:00 app[web.1]: app/models/bucket.rb:22:inround\' 2014-12-04T03:01:21.400688+00:00 app[web.1]: app/models/bucket.rb:22:in
percentage'
2014-12-04T03:01:21.400689+00:00 app[web.1]: app/models/bucket.rb:16:inpercentage_funded\' 2014-12-04T03:01:21.400691+00:00 app[web.1]: app/controllers/groups_controller.rb:7:in
index'
many thanks to @joshuavial for helping us here.
moved from cobudget-old/cobudget-ui#54
We tried commas and semicolons. There are different errors for both. Please check the logs around 2016-08-15T00:35:10.033039+00:00 app[web.1]:
There are a whole bunch of email addresses in there that I don't want to post to a github issue.
This is what happens with commas:
2016-08-15T00:25:31.533461+00:00 app[web.1]: Parameters: {"csv"=>#<ActionDispatch::Http::UploadedFile:0x007f8c3829a920 @tempfile=#<Tempfile:/tmp/RackMultipart20160815-12-g7witx.csv>, @original_filename="report-2016-08-15T1102.csv", @content_type="application/vnd.ms-excel", @headers="Content-Disposition: form-data; name=\"csv\"; filename=\"report-2016-08-15T1102.csv\"\r\nContent-Type: application/vnd.ms-excel\r\n">, "group_id"=>"255"}
2016-08-15T00:25:31.533903+00:00 app[web.1]: Can't verify CSRF token authenticity
2016-08-15T00:25:31.640514+00:00 app[web.1]: Completed 422 Unprocessable Entity in 107ms (Views: 0.4ms | ActiveRecord: 11.0ms)
2016-08-15T00:25:17+00:00 app[heroku-postgres]: source=DATABASE sample#current_transaction=2977832.0 sample#db_size=12632236.0bytes sample#tables=10 sample#active-connections=15 sample#waiting-connections=0 sample#index-cache-hit-rate=1 sample#table-cache-hit-rate=0.99953 sample#load-avg-1m=0 sample#load-avg-5m=0.005 sample#load-avg-15m=0.025 sample#read-iops=0 sample#write-iops=0 sample#memory-total=3786332.0kB sample#memory-free=907720kB sample#memory-cached=2182140.0kB sample#memory-postgres=77792kB
got an email from @grimmraper
Hello,
I made a cobudget-ui installation script now I am suffering with the cobudget-api installation script.
When i run the command: bundle install I get this error:Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /home/adam/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/redcarpet-3.4.0/ext/redcarpet /home/adam/.rbenv/versions/2.4.0/bin/ruby -r ./siteconf20170721-2564-rp3xba.rb extconf.rb creating Makefile current directory: /home/adam/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/redcarpet-3.4.0/ext/redcarpet make "DESTDIR=" clean current directory: /home/adam/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/redcarpet-3.4.0/ext/redcarpet make "DESTDIR=" compiling autolink.c compiling buffer.c buffer.c: In function ‘bufcstr’: buffer.c:111:45: warning: passing argument 1 of ‘bufgrow’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] if (buf->size + 1 <= buf->asize || bufgrow(buf, buf->size + 1) == BUF_OK) { ^ buffer.c:60:1: note: expected ‘struct buf *’ but argument is of type ‘const struct buf *’ bufgrow(struct buf *buf, size_t neosz) ^ buffer.c: At top level: cc1: warning: unrecognized command line option ‘-Wno-self-assign’ cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’ cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’ cc1: warning: unrecognized command line option ‘-Wno-tautological-compare’ compiling houdini_href_e.c compiling houdini_html_e.c compiling html.c compiling html_smartypants.c html_smartypants.c: In function ‘squote_len’: html_smartypants.c:104:39: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] static char* single_quote_list[] = { "'", "'", "'", "'", NULL }; ^ html_smartypants.c:104:44: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] static char* single_quote_list[] = { "'", "'", "'", "'", NULL }; ^ html_smartypants.c:104:53: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] static char* single_quote_list[] = { "'", "'", "'", "'", NULL }; ^ html_smartypants.c:104:63: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] static char* single_quote_list[] = { "'", "'", "'", "'", NULL }; ^ html_smartypants.c: In function ‘smartypants_squote’: html_smartypants.c:149:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] uint8_t next_char = (size > 1+next_squote_len) ? text[1+next_squote_len] : 0; ^ html_smartypants.c: In function ‘smartypants_cb__amp’: html_smartypants.c:250:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] int len = squote_len(text, size); ^ html_smartypants.c: At top level: cc1: warning: unrecognized command line option ‘-Wno-self-assign’ cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’ cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’ cc1: warning: unrecognized command line option ‘-Wno-tautological-compare’ compiling markdown.c markdown.c: In function ‘char_link’: markdown.c:1045:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] struct buf id = { 0, 0, 0, 0 }; ^ markdown.c:1085:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] size_t nb_p = 0; ^ markdown.c: In function ‘sd_markdown_render’: markdown.c:2818:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] int footnotes_enabled = md->ext_flags & MKDEXT_FOOTNOTES; ^ markdown.c:2836:43: warning: passing argument 1 of ‘is_codefence’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] if (codefences_enabled && (is_codefence(document + beg, doc_size - beg, NULL) != 0)) ^ markdown.c:1389:1: note: expected ‘uint8_t * {aka unsigned char *}’ but argument is of type ‘const uint8_t * {aka const unsigned char *}’ is_codefence(uint8_t *data, size_t size, struct buf *syntax) ^ markdown.c: At top level: markdown.c:94:15: warning: ‘char_underline’ declared ‘static’ but never defined [-Wunused-function] static size_t char_underline(struct buf *ob, struct sd_markdown *rndr, uint8_t *data, size_t offset, size_t size); ^ cc1: warning: unrecognized command line option ‘-Wno-self-assign’ cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’ cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’ cc1: warning: unrecognized command line option ‘-Wno-tautological-compare’ compiling rc_markdown.c rc_markdown.c: In function ‘rb_redcarpet_md_render’: rc_markdown.c:138:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] struct rb_redcarpet_rndr *renderer; ^ rc_markdown.c: At top level: cc1: warning: unrecognized command line option ‘-Wno-self-assign’ cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’ cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’ cc1: warning: unrecognized command line option ‘-Wno-tautological-compare’ compiling rc_render.c rc_render.c: In function ‘rndr_link_attributes’: rc_render.c:287:28: warning: variable ‘rndr’ set but not used [-Wunused-but-set-variable] struct rb_redcarpet_rndr *rndr; ^ rc_render.c: At top level: cc1: warning: unrecognized command line option ‘-Wno-self-assign’ cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’ cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’ cc1: warning: unrecognized command line option ‘-Wno-tautological-compare’ compiling stack.c linking shared-object redcarpet.so redcarpet.so: final close failed: Invalid operation collect2: error: ld returned 1 exit status Makefile:257: recipe for target 'redcarpet.so' failed make: *** [redcarpet.so] Error 1 make failed, exit code 2 Gem files will remain installed in /home/adam/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/redcarpet-3.4.0 for inspection. Results logged to /home/adam/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0-static/redcarpet-> 3.4.0/gem_make.out An error occurred while installing redcarpet (3.4.0), and Bundler cannot continue. Make sure that `gem install redcarpet -v '3.4.0'` succeeds before bundling. In Gemfile: redcarpet
I tried installing redcarpet with different versions of ruby, with different ruby installing methods, with different versions of red carpet, nothing has worked yet. If you could give me some tips I would appreciate it.
Best regards,
Adam Hegyaljai
POST /memberships
{
memberships: [{
group_id: 43,
user: {
email: "[email protected]"
},
}, {
group_id: 43,
user: {
email: "[email protected]"
}
}]
}
In the database :
bucket 280 :
b= Bucket.find 280
=> #<Bucket id: 280, created_at: "2015-11-14 13:22:07", updated_at: "2016-01-20 09:03:09", name: "PledgeMe Shares", description: "PledgeMe are crowdfunding for equity. I've heard s...", user_id: 408, target: #<BigDecimal:7fb77cac0248,'0.54E3',9(18)>, group_id: 41, status: "funded", funding_closes_at: nil, funded_at: "2016-01-20 09:03:09", live_at: "2015-11-14 13:22:07">
comments :
b.comments.map { |c| p c }
#<Comment id: 1461, body: "I left my laptop open and Billy topped this up to ...", user_id: 226, bucket_id: 280, created_at: "2016-01-20 09:20:01", updated_at: "2016-01-20 09:20:01">
#<Comment id: 1447, body: nil, user_id: 432, bucket_id: 280, created_at: "2016-01-18 23:35:51", updated_at: "2016-01-18 23:35:51">
#<Comment id: 1446, body: nil, user_id: 432, bucket_id: 280, created_at: "2016-01-18 23:35:41", updated_at: "2016-01-18 23:35:41">
#<Comment id: 1438, body: nil, user_id: 616, bucket_id: 280, created_at: "2016-01-18 19:53:11", updated_at: "2016-01-18 19:53:11">
#<Comment id: 1266, body: nil, user_id: 616, bucket_id: 280, created_at: "2015-12-02 19:29:52", updated_at: "2015-12-02 19:29:52">
changes name and email
needed for cobudget-old/cobudget-ui#99
It looks like group_by_day
used to be defined on the User
model.
app[web.1]: Started OPTIONS "/api/v1/groups/56" for 103.23.18.14 at 2016-08-09 09:59:42 +0000
app[web.1]: Started OPTIONS "/api/v1/groups/56/analytics" for 103.23.18.14 at 2016-08-09 09:59:42 +0000
app[web.1]: Started GET "/api/v1/groups/56/analytics" for 103.23.18.14 at 2016-08-09 09:59:42 +0000
app[web.1]: Processing by AnalyticsController#group_report as JSON
app[web.1]: Parameters: {"id"=>"56"}
heroku[router]: at=info method=GET path="/api/v1/groups/56/analytics" host=cobudget-beta-api.herokuapp.com request_id=012d2f34-df50-4a91-b69a-8d34496dc7ec fwd="103.23.18.14" dyno=web.1 connect=1ms service=84ms status=500 bytes=290
app[web.2]: Started GET "/api/v1/groups/56" for 103.23.18.14 at 2016-08-09 09:59:42 +0000
heroku[router]: at=info method=GET path="/api/v1/groups/56" host=cobudget-beta-api.herokuapp.com request_id=6ea9baf5-7d4f-476d-8107-6df833fd86c1 fwd="103.23.18.14" dyno=web.2 connect=0ms service=154ms status=200 bytes=1005
app[web.2]: Processing by GroupsController#show as JSON
app[web.2]: Parameters: {"id"=>"56"}
app[web.2]: Completed 200 OK in 144ms (Views: 44.4ms | ActiveRecord: 14.8ms)
app[web.1]: Completed 500 Internal Server Error in 50ms (ActiveRecord: 29.5ms)
app[web.1]:
app[web.1]: NoMethodError (undefined method `group_by_day' for #<User::ActiveRecord_Relation:0x007fd9ff320600>):
app[web.1]: app/services/group_analytics_service.rb:24:in `cumulative_confirmed_member_count_per_day'
app[web.1]: app/services/group_analytics_service.rb:15:in `report'
app[web.1]: app/services/group_analytics_service.rb:6:in `report'
app[web.1]: app/controllers/analytics_controller.rb:13:in `group_report'
app[web.1]:
app[web.1]:
needed by cobudget-old/cobudget-ui#69
necessary for cobudget-old/cobudget-ui#96
requested by charley davenport
Charley Davenport [2:37 PM]
Hi - I’ve run into a problem with a .csv file upload to update funds for Foundation. I used to be able to include multiple line items that included the same email consecutively. like:
7.62 [email protected]
6.56 [email protected]
But now when I upload it’s giving me the error that I have duplicate email addresses. I’ll resolve this now by simply combining the amounts from multiple lines for the same address into a single line, but I didn’t have to used to do this, and it was nice to not having to worry about multiple lines with different amounts for the same account. Thanks!
Seem to have hit a bug in Group 52. One of the admins is unable to log in to her account... keeps getting an "error! you have no active memberships" message.
When she tries to reset her password, she receives a link to reset, goes through that and then gets the same error message when logging in.
I have tried some basic troubleshooting from the front end such as removing the user and re-sending the invite e-mail which works but when she follows the link she still arrives at the same error message. Also, I noticed that as soon as a new invite is sent the account appears "re-active" rather than waiting for her to accept the invite as is the case when people join for the first time.
When running bundler in master
and beta
branches a warning is thrown:
Your Gemfile lists the gem airbrake (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Hey there,
we've been spamming you on twitter for the last couple of days. We managed to get your software (loomio AND cobudget) running yet we can't do anything with it because there is no description of what any of your API does or takes as parameters.
Would you have any internal documentation that would facilitate our process of improving upon your app? We would gladly share our progress with you!
Completed 500 Internal Server Error in 466ms
app/controllers/auth_controller.rb:12:in `log_in'
NoMethodError (undefined method `initialized' for #User:0x007f7584d50150):
defaults to false
.
related to cobudget-old/cobudget-ui#100.
We need to make this endpoint. Should have the format:
contributor: { user: { ... }, allocation: { ... } }
should create a new group where the current authorized user has a membership with is_admin == true
.
related to cobudget-old/cobudget-ui#100.
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.