Files
serpbear/database/models/keyword.ts
towfiqi 2a1fc0e43d feat: Adds keyword search volume data feature for tracked keywords.
- Adds a volume field in the keyword table.
- Adds a button in the Adwords Integration screen to update all the tracked keywords.
- When a new keyword is added, the volume data is automatically fetched.
- Adds ability to sort keywords based on search volume.
2024-03-01 10:52:45 +06:00

76 lines
2.2 KiB
TypeScript

import { Table, Model, Column, DataType, PrimaryKey } from 'sequelize-typescript';
@Table({
timestamps: false,
tableName: 'keyword',
})
class Keyword extends Model {
@PrimaryKey
@Column({ type: DataType.INTEGER, allowNull: false, primaryKey: true, autoIncrement: true })
ID!: number;
@Column({ type: DataType.STRING, allowNull: false })
keyword!: string;
@Column({ type: DataType.STRING, allowNull: true, defaultValue: 'desktop' })
device!: string;
@Column({ type: DataType.STRING, allowNull: true, defaultValue: 'US' })
country!: string;
@Column({ type: DataType.STRING, allowNull: true, defaultValue: '' })
city!: string;
@Column({ type: DataType.STRING, allowNull: true, defaultValue: '' })
latlong!: string;
@Column({ type: DataType.STRING, allowNull: false, defaultValue: '{}' })
domain!: string;
// @ForeignKey(() => Domain)
// @Column({ allowNull: false })
// domainID!: number;
// @BelongsTo(() => Domain)
// domain!: Domain;
@Column({ type: DataType.STRING, allowNull: true })
lastUpdated!: string;
@Column({ type: DataType.STRING, allowNull: true })
added!: string;
@Column({ type: DataType.INTEGER, allowNull: false, defaultValue: 0 })
position!: number;
@Column({ type: DataType.STRING, allowNull: true, defaultValue: JSON.stringify([]) })
history!: string;
@Column({ type: DataType.INTEGER, allowNull: false, defaultValue: 0 })
volume!: number;
@Column({ type: DataType.STRING, allowNull: true, defaultValue: JSON.stringify([]) })
url!: string;
@Column({ type: DataType.STRING, allowNull: true, defaultValue: JSON.stringify([]) })
tags!: string;
@Column({ type: DataType.STRING, allowNull: true, defaultValue: JSON.stringify([]) })
lastResult!: string;
@Column({ type: DataType.BOOLEAN, allowNull: true, defaultValue: true })
sticky!: boolean;
@Column({ type: DataType.BOOLEAN, allowNull: true, defaultValue: false })
updating!: boolean;
@Column({ type: DataType.STRING, allowNull: true, defaultValue: 'false' })
lastUpdateError!: string;
@Column({ type: DataType.STRING, allowNull: true })
settings!: string;
}
export default Keyword;