Commit ab25f38f authored by D’jalmar Gutierrez Titirico's avatar D’jalmar Gutierrez Titirico 🚲

Merge branch 'iss4080-pruebas-separacion-cliente' into 'desarrollo'

Se realizo la separación del cliente

Se eliminaron todos los archivos referentes al servidor

See merge request !1
parents 567c81c8 b85f1fdf
...@@ -37,12 +37,12 @@ module.exports = function (grunt) { ...@@ -37,12 +37,12 @@ module.exports = function (grunt) {
}, },
express: { express: {
options: { options: {
port: process.env.PORT || 9000 port: process.env.PORT || 9001
}, },
dev: { dev: {
options: { options: {
script: '<%= yeoman.server %>', script: '<%= yeoman.server %>',
debug: true debug: 5859
} }
}, },
prod: { prod: {
...@@ -102,14 +102,14 @@ module.exports = function (grunt) { ...@@ -102,14 +102,14 @@ module.exports = function (grunt) {
'<%= yeoman.client %>/assets/images/{,*//*}*.{png,jpg,jpeg,gif,webp,svg}' '<%= yeoman.client %>/assets/images/{,*//*}*.{png,jpg,jpeg,gif,webp,svg}'
], ],
options: { options: {
livereload: true livereload: 35728,
} }
}, },
express: { express: {
files: ['<%= yeoman.server %>/**/*.{js,json}'], files: ['<%= yeoman.server %>/**/*.{js,json}'],
tasks: ['express:dev', 'wait'], tasks: ['express:dev', 'wait'],
options: { options: {
livereload: true, livereload: 35728,
spawn: false //Without this option specified express won't be reloaded spawn: false //Without this option specified express won't be reloaded
} }
}, },
...@@ -193,7 +193,8 @@ module.exports = function (grunt) { ...@@ -193,7 +193,8 @@ module.exports = function (grunt) {
'node-inspector': { 'node-inspector': {
custom: { custom: {
options: { options: {
'web-host': 'localhost' 'web-host': 'localhost',
'debug-port': 5859
} }
} }
}, },
...@@ -205,7 +206,7 @@ module.exports = function (grunt) { ...@@ -205,7 +206,7 @@ module.exports = function (grunt) {
options: { options: {
nodeArgs: ['--debug-brk'], nodeArgs: ['--debug-brk'],
env: { env: {
PORT: process.env.PORT || 9000 PORT: process.env.PORT || 9001
}, },
callback: function (nodemon) { callback: function (nodemon) {
nodemon.on('log', function (event) { nodemon.on('log', function (event) {
...@@ -215,7 +216,7 @@ module.exports = function (grunt) { ...@@ -215,7 +216,7 @@ module.exports = function (grunt) {
// opens browser on initial server start // opens browser on initial server start
nodemon.on('config:update', function () { nodemon.on('config:update', function () {
setTimeout(function () { setTimeout(function () {
require('open')('http://localhost:8080/debug?port=5858'); require('open')('http://localhost:8080/debug?port=5859');
}, 500); }, 500);
}); });
} }
...@@ -602,11 +603,11 @@ module.exports = function (grunt) { ...@@ -602,11 +603,11 @@ module.exports = function (grunt) {
}, },
files: { files: {
'<%= yeoman.client %>/index.html': [ '<%= yeoman.client %>/index.html': [
[ [
'<%= yeoman.client %>/{app,components}/**/!(*.spec|*.mock).js', '<%= yeoman.client %>/{app,components}/**/!(*.spec|*.mock).js',
'!{.tmp,<%= yeoman.client %>}/app/app.{js,ts}' '!{.tmp,<%= yeoman.client %>}/app/app.{js,ts}'
]
] ]
]
} }
}, },
...@@ -668,22 +669,22 @@ module.exports = function (grunt) { ...@@ -668,22 +669,22 @@ module.exports = function (grunt) {
}); });
grunt.registerTask('serve', function (target) { grunt.registerTask('serve', function (target) {
if (target === 'dist') { // if (target === 'dist') {
return grunt.task.run(['build', 'env:all', 'env:prod', 'express:prod', 'wait', 'open', 'express-keepalive']); // return grunt.task.run(['build', 'env:all', 'env:prod', 'express:prod', 'wait', 'open', 'express-keepalive']);
} // }
//
if (target === 'debug') { // if (target === 'debug') {
return grunt.task.run([ // return grunt.task.run([
'clean:server', // 'clean:server',
'env:all', // 'env:all',
'concurrent:pre', // 'concurrent:pre',
'concurrent:server', // 'concurrent:server',
'injector', // 'injector',
'wiredep:client', // 'wiredep:client',
'postcss', // 'postcss',
'concurrent:debug' // 'concurrent:debug'
]); // ]);
} // }
grunt.task.run([ grunt.task.run([
'clean:server', 'clean:server',
...@@ -706,95 +707,95 @@ module.exports = function (grunt) { ...@@ -706,95 +707,95 @@ module.exports = function (grunt) {
}); });
grunt.registerTask('test', function(target, option) { grunt.registerTask('test', function(target, option) {
if (target === 'server') { // if (target === 'server') {
return grunt.task.run([ // return grunt.task.run([
'env:all', // 'env:all',
'env:test', // 'env:test',
'mochaTest:unit', // 'mochaTest:unit',
'mochaTest:integration' // 'mochaTest:integration'
]); // ]);
} // }
//
else if (target === 'client') { // else if (target === 'client') {
return grunt.task.run([ return grunt.task.run([
'clean:server', 'clean:server',
'env:all', 'env:all',
'concurrent:pre', 'concurrent:pre',
'concurrent:test', 'concurrent:test',
'injector', 'injector',
'postcss', 'postcss',
'wiredep:test', 'wiredep:test',
'karma' 'karma'
]);
}
else if (target === 'e2e') {
if (option === 'prod') {
return grunt.task.run([
'build',
'env:all',
'env:prod',
'express:prod',
'protractor'
]);
}
else {
return grunt.task.run([
'clean:server',
'env:all',
'env:test',
'concurrent:pre',
'concurrent:test',
'injector',
'wiredep:client',
'postcss',
'express:dev',
'protractor'
]);
}
}
else if (target === 'coverage') {
if (option === 'unit') {
return grunt.task.run([
'env:all',
'env:test',
'mocha_istanbul:unit'
]);
}
else if (option === 'integration') {
return grunt.task.run([
'env:all',
'env:test',
'mocha_istanbul:integration'
]);
}
else if (option === 'check') {
return grunt.task.run([
'istanbul_check_coverage'
]);
}
else {
return grunt.task.run([
'env:all',
'env:test',
'mocha_istanbul',
'istanbul_check_coverage'
]);
}
}
else grunt.task.run([
'test:server',
'test:client'
]); ]);
//}
//
// else if (target === 'e2e') {
//
// if (option === 'prod') {
// return grunt.task.run([
// 'build',
// 'env:all',
// 'env:prod',
// 'express:prod',
// 'protractor'
// ]);
// }
//
// else {
// return grunt.task.run([
// 'clean:server',
// 'env:all',
// 'env:test',
// 'concurrent:pre',
// 'concurrent:test',
// 'injector',
// 'wiredep:client',
// 'postcss',
// 'express:dev',
// 'protractor'
// ]);
// }
// }
//
// else if (target === 'coverage') {
//
// if (option === 'unit') {
// return grunt.task.run([
// 'env:all',
// 'env:test',
// 'mocha_istanbul:unit'
// ]);
// }
//
// else if (option === 'integration') {
// return grunt.task.run([
// 'env:all',
// 'env:test',
// 'mocha_istanbul:integration'
// ]);
// }
//
// else if (option === 'check') {
// return grunt.task.run([
// 'istanbul_check_coverage'
// ]);
// }
//
// else {
// return grunt.task.run([
// 'env:all',
// 'env:test',
// 'mocha_istanbul',
// 'istanbul_check_coverage'
// ]);
// }
//
// }
//
// else grunt.task.run([
// 'test:server',
// 'test:client'
// ]);
}); });
grunt.registerTask('build', [ grunt.registerTask('build', [
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
angular.module('moduloPersonalApp.constants', []) angular.module('moduloPersonalApp.constants', [])
.constant('appConfig', {userRoles:['guest','user','ADMINISTRATOR']}) .constant('appConfig', {userRoles:['guest','user','ADMINISTRATOR'],serverAddress:'http://localhost:9000',clientAddress:'http:localhost:9000'})
; ;
})(angular); })(angular);
\ No newline at end of file
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
'use strict'; 'use strict';
class CargoService { class CargoService {
constructor($resource) { constructor($resource, appConfig) {
this.resource = $resource('/api/cargos/:id', {id: '@_id'}, { this.resource = $resource(appConfig.serverAddress + '/api/cargos/:id', {id: '@_id'}, {
update: {method: 'PUT'}, update: {method: 'PUT'},
query: {isArray: false} query: {isArray: false}
}) })
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
'use strict'; 'use strict';
class ComentarioService { class ComentarioService {
constructor($resource) { constructor($resource, appConfig) {
this.resource = $resource('/api/comentarios/:id', {id: '@_id'}, { this.resource = $resource(appConfig.serverAddress +'/api/comentarios/:id', {id: '@_id'}, {
update: {method: 'PUT'}, update: {method: 'PUT'},
query: {isArray: false} query: {isArray: false}
}) })
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
'use strict'; 'use strict';
class DatoPostulanteService { class DatoPostulanteService {
constructor($resource) { constructor($resource, appConfig) {
this.resource = $resource('/api/datosPostulantes/:id', {id: '@_id'}, { this.resource = $resource(appConfig.serverAddress + '/api/datosPostulantes/:id', {id: '@_id'}, {
update: {method: 'PUT'}, update: {method: 'PUT'},
query: {isArray: false} query: {isArray: false}
}) })
......
(()=> { (()=> {
'use strict'; 'use strict';
class PostulacionService { class PostulacionService {
constructor($resource) { constructor($resource, appConfig) {
this.resource = $resource('/api/postulaciones/:id', {id: '@_id', postulanteId: '@_id', cargoId: '@_id'}, { this.resource = $resource(appConfig.serverAddress + '/api/postulaciones/:id', {
id: '@_id',
postulanteId: '@_id',
cargoId: '@_id'
}, {
update: {method: 'PUT'}, update: {method: 'PUT'},
query: {isArray: false}, query: {isArray: false},
postulacionesPostulante: { postulacionesPostulante: {
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
'use strict'; 'use strict';
class PostulanteService { class PostulanteService {
constructor($resource) { constructor($resource, appConfig) {
this.resource = $resource('/api/postulantes/:id', {id: '@_id'}, { this.resource = $resource(appConfig.serverAddress + '/api/postulantes/:id', {id: '@_id'}, {
update: {method: 'PUT'}, update: {method: 'PUT'},
query: {isArray: false} query: {isArray: false}
}); });
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
'use strict'; 'use strict';
class TagService { class TagService {
constructor($resource) { constructor($resource, appConfig) {
this.resource = $resource('/api/tags/:id', {id: '@_id'}, { this.resource = $resource(appConfig.serverAddress + '/api/tags/:id', {id: '@_id'}, {
update: {method: 'PUT'}, update: {method: 'PUT'},
query: {isArray: false} query: {isArray: false}
}); });
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
'use strict'; 'use strict';
class TagPostulanteService { class TagPostulanteService {
constructor($resource) { constructor($resource, appConfig) {
this.resource = $resource('/api/tagsPostulantes/:id', {id: '@_id'}, { this.resource = $resource(appConfig.serverAddress + '/api/tagsPostulantes/:id', {id: '@_id'}, {
update: {method: 'PUT'}, update: {method: 'PUT'},
query: {isArray: false} query: {isArray: false}
}) })
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
'use strict'; 'use strict';
class TipoDatoService { class TipoDatoService {
constructor($resource) { constructor($resource, appConfig) {
this.resource = $resource('/api/tiposDato/:id', {id: '@_id'}, { this.resource = $resource(appConfig.serverAddress + '/api/tiposDato/:id', {id: '@_id'}, {
update: {method: 'PUT'}, update: {method: 'PUT'},
query: {isArray: false} query: {isArray: false}
}); });
......
'use strict'; 'use strict';
(function() { (function () {
function UsuarioService($resource) { function UsuarioService($resource, appConfig) {
return $resource('/api/usuarios/:id/:controller', { return $resource(appConfig.serverAddress + '/api/usuarios/:id/:controller', {
id: '@_id' id: '@_id'
}, { }, {
get: { get: {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
} }
var Autenticacion = { var Autenticacion = {
iniciarSesion: function iniciarSesion({nombreUsuario, contraseña}, callback) { iniciarSesion: function iniciarSesion({nombreUsuario, contraseña}, callback) {
return $http.post('/api/autenticar/ldap', { return $http.post(appConfig.serverAddress + '/api/autenticar/ldap', {
nombreUsuario: nombreUsuario, nombreUsuario: nombreUsuario,
contrasena: contraseña contrasena: contraseña
}) })
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
// añadir token en las cabeceras // añadir token en las cabeceras
request(config) { request(config) {
config.headers = config.headers || {}; config.headers = config.headers || {};
if ($cookies.get('token') && Util.isSameOrigin(config.url)) { if ($cookies.get('token') ) {
config.headers.Authorization = 'Bearer ' + $cookies.get('token'); config.headers.Authorization = 'Bearer ' + $cookies.get('token');
} }
return config; return config;
......
/**
* This file uses the Page Object pattern to define the main page for tests
* https://docs.google.com/presentation/d/1B6manhG0zEXkC-H-tPo2vwU06JhL8w9-XCF9oehXzAQ
*/
'use strict';
var NavbarComponent = function() {
this.navbar = element(by.css('.navbar'));
this.navbarHeader = this.navbar.element(by.css('.navbar-header'));
this.navbarNav = this.navbar.element(by.css('#navbar-main .nav.navbar-nav:not(.navbar-right)'));
};
module.exports = new NavbarComponent();
/**
* This file uses the Page Object pattern to define the main page for tests
* https://docs.google.com/presentation/d/1B6manhG0zEXkC-H-tPo2vwU06JhL8w9-XCF9oehXzAQ
*/
'use strict';
var MainPage = function() {
this.heroEl = element(by.css('.hero-unit'));
this.h1El = this.heroEl.element(by.css('h1'));
this.imgEl = this.heroEl.element(by.css('img'));
};
module.exports = new MainPage();
'use strict';
var config = browser.params;
describe('Main View', function() {
var page;
beforeEach(function() {
let promise = browser.get(config.baseUrl + '/');
page = require('./main.po');
return promise;
});
it('should include jumbotron with correct data', function() {
expect(page.h1El.getText()).to.eventually.equal('\'Allo, \'Allo!');
expect(page.imgEl.getAttribute('src')).to.eventually.match(/yeoman.png$/);
expect(page.imgEl.getAttribute('alt')).to.eventually.equal('I\'m Yeoman');
});
});
{ {
"name": "modulo-personal", "name": "modulo-personal-cliente",
"version": "0.2.2", "version": "0.2.2",
"main": "server/app.js",
"dependencies": { "dependencies": {
"babel-runtime": "^5.8.20", "babel-runtime": "^5.8.20",
"body-parser": "^1.13.3", "body-parser": "^1.13.3",
...@@ -9,27 +8,12 @@ ...@@ -9,27 +8,12 @@
"compression": "^1.5.2", "compression": "^1.5.2",
"cookie-parser": "^1.3.5", "cookie-parser": "^1.3.5",
"ejs": "^2.3.3", "ejs": "^2.3.3",
"errorhandler": "^1.4.2",
"express": "^4.13.3",
"express-jwt": "^3.0.0",
"express-sequelize-session": "0.4.0",
"express-session": "^1.11.3",
"jsonwebtoken": "^5.0.0",
"lodash": "^3.10.1", "lodash": "^3.10.1",
"lusca": "^1.3.0",
"method-override": "^2.3.5", "method-override": "^2.3.5",
"morgan": "~1.6.1", "morgan": "~1.6.1",
"mysql": "^2.10.2",
"node-validator": "^0.1.22",
"passport": "~0.3.0",
"passport-ldapauth": "^0.5.0",
"passport-local": "^1.0.0",
"pg": "^4.5.1",
"pg-hstore": "^2.3.2",
"sequelize": "^3.5.1",
"serve-favicon": "^2.3.0", "serve-favicon": "^2.3.0",
"sqlite3": "~3.1.1", "errorhandler": "^1.4.2",
"validator": "^4.9.0" "express": "^4.13.3"
}, },
"devDependencies": { "devDependencies": {
"autoprefixer": "^6.0.0", "autoprefixer": "^6.0.0",
......
/**
* Using Rails-like standard naming convention for endpoints.
* GET /api/cargos -> index
* POST /api/cargos -> create
* GET /api/cargos/:id -> show
* PUT /api/cargos/:id -> update
* DELETE /api/cargos/:id -> destroy
*/
'use strict';
import _ from 'lodash';
import {Cargo} from '../../sqldb';
import * as errorMan from '../../components/errors/errorManager'
// Gets a list of Cargos
export function index(req, res) {
Cargo.findAndCountAll(req.parametros)
.then(errorMan.respondWithResult(res))
.catch(errorMan.handleError(res));
}
// Gets a single Cargo from the DB
export function show(req, res) {
req.parametros.where = {
_id: req.params.id
};
Cargo.find(req.parametros)
.then(errorMan.handleEntityNotFound(res))
.then(errorMan.respondWithResult(res))
.catch(errorMan.handleError(res));
}
// Creates a new Cargo in the DB
export function create(req, res) {
Cargo.create(req.body)
.then(errorMan.respondWithResult(res, 201))
.catch(errorMan.handleError(res));
}
// Updates an existing Cargo in the DB
export function update(req, res) {
if (req.body._id) {
delete req.body._id;
}
Cargo.find({
where: {
_id: req.params.id
}
})