Use mtf-module-db as submodule
This commit is contained in:
parent
da60461d81
commit
9b94a0b334
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +1,6 @@
|
|||||||
[submodule "src/modules/redis"]
|
[submodule "src/modules/redis"]
|
||||||
path = src/modules/redis
|
path = src/modules/redis
|
||||||
url = https://gitea.spilum.net/Spilum.Net/mtf-module-redis
|
url = https://gitea.spilum.net/Spilum.Net/mtf-module-redis
|
||||||
|
[submodule "src/modules/db"]
|
||||||
|
path = src/modules/db
|
||||||
|
url = https://gitea.spilum.net/Spilum.Net/mtf-module-db
|
||||||
|
|||||||
@ -1,14 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
HOST: process.env.PG_HOST,
|
|
||||||
USER: process.env.PG_USER,
|
|
||||||
PASSWORD: process.env.PG_PASS,
|
|
||||||
DB: process.env.PG_DB,
|
|
||||||
PORT: process.env.PG_PORT,
|
|
||||||
dialect: "postgres",
|
|
||||||
pool: {
|
|
||||||
max: 5,
|
|
||||||
min: 0,
|
|
||||||
acquire: 30000,
|
|
||||||
idle: 10000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
REDIS_HOST: process.env.REDIS_HOST,
|
|
||||||
REDIS_PORT: process.env.REDIS_PORT
|
|
||||||
}
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
const config = require("../config");
|
|
||||||
const dbConfig = require("../config/db.config");
|
|
||||||
const redisConfig = require("../config/redis.config");
|
|
||||||
|
|
||||||
const Sequelize = require("sequelize");
|
|
||||||
const sequelize = new Sequelize(
|
|
||||||
dbConfig.DB,
|
|
||||||
dbConfig.USER,
|
|
||||||
dbConfig.PASSWORD,
|
|
||||||
{
|
|
||||||
host: dbConfig.HOST,
|
|
||||||
dialect: dbConfig.dialect,
|
|
||||||
port: dbConfig.PORT,
|
|
||||||
pool: {
|
|
||||||
max: dbConfig.pool.max,
|
|
||||||
min: dbConfig.pool.min,
|
|
||||||
aqcuire: dbConfig.pool.acquire,
|
|
||||||
idle: dbConfig.pool.idle
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// SQL Connection
|
|
||||||
const db = {};
|
|
||||||
|
|
||||||
db.Sequelize = Sequelize;
|
|
||||||
db.sequelize = sequelize;
|
|
||||||
|
|
||||||
db.intent = require("./intent.model")(sequelize, Sequelize);
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
db
|
|
||||||
};
|
|
||||||
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
module.exports = (sequelize, DataTypes) => {
|
|
||||||
const Intent = sequelize.define("intents", {
|
|
||||||
id: {
|
|
||||||
type: DataTypes.INTEGER,
|
|
||||||
primaryKey: true,
|
|
||||||
autoIncrement: true,
|
|
||||||
allowNull: false
|
|
||||||
},
|
|
||||||
name: {
|
|
||||||
type: DataTypes.STRING,
|
|
||||||
allowNull: false
|
|
||||||
},
|
|
||||||
examples: {
|
|
||||||
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
||||||
allowNull: true
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
tableName: "intents",
|
|
||||||
timestamps: false
|
|
||||||
});
|
|
||||||
|
|
||||||
return Intent;
|
|
||||||
};
|
|
||||||
1
src/modules/db
Submodule
1
src/modules/db
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 484c5bd8e5a5c77ef2c6a20817205de99cbc77ce
|
||||||
@ -5,13 +5,14 @@ if (process.env.NODE_ENV !== "production") {
|
|||||||
|
|
||||||
const {env, pipeline} = require("@xenova/transformers");
|
const {env, pipeline} = require("@xenova/transformers");
|
||||||
|
|
||||||
const models = require("./models");
|
const {db} = require('./modules/db');
|
||||||
const db = models.db;
|
|
||||||
const {sequelize, Sequelize} = db;
|
const {sequelize, Sequelize} = db;
|
||||||
const Intent = db.intent;
|
const Intent = db.intent;
|
||||||
|
|
||||||
const {redis} = require('./modules/redis');
|
const {redis} = require('./modules/redis');
|
||||||
|
|
||||||
|
const config = require("./config");
|
||||||
|
|
||||||
async function getIntents() {
|
async function getIntents() {
|
||||||
try {
|
try {
|
||||||
const intents = await Intent.findAll();
|
const intents = await Intent.findAll();
|
||||||
@ -24,8 +25,6 @@ async function getIntents() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const config = require("./config");
|
|
||||||
|
|
||||||
let extractor;
|
let extractor;
|
||||||
|
|
||||||
function normalizeText(text) {
|
function normalizeText(text) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user