Spaces:
Sleeping
Sleeping
| /** | |
| * Copyright (c) 2018, OBCon Inc. | |
| * All rights reserved. | |
| */ | |
| /** | |
| * @file | |
| * @copyright OBCon Inc. Korea 2018 | |
| * @author gye hyun james kim [pnuskgh@gmail.com] | |
| */ | |
| //--- http://docs.sequelizejs.com/ | |
| let Sequelize = require('sequelize'); | |
| let Model = utils.getClass('include', 'model.js'); | |
| class MarkdownsModel extends Model { | |
| constructor() { | |
| super(); | |
| this._title = '마크다운'; | |
| this._database = db.db_scada; | |
| this._tableName = 'markdown'; | |
| } | |
| get fields() { | |
| return Object.assign({ | |
| site: { //--- 사이트 ID | |
| type: Sequelize.INTEGER(11), | |
| allowNull: false, | |
| defaultValue: 1, | |
| validate: { | |
| }, | |
| title: '사이트', | |
| strType: 'integer' | |
| }, | |
| language: { | |
| type: Sequelize.STRING(8), | |
| allowNull: false, | |
| defaultValue: 'ko_KR', | |
| validate: { | |
| }, | |
| title: '언어', | |
| strType: 'select', | |
| enum: [ ['ko_KR', '한국어'], ['en_US', '영어'] ] //--- [value, title]의 배열 | |
| }, | |
| folder: { //--- Menu를 지정하기 위한 폴더 | |
| type: Sequelize.STRING(128), | |
| allowNull: false, | |
| defaultValue: '/', | |
| validate: { | |
| }, | |
| title: '폴더', | |
| strType: 'string' | |
| }, | |
| category: { //--- ,로 구분된 태그 | |
| type: Sequelize.STRING(128), | |
| allowNull: true, | |
| validate: { | |
| }, | |
| title: '분류', | |
| strType: 'string' | |
| }, | |
| content: { //--- Markdown 문서 | |
| type: Sequelize.TEXT('medium'), | |
| allowNull: true, | |
| validate: { | |
| }, | |
| title: '본문', | |
| strType: 'text' | |
| }, | |
| tags: { //--- ,로 구분된 태그 | |
| type: Sequelize.STRING(256), | |
| allowNull: true, | |
| validate: { | |
| }, | |
| title: '태그', | |
| strType: 'string' | |
| }, | |
| isPublic: { //--- true. 로그인한 사용자만 조회할 수 있다. | |
| type: Sequelize.BOOLEAN, | |
| allowNull: false, | |
| defaultValue: false, | |
| validate: { | |
| }, | |
| title: '공개 여부', | |
| strType: 'boolean' | |
| } | |
| }, super.fields); | |
| } | |
| } | |
| module.exports = MarkdownsModel; | |