Socket
Socket
Sign inDemoInstall

@kezios/forest-express-decorator

Package Overview
Dependencies
4
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @kezios/forest-express-decorator

🚀 Decorators for Express Forest Admin


Version published
Maintainers
2
Created

Readme

Source

Forest Express Decorator

MIT License

🚀 Decorators for Express Forest Admin

Installation

yarn add forest-express-decorator

Usage (🚧 WIP!)

Collection :
@Collection('customers')
class CustomerCollection extends BaseCollection {
  @SmartField({
    type: 'String',
    get: (customer) => `${customer.firstname} ${customer.lastname}`,
    set: (customer, fullname) => {
      fullname.split(' ');
      customer.firstname = names[0];
      customer.lastname = names[1];

      return customer;
    },
  })
  fullname;

  @SmartAction(GenerateInvoice)
  generateInvoice: GenerateInvoice;
}
Smart action :
class GenerateInvoice extends BaseSmartAction {
    @SmartActionField({
        type: 'Number',
        label: 'Price',
        description: 'The price to generate invoice in $'
        isRequired: true,
    })
    price;

    onCall = (req, res) => {
        const price = req.body.data.attributes.values.price;
        // .....
        return res.status(200).send({success: 'Invoice generated !'})
    }
}

Forest Admin Express

License

MIT

Keywords

FAQs

Last updated on 12 Apr 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc