Skip to content

eldoy/waveorb-validations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 a 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!

About

Waveorb validation extensions for d8a.

Resources

License

Stars

Watchers

Forks