Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Final sprint close for boba & vata #39

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
9a5d542
Added loopback (#11)
vancepope Oct 25, 2018
7a02c10
BS-SBOX-2 (#12)
bens222 Oct 26, 2018
8965643
Removes comment (#16)
bens222 Oct 26, 2018
5a0bec5
AB-SBOX-6 (#17)
adbarc92 Oct 26, 2018
5c35ecd
Tmh sbox 9 (#18)
Oct 29, 2018
b047a63
Bs sbox 11 (#19)
bens222 Oct 29, 2018
c483b3b
Removes build and dist folders
Andyprolman Oct 30, 2018
eec313b
Ap sbox 7 (#22)
Andyprolman Oct 30, 2018
b8ffb2f
Ap login (#25)
Andyprolman Oct 30, 2018
171534d
Ab sbox 6 (#24)
adbarc92 Oct 30, 2018
d88c1ed
fixes admin dashboard errors
Austin-Gray Oct 30, 2018
fc9faba
Merge pull request #27 from OriginCodeAcademy/ag-SBOX-10
Austin-Gray Oct 30, 2018
0f65067
Ov sbox3 (#28)
anthonyvalera Oct 30, 2018
6c56b74
Ab sbox 6 (#29)
adbarc92 Oct 30, 2018
7cf21c7
Adds default songs viewability and delete functionality
bens222 Oct 30, 2018
f409b50
Adds default songs viewability and delete functionality (#30)
bens222 Oct 30, 2018
ac076b9
Adds viewing capability of playlist on admin dashboard and delete fro…
bens222 Oct 31, 2018
ff749b8
Merge branch 'dev' into bs-SBOX-11
bens222 Oct 31, 2018
055f574
Adds delete song from queue functionality to admin dashboard
bens222 Oct 31, 2018
930cc9e
Tmh sbox 9 (#32)
Oct 31, 2018
befc3ca
Ap login (#34)
Andyprolman Oct 31, 2018
847dc58
Vrp sbox 12 (#36)
Austin-Gray Oct 31, 2018
ae07fb9
Bs sbox 11b (#37)
bens222 Oct 31, 2018
9d24514
fixes add default song action and reducer (#38)
Andyprolman Oct 31, 2018
778abc8
fixed updated playlist with spotify. added socket io broadcast in upd…
Nov 1, 2018
173fb08
Ab sbox 13 (#41)
adbarc92 Nov 1, 2018
e854260
Bpc sbox 14 (#42)
BladeSe7en Nov 1, 2018
3d36950
Resolves Anthony's requests (#43)
bens222 Nov 1, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ jobs:
working_directory: ~/origin-spacebox
docker:
- image: circleci/node:8.11.0
- image: mongo:4.0.3
steps:
- checkout
- run:
Expand All @@ -16,10 +17,12 @@ jobs:
- run:
name: Mocha Test Suite
command: 'npm run test'

deploy-job:
working_directory: ~/origin-spacebox
docker:
- image: circleci/node:8.11.0
- image: mongo:4.0.3
steps:
- checkout
- run:
Expand Down
13 changes: 13 additions & 0 deletions .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 .eslintignore
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/client/
/node_modules
/build
.vscode
Expand Down
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "loopback"
}
7 changes: 0 additions & 7 deletions .eslintrc.json

This file was deleted.

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ package-lock.json
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.env
.env
Mockup.sketch
dist

3 changes: 3 additions & 0 deletions .yo-rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"generator-loopback": {}
}
Empty file modified README.md
100755 → 100644
Empty file.
3 changes: 3 additions & 0 deletions 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.
File renamed without changes.
File renamed without changes
137 changes: 137 additions & 0 deletions common/models/queue.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
'use strict';
const { getPlaylist, updatePlaylist } = require('../../server/utils/playlist');
const { addToDefaultSongs } = require('../../server/utils/adminQueue');
const { playCurrentSong, pauseCurrentSong } = require('../../server/utils/player');

module.exports = function (Queue) {
Queue.getPlaylist = function (id, cb) {
getPlaylist(id)
.then((tracks) => cb(null, tracks))
.catch(err => cb(err));
}

Queue.remoteMethod('getPlaylist', {
description: 'Gets current playlist from Spotify',
accepts: {
arg: 'id',
type: 'string'
},
http: {
path: '/getPlaylist',
verb: 'get'
},
returns: {
arg: 'data',
type: 'array',
root: true
},
});

Queue.updatePlaylist = function (id, songID, cb) {
updatePlaylist(id, songID)
.then((queue) => {
Queue.replaceOrCreate(queue, cb);
})
.catch(err => cb(err));
}

Queue.remoteMethod('updatePlaylist', {
description: 'Adds new song to playlist and removes current playing song from playlist. Adds default songs if needed.',
accepts: [{
arg: 'id',
type: 'string'
},
{
arg: 'songID',
type: 'string',
required: false
}],
http: {
path: '/updatePlaylist',
verb: 'put'
},
returns: {
arg: 'data',
type: 'array',
root: true
},
});

Queue.addToDefaultSongs = function (id, uri, cb) {
addToDefaultSongs(id, uri)
.then((queue) => {
Queue.replaceOrCreate(queue, cb);
})
.catch(err => cb(err));
};

Queue.remoteMethod('addToDefaultSongs', {
description: 'Adds new song to default song array',
accepts: [
{
arg: 'id',
type: 'string'
},
{
arg: 'uri',
type: 'string'
}],
http: {
path: '/addToDefaultSongs',
verb: 'post'
},
returns: {
arg: 'data',
type: 'array',
root: true
},
});

Queue.pauseCurrentSong = function (id, cb) {
pauseCurrentSong(id)
.then(response => cb(null, response))
.catch(err => cb(err));
};

Queue.remoteMethod('pauseCurrentSong', {
description: 'Pauses currently playing song',
accepts: {
arg: 'id',
type: 'string'
},
http: {
path: '/pauseCurrentSong',
verb: 'get'
},
returns: {
arg: 'data',
type: 'array',
root: true
},
});

Queue.playCurrentSong = function (id, cb) {
playCurrentSong(id)
.then(response => cb(null, response))
.catch(err => cb(err));
};

Queue.remoteMethod('playCurrentSong', {
description: 'Starts/resumes currently playing song',
accepts: {
arg: 'id',
type: 'string'
},
http: {
path: '/playCurrentSong',
verb: 'get'
},
returns: {
arg: 'data',
type: 'array',
root: true
},
});

};

42 changes: 42 additions & 0 deletions common/models/queue.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "Queue",
"base": "PersistedModel",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {
"defaultSongs": {
"type": [
"object"
],
"required": true
}
},
"validations": [],
"relations": {
"default": {
"type": "referencesMany",
"model": "Song",
"foreignKey": "defaultSongs",
"options": {
"nestRemoting": true
}
},
"songs": {
"type": "referencesMany",
"model": "Song",
"foreignKey": "",
"options": {
"nestRemoting": true
}
},
"user": {
"type": "belongsTo",
"model": "user",
"foreignKey": ""
}
},
"acls": [],
"methods": {}
}
29 changes: 29 additions & 0 deletions common/models/song.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use strict';
const { getSong } = require('../../server/utils/song');
const { getMoreMusicFromSpotify} = require('../../server/utils/getMoreFromSpotify');

module.exports = function(Song) {
Song.getTrackData = function(songUri, userID, cb) {
getSong(songUri, userID)
.then(song => cb(null, song))
bens222 marked this conversation as resolved.
Show resolved Hide resolved
.catch(err => cb(err));
}

Song.remoteMethod('getTrackData', {
accepts: [{arg: 'songUri', type: 'string'},{arg: 'userID', type:'string'}],
returns: {arg: 'song', type: 'object'}
});

Song.getMoreFromSpotify = function(userId, query, types, cb) {
getMoreMusicFromSpotify(userId, query, types)
.then((songs) => cb(null, songs))
.catch(err => cb(err));
};

Song.remoteMethod('getMoreFromSpotify', {
description: 'Searchs for spotify songs',
accepts: [{arg: 'userId', type: 'string'}, {arg: 'query', type: 'string'}, {arg: 'types', type: 'array'}],
http: {path: '/getMoreFromSpotify', verb: 'get'},
returns: {arg: 'data', type: 'array', root: true},
});
};
38 changes: 38 additions & 0 deletions common/models/song.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "Song",
"base": "PersistedModel",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {
"name": {
"type": "string",
"required": true
},
"duration": {
"type": "number",
"required": true
},
"artist": {
"type": "string",
"required": true
},
"uri": {
"type": "string",
"required": true
},
"albumCover": {
"type": "string",
"required": true
},
"spotifyId": {
"type": "string",
"required": true
}
},
"validations": [],
"relations": {},
"acls": [],
"methods": {}
}
4 changes: 4 additions & 0 deletions common/models/user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'use strict';

module.exports = function(User) {
};
63 changes: 63 additions & 0 deletions common/models/user.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"name": "user",
"plural": "users",
"base": "User",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"email": {
"type": "string",
"required": true
},
"username": {
"type": "string",
"required": true
},
"password": {
"type": "string",
"required": true
},
"accessToken": {
"type": "string",
"required": false
},
"spotifyID": {
"type": "string",
"required": false
},
"playlistID": {
"type": "string",
"required": false
},
"spotifyRefreshToken": {
"type": "string",
"required": false
},
"spotifyAccessToken": {
"type": "string",
"required": false
},
"spotifyAccessToken": {
"type": "string",
"required": false
}
},
"validations": [],
"relations": {
"queue": {
"type": "hasOne",
"model": "Queue",
"foreignKey": ""
}
},
"acls": [],
"methods": {}
}
Loading