Skip to content

Commit bb86324

Browse files
committed
Switch to ember flavored blueprints, (better json structure)
1 parent 8532152 commit bb86324

File tree

10 files changed

+22
-37
lines changed

10 files changed

+22
-37
lines changed

README.md

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
# sourcecheck_api
2-
Primary Repo for the Sourcecheck API.
2+
Official Repo for the Sourcecheck API.
33

4-
ToDo: Fill out the Readme.
4+
This is the repository for our server code.
55

6-
This is using the sails.js node framework, which has a robust MVC model and organization. It's documentation is awesome: http://sailsjs.org
6+
Currently we have a Source and and Organization object.
7+
8+
We have a basic crud api working.
9+
10+
## ToDo:
11+
12+
Expand on ownership association chains.
13+
Create data import and feedback api.
14+
Prepair for front end plugin.
15+
16+
To speed development we have chosen to use the sails.js node framework for our backend.
17+
Sails a robust MVC model and organization. It's documentation is awesome: http://sailsjs.org
718

819

api/blueprints/create.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('sails-generate-ember-blueprints/templates/advanced/api/blueprints/create.js');

api/blueprints/destroy.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('sails-generate-ember-blueprints/templates/advanced/api/blueprints/destroy.js');

api/blueprints/find.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('sails-generate-ember-blueprints/templates/advanced/api/blueprints/find.js');

api/blueprints/findone.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('sails-generate-ember-blueprints/templates/advanced/api/blueprints/findone.js');

api/blueprints/populate.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('sails-generate-ember-blueprints/templates/advanced/api/blueprints/populate.js');

api/blueprints/update.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('sails-generate-ember-blueprints/templates/advanced/api/blueprints/update.js');

api/controllers/SourceController.js

-33
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,6 @@
77

88
module.exports = {
99
//Main info API Call
10-
11-
check: function(req,res) {
12-
//To Do: Add error handling, work through deep assocations.
13-
var host = req.param('host');
14-
var to_send = {};
15-
16-
//Find source that matches host
17-
Source.findOne({host: host}).populate("organizations").then(function(source){
18-
source.owner_ids = [];
19-
for (var i = source.organizations.length - 1; i >= 0; i--) {
20-
source.owner_ids = source.organizations[i].id;
21-
};
22-
var orgOwners = Organization.find({
23-
id: _.pluck(source.organizations, 'id')
24-
//_.pluck: Retrieves the value of a 'user' property from all elements in the post.comments collection.
25-
})
26-
.then(function(orgOwners){
27-
/*
28-
for (var i = orgOwners.length - 1; i >= 0; i--) {
29-
orgOwners[i].owner_ids = [];
30-
//Parse Owners
31-
for (var o = orgOwners[i].owners.length - 1; o >= 0; o--) {
32-
orgOwners[i].owner_ids.push(orgOwners[i].owners[o].id)
33-
};
34-
};*/
35-
36-
37-
source.fixed_orgs = orgOwners;
38-
res.send(200, source);
39-
//var new_source = {organizations: orgOwners, host: source.host, createdAt: source.createdAt, updatedAt: source.updatedAt, id: source.id};
40-
//res.send(200, new_source);
41-
});
42-
});
4310
}
4411

4512
};

api/services/Ember.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('sails-generate-ember-blueprints/templates/advanced/api/services/Ember.js');

config/blueprints.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ module.exports.blueprints = {
126126
* *
127127
***************************************************************************/
128128

129-
// pluralize: false,
129+
pluralize: true,
130130

131131
/***************************************************************************
132132
* *

0 commit comments

Comments
 (0)