Compare commits

...

2 Commits

Author SHA1 Message Date
Konstantinos Kamaropoulos e45565d45e feat: Enable CORS 5 years ago
Konstantinos Kamaropoulos 748679e1fc feat: Add gps_data field to the stored data 5 years ago
  1. 1
      src/logs/logs.interface.ts
  2. 1
      src/logs/logs.service.ts
  3. 1
      src/main.ts
  4. 1
      src/schemas/logs.schema.ts

1
src/logs/logs.interface.ts

@ -4,6 +4,7 @@ export interface ILogs {
_id?: number; _id?: number;
drone_id: number; drone_id: number;
gprmc: String; gprmc: String;
gps_data: Object;
sensorReadings: Object; sensorReadings: Object;
createdAt?: Date; createdAt?: Date;
updatedAt?: Date; updatedAt?: Date;

1
src/logs/logs.service.ts

@ -18,6 +18,7 @@ export class LogsService {
const storedLog = new this.logsModel({ const storedLog = new this.logsModel({
drone_id: data["id"], drone_id: data["id"],
gprmc: data["GPRMC"], gprmc: data["GPRMC"],
gps_data: data["gps_data"],
sensorReadings: data["sensorReadings"] sensorReadings: data["sensorReadings"]
}); });
let id = await storedLog.save(); let id = await storedLog.save();

1
src/main.ts

@ -3,6 +3,7 @@ import { AppModule } from './app.module';
async function bootstrap() { async function bootstrap() {
const app = await NestFactory.create(AppModule); const app = await NestFactory.create(AppModule);
app.enableCors();
await app.listen(3000); await app.listen(3000);
} }
bootstrap(); bootstrap();

1
src/schemas/logs.schema.ts

@ -3,5 +3,6 @@ import * as mongoose from 'mongoose';
export const LogsSchema = new mongoose.Schema({ export const LogsSchema = new mongoose.Schema({
drone_id: { type: Number }, drone_id: { type: Number },
gprmc: { type: String }, gprmc: { type: String },
gps_data: { type: Object },
sensorReadings: { type: Object } sensorReadings: { type: Object }
}, { timestamps: true }); }, { timestamps: true });

Loading…
Cancel
Save