feat: initial setup backend with default routes and db connection
This commit is contained in:
70
server/src/models/ttnGatewayReception.ts
Normal file
70
server/src/models/ttnGatewayReception.ts
Normal file
@ -0,0 +1,70 @@
|
||||
import { DataTypes, Model } from "sequelize";
|
||||
import { sequelize } from "../database/database";
|
||||
|
||||
export class TtnGatewayReception extends Model {
|
||||
public ttn_gateway_reception_id!: string;
|
||||
public lp_ttn_end_device_uplinks_id!: string;
|
||||
public gateway_id!: string;
|
||||
public eui!: string;
|
||||
public rssi!: number;
|
||||
public latitude!: number;
|
||||
public longitude!: number;
|
||||
public altitude!: number;
|
||||
public created_at_utc!: Date;
|
||||
public updated_at_utc!: Date;
|
||||
}
|
||||
|
||||
TtnGatewayReception.init(
|
||||
{
|
||||
ttn_gateway_reception_id: {
|
||||
type: DataTypes.UUID,
|
||||
defaultValue: DataTypes.UUIDV4,
|
||||
primaryKey: true,
|
||||
allowNull: false,
|
||||
},
|
||||
lp_ttn_end_device_uplinks_id: {
|
||||
type: DataTypes.UUID,
|
||||
allowNull: false,
|
||||
},
|
||||
gateway_id: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
},
|
||||
eui: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
},
|
||||
rssi: {
|
||||
type: DataTypes.NUMBER,
|
||||
allowNull: true,
|
||||
},
|
||||
latitude: {
|
||||
type: DataTypes.NUMBER,
|
||||
allowNull: true,
|
||||
},
|
||||
longitude: {
|
||||
type: DataTypes.NUMBER,
|
||||
allowNull: true,
|
||||
},
|
||||
altitude: {
|
||||
type: DataTypes.NUMBER,
|
||||
allowNull: true,
|
||||
},
|
||||
created_at_utc: {
|
||||
type: DataTypes.DATE,
|
||||
defaultValue: DataTypes.NOW,
|
||||
allowNull: false,
|
||||
},
|
||||
updated_at_utc: {
|
||||
type: DataTypes.DATE,
|
||||
defaultValue: DataTypes.NOW,
|
||||
allowNull: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
sequelize,
|
||||
modelName: "TtnGatewayReception",
|
||||
tableName: "ttn_gateway_reception",
|
||||
timestamps: false,
|
||||
}
|
||||
);
|
Reference in New Issue
Block a user