File size: 3,018 Bytes
e4bf523
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
'use strict'
/**

 * 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;