1.0.14 • Published 3 years ago

backend_fakes v1.0.14

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

backend_fakes

License: MIT NPM Downloads Play with docs

Instructions:

npm install backend_fakes
const backend_fakes =  require('backend_fakes')

If utilizing in html...:

<script src="./node_modules/backend_fakes/index.js"></script>
<script> 
$(()=> { 
     const output =  backend_fakes.method(parameter)
 })
</script>

Functions

passwordToHash(password) ⇒ string

passwordToHash

Kind: global function
Returns: string - hash
Date: 2022-03-11
Author: zen-out

ParamType
passwordany

hashToPassword(password, hash) ⇒ boolean

Kind: global function
Date: 2022-03-11
Author: zen-out

ParamType
passwordstring
hashstring

postDevice(filename, object) ⇒ any

  1. Get device
  2. If device exists
  3. Update the last login date
  4. Else, create new device
  5. Return device

Kind: global function
Date: 2022-03-16
Author: zen-out

ParamType
filenameany
objectany

Example

userObject["user_id"] = postUser.id
            userObject["device"] = req.device.parser.useragent.source;
            userObject["type"] = req.device.type;
            let getPost = await postDevice(filename, userObject)

signup(filename, userObject) ⇒ any

Kind: global function
Date: 2022-03-20
Author: zen-out

ParamType
filenameany
userObjectany

Example

/**

Example

let sampleObject = {
        email: "asdfasdf213@gmdail.com",
        password: "asdfasdf",
        type: "chrome",
        device: "desktop"
    }
    let sampleObject2 = {
            email: "lesle3yc2@gmail.com",
            password: "orangeorange"
        }
        // let firstSignup = await signup(filename, sampleObject)
        // see.done("signup", firstSignup)
    let firstLogin = await login(filename, sampleObject)
    see.done("login", firstLogin)
    let verify = await verifyUserRoute(filename, 48, 14)
    see.done("verify route" + verify)

login(filename, userObject) ⇒ any

Kind: global function
Date: 2022-03-20
Author: zen-out

ParamType
filenameany
userObjectany

Example

let sampleObject = {
        email: "asdfasdf213@gmdail.com",
        password: "asdfasdf",
        type: "chrome",
        device: "desktop"
    }
    let sampleObject2 = {
            email: "lesle3yc2@gmail.com",
            password: "orangeorange"
        }
        // let firstSignup = await signup(filename, sampleObject)
        // see.done("signup", firstSignup)
    let firstLogin = await login(filename, sampleObject)
    see.done("login", firstLogin)
    let verify = await verifyUserRoute(filename, 48, 14)
    see.done("verify route" + verify)

verifyUserRoute(req, res, next) ⇒ boolean

  1. Checks if user is logged in
    1. Checks if the last logged in date is within 14 days

Kind: global function
Date: 2022-03-16
Author: zen-out

ParamType
reqany
resany
nextany

Example

// let verify = await verifyUserRoute(sampleRequest, filename)

logout(filename, number) ⇒ boolean

Kind: global function
Date: 2022-03-20
Author: zen-out

ParamType
filenameany
numberany

Example

// let test_logout = await logout(filename, 48)

mostRecentlyCreatedProblems(filename, user_id) ⇒ any

mostRecentlyCreatedProblems(filename, user_id)

Kind: global function
Date: 2022-03-22
Author: zen-out

ParamType
filenameany
user_idany

mostRecentProblems()

Kind: global function
Author: github.com/zen-out
Example

await mostRecentProblems(filename, user_id)