How to use the bookbrainz-data.Publisher.forge 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 / entity / edition.js View on Github external
languages: res.locals.languages,
			editionStatuses: res.locals.editionStatuses,
			editionFormats: res.locals.editionFormats,
			identifierTypes: res.locals.identifierTypes,
			submissionUrl: '/edition/create/handler'
		};

		if (req.query.publication) {
			propsPromise.publication =
				Publication.forge({bbid: req.query.publication})
					.fetch({withRelated: 'defaultAlias'});
		}

		if (req.query.publisher) {
			propsPromise.publisher =
				Publisher.forge({bbid: req.query.publisher})
					.fetch({withRelated: 'defaultAlias'});
		}

		function render(props) {
			const markup = ReactDOMServer.renderToString(EditForm(props));

			res.render('entity/create/edition', {
				title: 'Add Edition',
				heading: 'Create Edition',
				subheading: 'Add a new Edition to BookBrainz',
				props,
				markup
			});
		}

		Promise.props(propsPromise).then(render);