LocationHub/server/src/models/wifiLocation.ts

45 lines
909 B
TypeScript

import { DataTypes, Model } from "sequelize";
import { sequelize } from "../database/database";
export class WifiLocation extends Model {
public mac!: string;
public latitude!: number;
public longitude!: number;
public created_at_utc!: Date;
public updated_at_utc!: Date;
}
WifiLocation.init(
{
mac: {
type: DataTypes.STRING,
primaryKey: true,
allowNull: false,
},
latitude: {
type: DataTypes.NUMBER,
allowNull: false,
},
longitude: {
type: DataTypes.NUMBER,
allowNull: false,
},
created_at_utc: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
allowNull: false,
},
updated_at_utc: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
allowNull: false,
},
},
{
sequelize,
modelName: "WifiLocation",
tableName: "wifi_location",
timestamps: false,
}
);