mango-cms 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/bin/mango +4 -0
- package/frontend-starter/README.md +8 -0
- package/frontend-starter/dist/_redirects +1 -0
- package/frontend-starter/dist/assets/index.00922bd5.js +99 -0
- package/frontend-starter/dist/assets/index.1781f175.css +1 -0
- package/frontend-starter/dist/favicon.png +0 -0
- package/frontend-starter/dist/index.html +53 -0
- package/frontend-starter/dist/index.js +66 -0
- package/frontend-starter/index.html +25 -0
- package/frontend-starter/index.js +197 -0
- package/frontend-starter/package-lock.json +5454 -0
- package/frontend-starter/package.json +40 -0
- package/frontend-starter/postcss.config.js +6 -0
- package/frontend-starter/public/_redirects +1 -0
- package/frontend-starter/public/favicon.png +0 -0
- package/frontend-starter/public/index.js +66 -0
- package/frontend-starter/src/App.vue +27 -0
- package/frontend-starter/src/components/layout/login.vue +212 -0
- package/frontend-starter/src/components/layout/modal.vue +113 -0
- package/frontend-starter/src/components/layout/spinner.vue +17 -0
- package/frontend-starter/src/components/pages/404.vue +28 -0
- package/frontend-starter/src/components/pages/home.vue +74 -0
- package/frontend-starter/src/components/partials/button.vue +31 -0
- package/frontend-starter/src/helpers/Mango.vue +455 -0
- package/frontend-starter/src/helpers/breakpoints.js +34 -0
- package/frontend-starter/src/helpers/darkMode.js +38 -0
- package/frontend-starter/src/helpers/email.js +32 -0
- package/frontend-starter/src/helpers/formatPhone.js +18 -0
- package/frontend-starter/src/helpers/localDB.js +315 -0
- package/frontend-starter/src/helpers/mango.js +338 -0
- package/frontend-starter/src/helpers/model.js +9 -0
- package/frontend-starter/src/helpers/multiSelect.vue +252 -0
- package/frontend-starter/src/helpers/pills.vue +75 -0
- package/frontend-starter/src/helpers/reconnecting-websocket.js +357 -0
- package/frontend-starter/src/helpers/uploadFile.vue +157 -0
- package/frontend-starter/src/helpers/uploadFiles.vue +100 -0
- package/frontend-starter/src/helpers/uploadImages.vue +89 -0
- package/frontend-starter/src/helpers/user.js +40 -0
- package/frontend-starter/src/index.css +281 -0
- package/frontend-starter/src/main.js +145 -0
- package/frontend-starter/tailwind.config.js +46 -0
- package/frontend-starter/vite.config.js +10 -0
- package/frontend-starter/yarn.lock +3380 -0
- package/mango-cms-0.0.13.tgz +0 -0
- package/package.json +24 -0
- package/src/cli.js +93 -0
- package/src/default-config/automation/index.js +37 -0
- package/src/default-config/collections/examples.js +60 -0
- package/src/default-config/config/.collections.json +1 -0
- package/src/default-config/config/globalFields.js +15 -0
- package/src/default-config/config/settings.json +23 -0
- package/src/default-config/config/statuses.js +0 -0
- package/src/default-config/config/users.js +35 -0
- package/src/default-config/endpoints/index.js +19 -0
- package/src/default-config/fields/vimeo.js +36 -0
- package/src/default-config/hooks/test.js +5 -0
- package/src/default-config/plugins/mango-stand/index.js +206 -0
- package/src/main.js +278 -0
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mango-cms",
|
|
3
|
+
"version": "0.0.13",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"mango": "bin/mango"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [],
|
|
13
|
+
"author": "",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"arg": "^5.0.0",
|
|
17
|
+
"await-spawn": "^4.0.2",
|
|
18
|
+
"chalk": "^4.1.1",
|
|
19
|
+
"esm": "^3.2.25",
|
|
20
|
+
"fs-extra": "^11.1.1",
|
|
21
|
+
"inquirer": "^8.1.0",
|
|
22
|
+
"ncp": "^2.0.0"
|
|
23
|
+
}
|
|
24
|
+
}
|
package/src/cli.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import arg from 'arg';
|
|
2
|
+
import inquirer from 'inquirer';
|
|
3
|
+
import { serveMango, buildMango, initMango, createMango } from './main';
|
|
4
|
+
|
|
5
|
+
function parseArgumentsIntoOptions(rawArgs) {
|
|
6
|
+
const args = arg(
|
|
7
|
+
{
|
|
8
|
+
// '--git': Boolean,
|
|
9
|
+
'--help': Boolean,
|
|
10
|
+
'-h': Boolean,
|
|
11
|
+
// '--install': Boolean,
|
|
12
|
+
// '-g': '--git',
|
|
13
|
+
// '-y': '--yes',
|
|
14
|
+
// '-i': '--install',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
argv: rawArgs.slice(2),
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
return {
|
|
21
|
+
help: args['--help'] || args['-h'] || false,
|
|
22
|
+
// git: args['--git'] || false,
|
|
23
|
+
command: args._[0],
|
|
24
|
+
projectName: args._[1],
|
|
25
|
+
// runInstall: args['--install'] || false,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// async function promptForMissingOptions(options) {
|
|
30
|
+
|
|
31
|
+
// const questions = [];
|
|
32
|
+
// if (!options.template) {
|
|
33
|
+
// questions.push({
|
|
34
|
+
// type: 'list',
|
|
35
|
+
// name: 'template',
|
|
36
|
+
// message: 'Please choose which project template to use',
|
|
37
|
+
// choices: ['JavaScript', 'TypeScript'],
|
|
38
|
+
// default: defaultTemplate,
|
|
39
|
+
// });
|
|
40
|
+
// }
|
|
41
|
+
|
|
42
|
+
// if (!options.git) {
|
|
43
|
+
// questions.push({
|
|
44
|
+
// type: 'confirm',
|
|
45
|
+
// name: 'git',
|
|
46
|
+
// message: 'Initialize a git repository?',
|
|
47
|
+
// default: false,
|
|
48
|
+
// });
|
|
49
|
+
// }
|
|
50
|
+
|
|
51
|
+
// const answers = await inquirer.prompt(questions);
|
|
52
|
+
// return {
|
|
53
|
+
// ...options,
|
|
54
|
+
// template: options.template || answers.template,
|
|
55
|
+
// git: options.git || answers.git,
|
|
56
|
+
// };
|
|
57
|
+
|
|
58
|
+
// }
|
|
59
|
+
|
|
60
|
+
export async function cli(args) {
|
|
61
|
+
let options = parseArgumentsIntoOptions(args);
|
|
62
|
+
// options = await promptForMissingOptions(options);
|
|
63
|
+
// console.log(options);
|
|
64
|
+
if (options.command == 'serve' || options.command == 'dev' || options.command == 'start') {
|
|
65
|
+
await serveMango(options)
|
|
66
|
+
} else if (options.command == 'build') {
|
|
67
|
+
await buildMango(options)
|
|
68
|
+
} else if (options.command == 'init') {
|
|
69
|
+
await initMango(options)
|
|
70
|
+
} else if (options.command == 'create') {
|
|
71
|
+
if (options.projectName) {
|
|
72
|
+
await createMango(options)
|
|
73
|
+
} else {
|
|
74
|
+
console.error('Please specify a project name (mango create {project-name})')
|
|
75
|
+
}
|
|
76
|
+
} else if (options.command) {
|
|
77
|
+
console.error(`command not recognized: ${options.command}`)
|
|
78
|
+
} else if (options.help) {
|
|
79
|
+
console.log('')
|
|
80
|
+
console.log('Available commands to be called from within your project directory:')
|
|
81
|
+
console.log('')
|
|
82
|
+
console.log('mango init')
|
|
83
|
+
console.log('mango serve')
|
|
84
|
+
console.log('mango build')
|
|
85
|
+
console.log('')
|
|
86
|
+
console.log('To create a new full mango project:')
|
|
87
|
+
console.log('')
|
|
88
|
+
console.log('mango create {project-name}')
|
|
89
|
+
console.log('')
|
|
90
|
+
} else {
|
|
91
|
+
console.log('try mango --help')
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
let days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
|
|
2
|
+
|
|
3
|
+
Date.prototype.monthDays = function () {
|
|
4
|
+
var d = new Date(this.getFullYear(), this.getMonth() + 1, 0);
|
|
5
|
+
return d.getDate();
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
let startAutomations = function () {
|
|
9
|
+
|
|
10
|
+
// console.log('starting!')
|
|
11
|
+
|
|
12
|
+
setInterval(() => {
|
|
13
|
+
|
|
14
|
+
// Five hour timezone offset for DigitalOcean server
|
|
15
|
+
let now = new Date(Date.now() - 1000 * 60 * 60 * 5)
|
|
16
|
+
|
|
17
|
+
let day = now.getDay()
|
|
18
|
+
let weekday = days[day]
|
|
19
|
+
let date = now.getDate()
|
|
20
|
+
let month = now.getMonth()
|
|
21
|
+
|
|
22
|
+
let hour = now.getHours()
|
|
23
|
+
let minute = now.getMinutes()
|
|
24
|
+
|
|
25
|
+
let monthDays = now.monthDays()
|
|
26
|
+
let nthWeekdayOfMonth = Math.ceil(day / 7)
|
|
27
|
+
let daysRemainingInMonth = monthDays - date
|
|
28
|
+
let lastWeekdayOfMonth = (daysRemainingInMonth) < 7
|
|
29
|
+
|
|
30
|
+
// Automations to run (cron)
|
|
31
|
+
// if ((weekday == 'Thursday' || weekday == 'Friday') && hour == 8 && minute == 1) doSomethingCool()
|
|
32
|
+
|
|
33
|
+
}, 1000 * 60);
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default startAutomations
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*
|
|
2
|
+
This is an example collection. It will inherit its name
|
|
3
|
+
from the filename for the plural of this collection type
|
|
4
|
+
(examples)
|
|
5
|
+
|
|
6
|
+
The singular should be defined on the root of the export
|
|
7
|
+
or it will be declared as `singularExamples` by default.
|
|
8
|
+
|
|
9
|
+
There should also be a `fields` attribute on the root
|
|
10
|
+
which contains all of the fields in the collection.
|
|
11
|
+
Custom fields can be imported directly, and default fields
|
|
12
|
+
can be imported from the CMS.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import fields from '@cms/1. build/fields'
|
|
16
|
+
let { Relationship, Image } = fields
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
permissions: {
|
|
20
|
+
public: ['create', 'read', 'update', 'delete'],
|
|
21
|
+
},
|
|
22
|
+
singular: 'example',
|
|
23
|
+
fields: {
|
|
24
|
+
someData: String,
|
|
25
|
+
anotherField: 'Int',
|
|
26
|
+
anArrayOfInts: ['Int'],
|
|
27
|
+
image: Image({ width: 500 }),
|
|
28
|
+
/* Relationships require that you specify the singular form
|
|
29
|
+
of the collection that you're relating to */
|
|
30
|
+
exampleRelationship: Relationship({ collection: 'example' }),
|
|
31
|
+
/* This is an example of a `complexField`, just think of it
|
|
32
|
+
as a nested object structured the same way as a collection
|
|
33
|
+
with the `fields` attribute. */
|
|
34
|
+
someLegitData: {
|
|
35
|
+
fields: {
|
|
36
|
+
coordinates: {
|
|
37
|
+
x: 'Int',
|
|
38
|
+
y: 'Int'
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
/* There are also some sweet things like computed fields.
|
|
43
|
+
There are some cool caching options for computed fields you
|
|
44
|
+
can lookup in the docs */
|
|
45
|
+
productOfXY: {
|
|
46
|
+
computed: doc => doc.someLegitData?.coordinates?.x * doc.someLegitData?.coordinates?.y
|
|
47
|
+
},
|
|
48
|
+
/* Sometimes you might want to store a different type of data
|
|
49
|
+
than you're taking in. There are some cool field options to help
|
|
50
|
+
with this */
|
|
51
|
+
vimeo: {
|
|
52
|
+
inputType: 'Int',
|
|
53
|
+
fields: {
|
|
54
|
+
id: 'Int',
|
|
55
|
+
url: 'String'
|
|
56
|
+
},
|
|
57
|
+
translateInput: input => ({ id: input, url: `https://vimeo.com/${input}` })
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"name":"members","ssrModel":null,"titleName":"Members","singular":"member","titleSingular":"Member","humanName":" Members","humanSingular":" Member","fields":[{"name":"title","relationship":false,"instanceOf":null,"options":null,"humanName":"title","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":true,"customField":false,"global":true,"fields":null},{"name":"author","relationship":"members","instanceOf":"relationship","options":null,"humanName":"author","type":"Member","inputType":null,"computed":true,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"editId","relationship":false,"instanceOf":null,"options":null,"humanName":"edit Id","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"created","relationship":false,"instanceOf":null,"options":null,"humanName":"created","type":"Float","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"updated","relationship":false,"instanceOf":null,"options":null,"humanName":"updated","type":"Float","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"slug","relationship":false,"instanceOf":null,"options":null,"humanName":"slug","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"startDate","relationship":false,"instanceOf":null,"options":null,"humanName":"start Date","type":"DateTime","inputType":"DateTime","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"endDate","relationship":false,"instanceOf":null,"options":null,"humanName":"end Date","type":"DateTime","inputType":"DateTime","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"email","relationship":false,"instanceOf":null,"options":null,"humanName":"email","type":"String","inputType":"String","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":false,"fields":null},{"name":"password","relationship":false,"instanceOf":null,"options":null,"humanName":"password","type":"MembersPassword","inputType":"String","computed":false,"complex":true,"translate":true,"required":true,"customField":false,"global":false,"fields":[{"name":"salt","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"salt","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"hash","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"hash","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"apiKey","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"api Key","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]},{"name":"roles","relationship":false,"instanceOf":"select","options":["admin","member","contributor","editor"],"humanName":"roles","type":"[String]","inputType":"[String]","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":false,"fields":null},{"name":"firstName","relationship":false,"instanceOf":null,"options":null,"humanName":"first Name","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"lastName","relationship":false,"instanceOf":null,"options":null,"humanName":"last Name","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]},{"name":"examples","ssrModel":null,"titleName":"Examples","singular":"example","titleSingular":"Example","humanName":" Examples","humanSingular":" Example","fields":[{"name":"title","relationship":false,"instanceOf":null,"options":null,"humanName":"title","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":true,"customField":false,"global":true,"fields":null},{"name":"author","relationship":"members","instanceOf":"relationship","options":null,"humanName":"author","type":"Member","inputType":null,"computed":true,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"editId","relationship":false,"instanceOf":null,"options":null,"humanName":"edit Id","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"created","relationship":false,"instanceOf":null,"options":null,"humanName":"created","type":"Float","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"updated","relationship":false,"instanceOf":null,"options":null,"humanName":"updated","type":"Float","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"slug","relationship":false,"instanceOf":null,"options":null,"humanName":"slug","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"startDate","relationship":false,"instanceOf":null,"options":null,"humanName":"start Date","type":"DateTime","inputType":"DateTime","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"endDate","relationship":false,"instanceOf":null,"options":null,"humanName":"end Date","type":"DateTime","inputType":"DateTime","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"someData","relationship":false,"instanceOf":null,"options":null,"humanName":"some Data","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"anotherField","relationship":false,"instanceOf":null,"options":null,"humanName":"another Field","type":"Int","inputType":"Int","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"anArrayOfInts","array":true,"relationship":false,"instanceOf":null,"options":null,"humanName":"an Array Of Ints","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"image","relationship":false,"instanceOf":"image","options":null,"humanName":"image","type":"ExamplesImage","inputType":"String","computed":false,"complex":true,"translate":true,"required":false,"customField":false,"global":false,"fields":[{"name":"width","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"width","type":"Int","inputType":"Int","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"height","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"height","type":"Int","inputType":"Int","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"url","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"url","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]},{"name":"exampleRelationship","relationship":"examples","instanceOf":"relationship","options":null,"humanName":"example Relationship","type":"[Example]","inputType":"[String]","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":false,"fields":null},{"name":"someLegitData","relationship":false,"instanceOf":null,"options":null,"humanName":"some Legit Data","type":"ExamplesSomeLegitData","inputType":"CreateExamplesSomeLegitDataInput","computed":false,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"coordinates","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"coordinates","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]},{"name":"productOfXY","relationship":false,"instanceOf":null,"options":null,"humanName":"product Of X Y","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"vimeo","relationship":false,"instanceOf":null,"options":null,"humanName":"vimeo","type":"ExamplesVimeo","inputType":"Int","computed":false,"complex":true,"translate":true,"required":false,"customField":false,"global":false,"fields":[{"name":"id","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"id","type":"Int","inputType":"Int","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"url","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"url","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]}]},{"name":"items","ssrModel":null,"titleName":"Items","singular":"item","titleSingular":"Item","humanName":" Items","humanSingular":" Item","library":"Mango-stand","fields":[{"name":"title","relationship":false,"instanceOf":null,"options":null,"humanName":"title","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":true,"customField":false,"global":true,"fields":null},{"name":"author","relationship":"members","instanceOf":"relationship","options":null,"humanName":"author","type":"Member","inputType":null,"computed":true,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"editId","relationship":false,"instanceOf":null,"options":null,"humanName":"edit Id","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"created","relationship":false,"instanceOf":null,"options":null,"humanName":"created","type":"Float","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"updated","relationship":false,"instanceOf":null,"options":null,"humanName":"updated","type":"Float","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"slug","relationship":false,"instanceOf":null,"options":null,"humanName":"slug","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"startDate","relationship":false,"instanceOf":null,"options":null,"humanName":"start Date","type":"DateTime","inputType":"DateTime","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"endDate","relationship":false,"instanceOf":null,"options":null,"humanName":"end Date","type":"DateTime","inputType":"DateTime","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"price","relationship":false,"instanceOf":null,"options":null,"humanName":"price","type":"Int","inputType":"Int","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"stock","relationship":false,"instanceOf":null,"options":null,"humanName":"stock","type":"Int","inputType":"Int","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"description","relationship":false,"instanceOf":null,"options":null,"humanName":"description","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]},{"name":"carts","ssrModel":null,"titleName":"Carts","singular":"cart","titleSingular":"Cart","humanName":" Carts","humanSingular":" Cart","library":"Mango-stand","fields":[{"name":"title","relationship":false,"instanceOf":null,"options":null,"humanName":"title","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"author","relationship":"members","instanceOf":"relationship","options":null,"humanName":"author","type":"Member","inputType":null,"computed":true,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"editId","relationship":false,"instanceOf":null,"options":null,"humanName":"edit Id","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"created","relationship":false,"instanceOf":null,"options":null,"humanName":"created","type":"Float","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"updated","relationship":false,"instanceOf":null,"options":null,"humanName":"updated","type":"Float","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"slug","relationship":false,"instanceOf":null,"options":null,"humanName":"slug","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"startDate","relationship":false,"instanceOf":null,"options":null,"humanName":"start Date","type":"DateTime","inputType":"DateTime","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"endDate","relationship":false,"instanceOf":null,"options":null,"humanName":"end Date","type":"DateTime","inputType":"DateTime","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"transactionId","relationship":false,"instanceOf":null,"options":null,"humanName":"transaction Id","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"finalized","relationship":false,"instanceOf":null,"options":null,"humanName":"finalized","type":"Boolean","inputType":"Boolean","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"completed","relationship":false,"instanceOf":null,"options":null,"humanName":"completed","type":"Boolean","inputType":"Boolean","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"completedDate","relationship":false,"instanceOf":null,"options":null,"humanName":"completed Date","type":"DateTime","inputType":"DateTime","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":false,"fields":null},{"name":"cartItems","array":true,"relationship":false,"instanceOf":null,"options":null,"humanName":"cart Items","type":"CartsCartItems","inputType":"CreateCartsCartItemsInput","computed":false,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"quantity","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"quantity","type":"Int","inputType":"Int","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"discount","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"discount","type":"Float","inputType":"Float","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"item","array":false,"relationship":"items","instanceOf":"relationship","options":null,"humanName":"item","type":"Item","inputType":"String","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":false,"fields":null}]},{"name":"coupons","relationship":"discounts","instanceOf":"relationship","options":null,"humanName":"coupons","type":"[Discount]","inputType":"[String]","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":false,"fields":null},{"name":"customerId","relationship":false,"instanceOf":null,"options":null,"humanName":"customer Id","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"billing","relationship":false,"instanceOf":null,"options":null,"humanName":"billing","type":"CartsBilling","inputType":"CreateCartsBillingInput","computed":false,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"paymentId","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"payment Id","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"firstName","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"first Name","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"lastName","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"last Name","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"phoneNumber","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"phone Number","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"address","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"address","type":"CartsBillingAddress","inputType":"CreateCartsBillingAddressInput","computed":false,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"venue","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"venue","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"address","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"address","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"city","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"city","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"state","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"state","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"zip","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"zip","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"country","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"country","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"human","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"human","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"coordinates","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"coordinates","type":"CartsBillingAddressCoordinates","inputType":null,"computed":true,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"lat","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"lat","type":"Float","inputType":"Float","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"lng","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"lng","type":"Float","inputType":"Float","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]}]},{"name":"payment","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"payment","type":"CartsBillingPayment","inputType":"CreateCartsBillingPaymentInput","computed":false,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"creditCard","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"credit Card","type":"CartsBillingPaymentCreditCard","inputType":"CreateCartsBillingPaymentCreditCardInput","computed":false,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"cardNumber","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"card Number","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"cardType","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"card Type","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"expirationDate","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"expiration Date","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]},{"name":"bankAccount","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"bank Account","type":"CartsBillingPaymentBankAccount","inputType":"CreateCartsBillingPaymentBankAccountInput","computed":false,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"accountNumber","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"account Number","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"accountType","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"account Type","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"echeckType","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"echeck Type","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"nameOnAccount","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"name On Account","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"routingNumber","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"routing Number","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]}]}]},{"name":"shipping","relationship":false,"instanceOf":null,"options":null,"humanName":"shipping","type":"CartsShipping","inputType":"CreateCartsShippingInput","computed":false,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"method","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"method","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"price","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"price","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"addressId","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"address Id","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"firstName","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"first Name","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"lastName","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"last Name","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"phoneNumber","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"phone Number","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"address","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"address","type":"CartsShippingAddress","inputType":"CreateCartsShippingAddressInput","computed":false,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"venue","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"venue","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"address","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"address","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"city","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"city","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"state","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"state","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"zip","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"zip","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"country","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"country","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"human","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"human","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"coordinates","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"coordinates","type":"CartsShippingAddressCoordinates","inputType":null,"computed":true,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"lat","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"lat","type":"Float","inputType":"Float","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"lng","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"lng","type":"Float","inputType":"Float","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]}]},{"name":"free","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"free","type":"Boolean","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]},{"name":"price","relationship":false,"instanceOf":null,"options":null,"humanName":"price","type":"CartsPrice","inputType":null,"computed":true,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"subtotal","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"subtotal","type":"Float","inputType":"Float","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"discount","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"discount","type":"Float","inputType":"Float","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"total","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"total","type":"Float","inputType":"Float","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]}]},{"name":"discounts","ssrModel":null,"titleName":"Discounts","singular":"discount","titleSingular":"Discount","humanName":" Discounts","humanSingular":" Discount","library":"Mango-stand","fields":[{"name":"title","relationship":false,"instanceOf":null,"options":null,"humanName":"title","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":true,"customField":false,"global":true,"fields":null},{"name":"author","relationship":"members","instanceOf":"relationship","options":null,"humanName":"author","type":"Member","inputType":null,"computed":true,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"editId","relationship":false,"instanceOf":null,"options":null,"humanName":"edit Id","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"created","relationship":false,"instanceOf":null,"options":null,"humanName":"created","type":"Float","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"updated","relationship":false,"instanceOf":null,"options":null,"humanName":"updated","type":"Float","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"slug","relationship":false,"instanceOf":null,"options":null,"humanName":"slug","type":"String","inputType":null,"computed":true,"complex":false,"translate":false,"required":false,"customField":false,"global":true,"fields":null},{"name":"startDate","relationship":false,"instanceOf":null,"options":null,"humanName":"start Date","type":"DateTime","inputType":"DateTime","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"endDate","relationship":false,"instanceOf":null,"options":null,"humanName":"end Date","type":"DateTime","inputType":"DateTime","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":true,"fields":null},{"name":"type","relationship":false,"instanceOf":"select","options":["coupon","sale"],"humanName":"type","type":"String","inputType":"String","computed":false,"complex":false,"translate":true,"required":true,"customField":false,"global":false,"fields":null},{"name":"code","relationship":false,"instanceOf":null,"options":null,"humanName":"code","type":"String","inputType":"String","computed":false,"complex":false,"translate":true,"required":true,"customField":false,"global":false,"fields":null},{"name":"limitations","relationship":false,"instanceOf":null,"options":null,"humanName":"limitations","type":"DiscountsLimitations","inputType":"CreateDiscountsLimitationsInput","computed":false,"complex":true,"translate":false,"required":false,"customField":true,"global":false,"fields":[{"name":"items","array":false,"relationship":"items","instanceOf":"relationship","options":null,"humanName":"items","type":"[Item]","inputType":"[String]","computed":false,"complex":false,"translate":true,"required":false,"customField":false,"global":false,"fields":null},{"name":"perCustomer","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"per Customer","type":"Int","inputType":"Int","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"totalUses","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"total Uses","type":"Int","inputType":"Int","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"perOrder","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"per Order","type":"Int","inputType":"Int","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"quantity","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"quantity","type":"Int","inputType":"Int","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]},{"name":"freeShipping","relationship":false,"instanceOf":null,"options":null,"humanName":"free Shipping","type":"Boolean","inputType":"Boolean","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"discount","relationship":false,"instanceOf":null,"options":null,"humanName":"discount","type":"DiscountsDiscount","inputType":"String","computed":false,"complex":true,"translate":true,"required":false,"customField":false,"example":"$12.50 or 50% etc.","global":false,"fields":[{"name":"type","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"type","type":"String","inputType":"String","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null},{"name":"value","array":false,"relationship":false,"instanceOf":null,"options":null,"humanName":"value","type":"Float","inputType":"Float","computed":false,"complex":false,"translate":false,"required":false,"customField":false,"global":false,"fields":null}]}]}]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import fields from '@cms/1. build/fields'
|
|
2
|
+
let { PlainText, Select, Timestamp, Relationship } = fields
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
|
|
6
|
+
title: PlainText({ required: true }),
|
|
7
|
+
author: Relationship({ collection: 'member', single: true, computed: (doc, req) => [req?.member?.id] || [] }),
|
|
8
|
+
editId: { computed: (doc, req) => req?.member?.id || null },
|
|
9
|
+
created: { computed: doc => doc.created || new Date, type: 'Float' },
|
|
10
|
+
updated: { computed: doc => doc.updated ? new Date : doc.created, type: 'Float' },
|
|
11
|
+
slug: { computed: doc => doc?.title?.toLowerCase()?.trim()?.replace(/[^a-zA-Z0-9\s]/g, '')?.replace(/\s/g, '-') },
|
|
12
|
+
startDate: Timestamp(),
|
|
13
|
+
endDate: Timestamp(),
|
|
14
|
+
|
|
15
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"port": 3001,
|
|
3
|
+
"siteName": "Example",
|
|
4
|
+
"siteDomain": "example.com",
|
|
5
|
+
|
|
6
|
+
"domain": "api.example.com",
|
|
7
|
+
|
|
8
|
+
"mongoURI":"mongodb://127.0.0.1:27017",
|
|
9
|
+
"database":"exampleMongoDB",
|
|
10
|
+
|
|
11
|
+
"s3AccessKeyId": null,
|
|
12
|
+
"s3AccessKeySecret": null,
|
|
13
|
+
"s3Region": null,
|
|
14
|
+
"s3Bucket":"exampleBucket",
|
|
15
|
+
|
|
16
|
+
"mailgunKey": null,
|
|
17
|
+
"mailgunDomain": null,
|
|
18
|
+
|
|
19
|
+
"algoliaAppId": null,
|
|
20
|
+
"algoliaSearchKey": null,
|
|
21
|
+
"algoliaIndex": null
|
|
22
|
+
|
|
23
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { readEntries, updateEntry } from "../../mango/src/cms/1. build/libraries/mongo"
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
fields: {
|
|
5
|
+
firstName: String,
|
|
6
|
+
lastName: String,
|
|
7
|
+
},
|
|
8
|
+
families: {
|
|
9
|
+
contributors: { singular: 'contributor' },
|
|
10
|
+
editors: { singular: 'editor' },
|
|
11
|
+
},
|
|
12
|
+
hooks: {
|
|
13
|
+
async created({ document }) {
|
|
14
|
+
|
|
15
|
+
let members = await readEntries({ collection: 'members' })
|
|
16
|
+
if (members.length == 1 && members[0].id == document.id) {
|
|
17
|
+
|
|
18
|
+
document.roles = ['admin']
|
|
19
|
+
document.authorId = document.id
|
|
20
|
+
document.author = document.id
|
|
21
|
+
|
|
22
|
+
await updateEntry({
|
|
23
|
+
collection: 'members',
|
|
24
|
+
document: {
|
|
25
|
+
roles: ['admin'],
|
|
26
|
+
author: [document.id],
|
|
27
|
+
authorId: document.id
|
|
28
|
+
},
|
|
29
|
+
search: { id: document.id }
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
test: {
|
|
3
|
+
async get(req) {
|
|
4
|
+
return `Mango is online! ðŸ¥`
|
|
5
|
+
}
|
|
6
|
+
},
|
|
7
|
+
contact: {
|
|
8
|
+
admin: {
|
|
9
|
+
async post(req) {
|
|
10
|
+
return `You hit /contact/admin with a post request`
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
editor: {
|
|
14
|
+
async get(req) {
|
|
15
|
+
return `You hit /contact/editor with a get request`
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import axios from 'axios'
|
|
2
|
+
const apiKey = 'YOUR-VIMEO-API-KEY'
|
|
3
|
+
|
|
4
|
+
const getVideoThumbnail = async function (video) {
|
|
5
|
+
let videoData = await axios.get(`https://vimeo.com/api/v2/video/${video.id}.json`)
|
|
6
|
+
return videoData?.data?.[0]?.thumbnail_large
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// const getDownloadLink = async function(video) {
|
|
10
|
+
// let url = `https://api.vimeo.com/videos/${video.id}?access_token=${apiKey}`
|
|
11
|
+
// let videoData = await axios.get(url)
|
|
12
|
+
// videoData = videoData?.data?.download?.filter(download => download?.quality != 'source')
|
|
13
|
+
// let bestDownload = videoData.reduce((challenger, champ) => challenger.height > champ.height ? challenger : champ, videoData[0])
|
|
14
|
+
// return bestDownload?.link
|
|
15
|
+
// }
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
type: 'Vimeo',
|
|
19
|
+
inputType: String,
|
|
20
|
+
fields: {
|
|
21
|
+
id: {},
|
|
22
|
+
url: {},
|
|
23
|
+
thumbnail: {
|
|
24
|
+
computed: getVideoThumbnail,
|
|
25
|
+
expireCache: 60 * 60 * 24 * 30
|
|
26
|
+
},
|
|
27
|
+
// download: {
|
|
28
|
+
// computed: getDownloadLink,
|
|
29
|
+
// expireCache: 60*60*24*1
|
|
30
|
+
// },
|
|
31
|
+
},
|
|
32
|
+
translateInput: input => ({
|
|
33
|
+
id: `${input}`,
|
|
34
|
+
url: `https://vimeo.com/${input}`,
|
|
35
|
+
})
|
|
36
|
+
}
|