mirror of
https://github.com/outline/outline.git
synced 2026-11-28 16:19:46 +03:00
ts: models
This commit is contained in:
1 parent
d4bb04e921
commit
db79a2cd1e
28 files changed
+5
-35
No files matched your search
@@ -0,0 +1,41 @@
|
||||
import { DataTypes, sequelize } from "../sequelize";
|
||||
|
||||
const SearchQuery = sequelize.define(
|
||||
"search_queries",
|
||||
{
|
||||
id: {
|
||||
type: DataTypes.UUID,
|
||||
defaultValue: DataTypes.UUIDV4,
|
||||
primaryKey: true,
|
||||
},
|
||||
source: {
|
||||
type: DataTypes.ENUM("slack", "app", "api"),
|
||||
allowNull: false,
|
||||
},
|
||||
query: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
},
|
||||
results: {
|
||||
type: DataTypes.NUMBER,
|
||||
allowNull: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
timestamps: true,
|
||||
updatedAt: false,
|
||||
}
|
||||
);
|
||||
|
||||
SearchQuery.associate = (models) => {
|
||||
SearchQuery.belongsTo(models.User, {
|
||||
as: "user",
|
||||
foreignKey: "userId",
|
||||
});
|
||||
SearchQuery.belongsTo(models.Team, {
|
||||
as: "team",
|
||||
foreignKey: "teamId",
|
||||
});
|
||||
};
|
||||
|
||||
export default SearchQuery;
|
||||
Reference in new issue
Block a user