예제 #1
0
def editTopic(id):
	data = json.loads(request.data)
	# Save layer data
	c = CatalogModel()
	c.updateTopic(id, data)

	return jsonify({'result': True})
예제 #2
0
def createTopic():
	data = json.loads(request.data)
	# Save topic data
	c = CatalogModel()
	result = c.createTopic(data)

	return jsonify({'id': result['topic_id']})
예제 #3
0
def createLayer():
	data = json.loads(request.data)
	# Save layer data
	c = CatalogModel()
	result = c.createLayer(data)

	return jsonify({'id': result['layer_id']})
예제 #4
0
def getLayer(id):
	c = CatalogModel()
	result = c.getLayerById(id)
	if result is None:
		abort(404)

	return jsonify({'result': result})
예제 #5
0
def getSection(id):
	c = CatalogModel()
	result = {}
	topic = c.getTopicById(id)
	result = topic
	children = c.getTopicChildren(id)
	result['children'] = children['children']
	if result is None:
		abort(404)

	return jsonify({'result': result})
예제 #6
0
def getFullCatalog():
	catalog = []
	c = CatalogModel()
	categories = c.getCategories()
	for category in categories:
		category['topics'] = []
		topics = c.getTopicsByCategory(category['id'])
		for topic in topics:
			layers = c.getLayersByTopic(topic['id'])
			topic['layers'] = layers
			category['topics'].append(topic)
		catalog.append(category)

	result = {'result': catalog}

	return jsonify(result)
예제 #7
0
def deleteTopic(id):
	c = CatalogModel()
	c.deleteTopic(id)

	return jsonify({'result': 'true'})