« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/thing
diff options
context:
space:
mode:
Diffstat (limited to 'src/thing')
-rw-r--r--src/thing/artist.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/thing/artist.js b/src/thing/artist.js
new file mode 100644
index 00000000..bbb2a935
--- /dev/null
+++ b/src/thing/artist.js
@@ -0,0 +1,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}
+        },
+    };
+}