« get me outta code hell

all-in-one document mode & artist data - 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:
author(quasar) nebula <qznebula@protonmail.com>2022-01-30 15:01:35 -0400
committer(quasar) nebula <qznebula@protonmail.com>2022-01-30 15:01:35 -0400
commitdfd84ead5bd5dfbcd7c25d08b816b28b4620ee5a (patch)
tree1e6ba1818f12171e3c0b5b37fbf0e8d4d6d14f2c /src/thing
parentdccb3cd1312cfa9c2ea86eef6833a63b778de157 (diff)
all-in-one document mode & artist data
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}
+        },
+    };
+}