'use strict' ; import _ from 'lodash' ; /**
 * A simple User model
 */ export interface MyUser { id : string ; username ? : string ; firstName ? : string ; lastName ? : string ; password ? : string ; email ? : string ; token ? : string ; signingKey : string ; } /**
 * Repository to store and access user objects
 */ export class UserRepository { constructor ( readonly list ) { } param username find ( username ) { return _ . filter ( this . list , user => user . username === username ) ; } param id findById ( id ) { const usr = _ . filter ( this . list , ( user ) => user . id === id ) ; if ( usr . length > 0 ) return usr [ 0 ] ; } param user createExternalUser ( user ) { this . list [ user . id ] = user ; } } /**
 * Sample data to mock existing registered users
 * new users can be registered with the repository functions
 */ const userRepository = new UserRepository ( { '999' : { id : '999' , username : 'joesmith71' , firstName : 'Joseph' , lastName : 'Smith' , signingKey : 'AZeb==' , } , '1000' : { id : '1000' , username : 'simonsmith71' , firstName : 'Simon' , lastName : 'Smith' , signingKey : 'AZeb==' , } , } ) ; export { userRepository } ;