0.2.0 • Published 10 months ago

waveorb-validations v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Waveorb validations

Waveorb validation extensions for d8a.

It is included in the Waveorb web app development framework.

Install

npm i waveorb-validations

Usage

Exist

Check for existence in collection:

await $.validate({
  values: {
    account_id: {
      exist: 'account'
    }
  }
})

Owner

Check if collection id is owned by logged in user:

await $.validate({
  values: {
    account_id: {
      owner: 'user'
    }
  }
})

This example requires a user in $.data.user and an user_id in the associated account.

Unique

Check if field is unique in collection:

await $.validate({
  values: {
    email: {
      unique: 'user'
    }
  }
})

Check if field is unique in collection with extra fields:

await $.validate({
  values: {
    email: {
      unique: {
        in: 'user',
        with: ['site_id']
      }
    }
  }
})

License

MIT Licensed. Enjoy!

0.2.0

10 months ago

0.1.1

2 years ago

0.1.0

2 years ago