<commit_before>var extractIPTC = require('../lib/extractIPTC');
var keystone = require('twreporter-keystone');
var resizeImage = require('../lib/resizeImage');
var transform = require('model-transform');
var Types = keystone.Field.Types;

var Image = new keystone.List('Image', {
    map: { name: 'description' }
});

Image.add({
    image: {
        type: Types.GcsImage,
        initial: true,
        autoCleanup: true,
        datePrefix: 'YYYYMMDDHHmmss',
        // TODO move these settings to config
        bucket: 'twreporter-multimedia',
        destination: 'images/',
        publicRead: true,
        resize: resizeImage,
        resizeOpts: [{
            target: 'desktop',
            width: 2000,
            height: null,
            options: {}
        }, {
            target: 'tablet',
            width: 1200,
            height: null,
            options: {}
        }, {
            target: 'mobile',
            width: 800,
            height: null,
            options: {}
        }, {
            target: 'tiny',
            width: 60,
            height: null,
            options: {}
        }],
        extractIPTC: extractIPTC
    },
    description: {
        type: String,
        index: true
    },
    copyright: {
        type: Types.Select,
        options: 'Creative-Commons, Copyrighted',
        default: 'Copyrighted', index: true
    },
    tags: {
        type: Types.Relationship,
        ref: 'Tag',
        many: true
    },
    sale: {
        type: Boolean,
        index: true
    },
});

Image.relationship({
    ref: 'Post',
    refPath: 'heroImage'
}, {
    ref: 'Audio',
    refPath: 'heroImage'
});

transform.toJSON(Image);<commit_msg>update the fields for the images in plate model<commit_after>var extractIPTC = require('../lib/extractIPTC');
var keystone = require('twreporter-keystone');
var resizeImage = require('../lib/resizeImage');
var transform = require('model-transform');
var Types = keystone.Field.Types;

var Image = new keystone.List('Image', {
    map: { name: 'description' }
});

Image.add({
    image: {
        type: Types.GcsImage,
        initial: true,
        autoCleanup: true,
        datePrefix: 'YYYYMMDDHHmmss',
        // TODO move these settings to config
        bucket: 'twreporter-multimedia',
        destination: 'images/',
        publicRead: true,
        resize: resizeImage,
        resizeOpts: [{
            target: 'desktop',
            width: 2000,
            height: null,
            options: {}
        }, {
            target: 'tablet',
            width: 1200,
            height: null,
            options: {}
        }, {
            target: 'mobile',
            width: 800,
            height: null,
            options: {}
        }, {
            target: 'tiny',
            width: 60,
            height: null,
            options: {}
        }],
        extractIPTC: extractIPTC
    },
    description: {
        type: String,
        index: true
    },
    copyright: {
        type: Types.Select,
        options: 'Creative-Commons, Copyrighted',
        default: 'Copyrighted', index: true
    },
    keywords: {
        type: String,
        index: true
    },
    sale: {
        type: Boolean,
        index: true
    },
});

Image.relationship({
    ref: 'Post',
    refPath: 'heroImage'
}, {
    ref: 'Audio',
    refPath: 'heroImage'
});

transform.toJSON(Image);
{'fraction_non_alphanumeric': 0.1313847062297018, 'fraction_numerical': 0.007676409802184824, 'mean_word_length': 1.6931637519872813, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '755601', 'n_tokens_mistral': 1011, 'n_tokens_neox': 964, 'n_words': 233}