Defining Models

PHOTO EMBED

Mon Mar 21 2022 19:52:11 GMT+0000 (Coordinated Universal Time)

Saved by @mmzaghlool52 #markdown

import {DataTypes} from 'nodejs-express-utils';
import database from '../core/database';

export type ContactUsType = {
    id?: number;
    body: string;
    status?: string;
};
const tableName = 'contactUs';

export default database.init<ContactUsType>(tableName, {
    id: {
        type: DataTypes.UNSIGNED,
        isEncrypted: false,
        isRequired: false,
    },
    body: {
        type: DataTypes.CHAR,
        isEncrypted: true,
        isRequired: true,
    },
    status: {
        type: DataTypes.CHAR,
        isEncrypted: false,
        isRequired: false,
    },
});
content_copyCOPY