How to use the bookbrainz-data.AchievementType function in bookbrainz-data

To help you get started, we’ve selected a few bookbrainz-data examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bookbrainz / bookbrainz-site / src / server / routes / achievement.js View on Github external
router.get('/admin', (req, res) => {
	const EditorJSONPromise = new Editor()
		.orderBy('name')
		.fetchAll()
		.then((editors) => {
			return editors.map((editor) => {
				const editorJSON = editor.toJSON();
				return {
					id: editorJSON.id,
					name: editorJSON.name
				}
			});
		});

	const AchievementJSONPromise = new AchievementType()
		.orderBy('name')
		.fetchAll()
		.then((achievements) => {
			const achievementList = achievements.toJSON();
			achievementList.unshift({id: 'none', name: 'No Achievement'});
			console.log(achievementList);
			return achievementList;
		});

	const TitleJSONPromise = new TitleType()
		.orderBy('title')
		.fetchAll()
		.then((titles) => {
			const titleList = titles.toJSON();
			titleList.unshift({id: 'none', title: 'No Title'});
			return titleList;