« get me outta code hell

artist.js « thing « src - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/thing/artist.js
blob: bbb2a935dc7a02b99f9dd5e3f895874426d0f5ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import Thing from './thing.js';

import {
    isDirectory,
    isName,
    isString,
    isURL,
    validateArrayItems,
    validateReferenceList,
} from './validators.js';

export default class Artist extends Thing {
    static [Thing.referenceType] = 'artist';

    static propertyDescriptors = {
        // Update & expose

        name: {
            flags: {update: true, expose: true},

            update: {
                default: 'Unnamed Artist',
                validate: isName
            }
        },

        directory: {
            flags: {update: true, expose: true},
            update: {validate: isDirectory},
            expose: Thing.directoryExpose
        },

        urls: {
            flags: {update: true, expose: true},
            update: {validate: validateArrayItems(isURL)}
        },

        aliasRefs: {
            flags: {update: true, expose: true},
            update: {validate: validateReferenceList('artist')}
        },

        contextNotes: {
            flags: {update: true, expose: true},
            update: {validate: isString}
        },
    };
}