This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Step 1: Create the file below | |
// Step 2: Configure the dropdown in dynamic mode using this path: /forest/orders/shippingStatusOptions | |
// decorators/routes/orders.js | |
const express = require('express'); | |
const router = express.Router(); | |
const Liana = require('forest-express-mongoose'); | |
const models = require('../../models'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Step 1: Create the file below | |
// Step 2: Configure the dropdown in dynamic mode using this path: /forest/orders/shippingStatusOptions | |
// decorators/routes/orders.js | |
const Liana = require('forest-express-sequelize'); | |
const models = require('../../models'); | |
const STATUS_OPTION_DEFAULT = 'Being processed'; | |
const STATUS_TRANSITIONS = { | |
'Being processed': ['Ready for shipping'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Liana = require('forest-express-sequelize'); | |
const models = require('../../models'); | |
const { Op } = models.Sequelize; | |
Liana.collection('guest', { | |
fields: [{ | |
field: 'googleAccessToken', | |
type: 'String', | |
get: async (guest) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /lib/forest_liana/collections/movie.rb | |
class Forest::Movie | |
include ForestLiana::Collection | |
collection :Movie | |
action 'Approve comment', fields: [{ | |
field: 'comment', | |
type: 'Number', | |
reference: 'Comment.id', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// forest/order.js (Smart Action declaration) | |
const Liana = require('forest-express-sequelize'); | |
Liana.collection('order', { | |
actions: [{ | |
name: 'Test product', | |
fields: [{ | |
field: 'product', | |
type: 'Number', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Liana = require('forest-express-sequelize'); | |
const models = require('./models'); | |
// NOTICE: "collection" has to be replaced by the collection/model you want to customize. | |
app.get('/forest/collection', (request, response, next) => { | |
if (!request.query.searchToEdit) { | |
// NOTICE: Seach for collection list, keep the current behaviour. | |
return next(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See documentation at https://doc.forestadmin.com/developer-guide/lumber.html#actions | |
// Smart Action declaration example in forest/request.js | |
const Liana = require('forest-express-sequelize'); | |
Liana.collection('request', { | |
actions: [{ | |
name: 'Add offer with child objects', | |
fields: [{ | |
field: 'offerStatus', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'jsonapi-serializers' | |
require 'csv' | |
class Forest::PaymentsController < ForestLiana::ApplicationController | |
def index | |
@payments = [ | |
Forest::Payment.new( | |
id: 1, | |
amount: 1000, | |
currency: 'USD' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var Liana = require('forest-express-sequelize'); | |
Liana.collection('Address', { | |
searchFields: ['id', 'user.email'] | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const _ = require('lodash'); | |
const moment = require('moment'); | |
const liana = require('forest-express-sequelize'); | |
const models = require('../../../../models'); | |
function values(request, response) { | |
// NOTICE: To access to the current recordId => request.body.record_id | |
const query = `RAW SQL QUERY HERE`; |
NewerOlder