Skip to content

Commit

Permalink
refactor: delete unused stuff (#963)
Browse files Browse the repository at this point in the history
  • Loading branch information
lautarodragan authored Jun 6, 2019
1 parent 654eddc commit e139c4b
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 63 deletions.
12 changes: 6 additions & 6 deletions src/api/PasswordComplexConfiguration.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export interface PasswordComplexConfiguration {
min: number
max: number
lowerCase: number
upperCase: number
numeric: number
symbol: number
readonly min: number
readonly max: number
readonly lowerCase: number
readonly upperCase: number
readonly numeric: number
readonly symbol: number
}
34 changes: 0 additions & 34 deletions src/decorators/injectDao/injectDao.test.ts

This file was deleted.

5 changes: 0 additions & 5 deletions src/decorators/injectDao/injectDao.ts

This file was deleted.

5 changes: 2 additions & 3 deletions src/helpers/validatePassword.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@ import * as Joi from 'joi'
const PasswordComplexity = require('joi-password-complexity')

import { PasswordComplexConfiguration } from '../api/PasswordComplexConfiguration'
import { ComplexityOptions } from '../interfaces/ComplexityOptions'

export const validatePassword = (password: string, passwordComplexity: PasswordComplexConfiguration) =>
Joi.validate(password, new PasswordComplexity(passwordComplexity), (err: Joi.Err, value: string) => {
if (err) throw getTextErrorPassword(passwordComplexity)
return value
})

const getTextErrorPassword = (options: ComplexityOptions) => `Password requirements: ${mapOptions(options)}.`
const getTextErrorPassword = (options: PasswordComplexConfiguration) => `Password requirements: ${mapOptions(options)}.`

const mapOptions = (options: ComplexityOptions) => Object
const mapOptions = (options: PasswordComplexConfiguration) => Object
.entries(options)
.map(([key, value]) => `${key}: ${value}`)
.join(', ')
8 changes: 0 additions & 8 deletions src/interfaces/ComplexityOptions.ts

This file was deleted.

6 changes: 0 additions & 6 deletions src/interfaces/GenericDAO.ts

This file was deleted.

1 change: 0 additions & 1 deletion tests/unit/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import '../../src/api/accounts/PatchAccount.test'
import '../../src/api/health/GetHealth.test'
import '../../src/api/tokens/CreateToken.test'
import '../../src/decorators/injectDao/injectDao.test'
import '../../src/emails/forgotPassword.test'
import '../../src/emails/verify.test'
import '../../src/extensions/Error.test'
Expand Down

0 comments on commit e139c4b

Please sign in to comment.