Skip to content

Commit

Permalink
Api
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoHB committed Dec 28, 2018
1 parent 97c7c3f commit f487209
Show file tree
Hide file tree
Showing 27 changed files with 3,835 additions and 28 deletions.
13 changes: 13 additions & 0 deletions hs-api/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# http://editorconfig.org

root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
1 change: 1 addition & 0 deletions hs-api/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/client/
3 changes: 3 additions & 0 deletions hs-api/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "loopback"
}
19 changes: 19 additions & 0 deletions hs-api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
*.csv
*.dat
*.iml
*.log
*.out
*.pid
*.seed
*.sublime-*
*.swo
*.swp
*.tgz
*.xml
.DS_Store
.idea
.project
.strong-pm
coverage
node_modules
npm-debug.log
3 changes: 3 additions & 0 deletions hs-api/.yo-rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"generator-loopback": {}
}
3 changes: 3 additions & 0 deletions hs-api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# My Application

The project is generated by [LoopBack](http://loopback.io).
3 changes: 3 additions & 0 deletions hs-api/client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Client

This is the place for your application front-end files.
25 changes: 25 additions & 0 deletions hs-api/common/models/item.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use strict';

module.exports = function(Item) {

Item.enqueue = (body, callback) => {
const a = new Item();
console.log(body);
a.url = body;
a.title = 'Nameless';
a.duration = 100;
Item.create(a, (err, record) => {
if (err) callback(err);
else callback(null, record);
});
}

Item.remoteMethod(
'enqueue', {
accepts: { arg: 'body', type: 'string' },
http: {
verb: 'post'
}
})

};
23 changes: 23 additions & 0 deletions hs-api/common/models/item.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "item",
"base": "PersistedModel",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {
"url": {
"type": "string"
},
"title": {
"type": "string"
},
"duration": {
"type": "string"
}
},
"validations": [],
"relations": {},
"acls": [],
"methods": {}
}
22 changes: 22 additions & 0 deletions hs-api/data/items.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[
{
"url": "https://www.youtube.com/watch?v=Po9WvjvxxEs",
"title": "A lenda - Sandy e Xororó",
"duration": "100"
},
{
"url": "https://www.youtube.com/watch?v=b3c32wBYdU0",
"title": "James Blunt - Same Mistake (video)",
"duration": "100"
},
{
"url": "https://www.youtube.com/watch?v=cHTEGQbtP1I",
"title": "Ed Sheeran - Tenerife Sea",
"duration": "100"
},
{
"url": "https://www.youtube.com/watch?v=TpSey9r6-a0",
"title": "Jason Mraz - 93 Million Miles- (Tradução)",
"duration": "100"
}
]
Loading

0 comments on commit f487209

Please sign in to comment.