67 lines
1.5 KiB
TypeScript
67 lines
1.5 KiB
TypeScript
import { DataTypes, Model } from "sequelize";
|
|
import { sequelize } from "../database/database";
|
|
|
|
export class Location extends Model {
|
|
public location_id!: string;
|
|
public lp_ttn_end_device_uplinks_id!: string;
|
|
public wifi_latitude!: number;
|
|
public wifi_longitude!: number;
|
|
public gnss_latitude!: number;
|
|
public gnss_longitude!: number;
|
|
public ttn_gw_latitude!: number;
|
|
public ttn_gw_longitude!: number;
|
|
public gnss_location_at_utc!: Date;
|
|
public created_at_utc!: Date;
|
|
public updated_at_utc!: Date;
|
|
}
|
|
|
|
Location.init(
|
|
{
|
|
location_id: {
|
|
type: DataTypes.UUID,
|
|
defaultValue: DataTypes.UUIDV4,
|
|
primaryKey: true,
|
|
},
|
|
lp_ttn_end_device_uplinks_id: {
|
|
type: DataTypes.UUID,
|
|
},
|
|
wifi_latitude: {
|
|
type: DataTypes.NUMBER,
|
|
},
|
|
wifi_longitude: {
|
|
type: DataTypes.NUMBER,
|
|
},
|
|
gnss_latitude: {
|
|
type: DataTypes.NUMBER,
|
|
},
|
|
gnss_longitude: {
|
|
type: DataTypes.NUMBER,
|
|
},
|
|
ttn_gw_latitude: {
|
|
type: DataTypes.NUMBER,
|
|
},
|
|
ttn_gw_longitude: {
|
|
type: DataTypes.NUMBER,
|
|
},
|
|
gnss_location_at_utc: {
|
|
type: DataTypes.DATE,
|
|
},
|
|
created_at_utc: {
|
|
type: DataTypes.DATE,
|
|
defaultValue: DataTypes.NOW,
|
|
allowNull: false,
|
|
},
|
|
updated_at_utc: {
|
|
type: DataTypes.DATE,
|
|
defaultValue: DataTypes.NOW,
|
|
allowNull: false,
|
|
},
|
|
},
|
|
{
|
|
sequelize,
|
|
modelName: "Location",
|
|
tableName: "location",
|
|
timestamps: false,
|
|
}
|
|
);
|