-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit fe1a7d0
Showing
67 changed files
with
3,156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
package-lock.json | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# Next.js build output | ||
.next | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and *not* Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: npm start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# api.nordly-accounts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"use strict"; | ||
var express = require('express'); | ||
var bodyParser = require('body-parser'); | ||
var config = require('config'); | ||
require('dotenv').config(); | ||
require('./onStartup'); | ||
var app = express(); | ||
app.use(bodyParser.json()); | ||
app.use(bodyParser.urlencoded({ extended: true })); | ||
app.use(function (req, res, next) { | ||
res.set('Access-Control-Allow-Origin', '*'); | ||
res.set('Access-Control-Allow-Headers', 'Content-Type'); | ||
console.log("\n ----------------------------\n NEW REQUEST: ".concat(req.url, ";\n DATE: ").concat(new Date(), ";\n ----------------------------\n ")); | ||
next(); | ||
}); | ||
app.get('/', function (req, res) { | ||
res.json({ | ||
title: '!nfinity-API', | ||
author: 'Emerson-Britto', | ||
description: "account manager api" | ||
}); | ||
}); | ||
var accountRouter = require('./routers/account'); | ||
app.use('/account', accountRouter); | ||
var filesRouter = require('./routers/files'); | ||
app.use('/files', filesRouter); | ||
module.exports = app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
"use strict"; | ||
module.exports = [ | ||
/^https:\/\/web-musiky.vercel.app/g, | ||
/^https:\/\/www-nord.vercel.app/g, | ||
/^http:\/\/localhost\:3000/g | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
var accountController = require('../routers/account/accountController'); | ||
var mailAlreadyExists = function (mail) { return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, accountController.dataExists({ mail: mail })]; | ||
case 1: | ||
result = _a.sent(); | ||
return [2 /*return*/, result]; | ||
} | ||
}); | ||
}); }; | ||
var validator = function (userData) { return __awaiter(void 0, void 0, void 0, function () { | ||
var errors, _a, hasSomeEvenError; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
pwdExp = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%#*?&])[A-Za-z\d@$!%#*?&]{8,}$/; | ||
_a = [Object.keys(userData).length === 0, | ||
userData.name.length > 14 || userData.name.length < 4, | ||
userData.lastName.length > 14 || userData.lastName.length < 4, | ||
userData.displayName.length > 14 || userData.displayName.length < 4, | ||
userData.birthDate.length < 10, | ||
userData.mail.length > 34 || userData.mail.length < 8]; | ||
return [4 /*yield*/, mailAlreadyExists(userData.mail)]; | ||
case 1: | ||
errors = _a.concat([ | ||
_b.sent(), | ||
userData.password.length > 30 || userData.password.length < 8, | ||
!pwdExp.test(userData.password), | ||
userData.password !== userData.rePassword | ||
]); | ||
hasSomeEvenError = errors.some(function (test) { return test === true; }); | ||
return [2 /*return*/, hasSomeEvenError]; | ||
} | ||
}); | ||
}); }; | ||
module.exports = validator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var InvalidArgumentError = /** @class */ (function (_super) { | ||
__extends(InvalidArgumentError, _super); | ||
function InvalidArgumentError(msg) { | ||
var _this = _super.call(this, msg) || this; | ||
_this.name = 'InvalidArgumentError'; | ||
_this.msg = msg; | ||
return _this; | ||
} | ||
return InvalidArgumentError; | ||
}(Error)); | ||
var InternalServerError = /** @class */ (function (_super) { | ||
__extends(InternalServerError, _super); | ||
function InternalServerError(msg) { | ||
var _this = _super.call(this, msg) || this; | ||
_this.name = 'InternalServerError'; | ||
_this.msg = msg; | ||
return _this; | ||
} | ||
return InternalServerError; | ||
}(Error)); | ||
var InvalidService = /** @class */ (function (_super) { | ||
__extends(InvalidService, _super); | ||
function InvalidService(msg) { | ||
var _this = _super.call(this, msg) || this; | ||
_this.name = 'InvalidService'; | ||
_this.msg = msg; | ||
return _this; | ||
} | ||
return InvalidService; | ||
}(Error)); | ||
module.exports = { InvalidArgumentError: InvalidArgumentError, InternalServerError: InternalServerError, InvalidService: InvalidService }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"use strict"; | ||
var promisify = require('util').promisify; | ||
var redis = require('redis'); | ||
var redisDB = redis.createClient('redis://redis-10374.c258.us-east-1-4.ec2.cloud.redislabs.com:10374', { | ||
password: 'hBm0TciZS8Rkg9hZavvn38yXpF0Qnrv5' | ||
}); | ||
module.exports = { | ||
set: promisify(redisDB.set).bind(redisDB), | ||
exists: promisify(redisDB.exists).bind(redisDB), | ||
get: promisify(redisDB.get).bind(redisDB), | ||
del: promisify(redisDB.del).bind(redisDB), | ||
expiresAt: function (key, temp) { return (redisDB.expireat(key, temp)); }, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"use strict"; | ||
var ShortCutUrl = /** @class */ (function () { | ||
function ShortCutUrl() { | ||
throw Error("No constructor"); | ||
} | ||
ShortCutUrl.normalizeUrl = function (url) { | ||
url = url.replace(/H2%/g, "https://"); | ||
url = url.replace(/H1%/g, "http://"); | ||
url = url.replace(/W1%/g, "www"); | ||
url = url.replace(/E4%/g, ".com"); | ||
url = url.replace(/P3%/g, "."); | ||
return url; | ||
}; | ||
ShortCutUrl.codeUrl = function (url) { | ||
url = url.replace(/https:/g, "H2%"); | ||
url = url.replace(/http:/g, "H1%"); | ||
url = url.replace(/www/g, "W1%"); | ||
url = url.replace(/.com/g, "E4%"); | ||
url = url.replace(/./g, "P3%"); | ||
return url; | ||
}; | ||
return ShortCutUrl; | ||
}()); | ||
module.exports = ShortCutUrl; |
Oops, something went wrong.