This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from src.controller.services.delays import command_delays as delays | |
| from src.controller.services.drone_services import Drone | |
| from time import sleep | |
| import sys | |
| ''' | |
| 'takeoff', 'land', 'time?', 'speed?', | |
| ''' | |
| command_list = ['command', 'battery?'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useReducer } from "react"; | |
| import { useMutation } from "@apollo/react-hooks"; | |
| const AddPost = () => { | |
| const ADD_POST = gql` | |
| mutation( | |
| $authorId: ID! | |
| $title: String! | |
| $body: String | |
| $isPublished: Boolean | |
| ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useReducer } from "react"; | |
| const AddPost = () => { | |
| const [postState, setPostState] = useReducer( | |
| (state, newState) => ({ ...state, ...newState }), | |
| { | |
| title: "", | |
| body: "" | |
| } | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useQuery } from "react"; | |
| const AddPost = () => { | |
| const [postState, setPostState] = useQuery({ | |
| title: "", | |
| body: "" | |
| }); | |
| const handleChange = e => { | |
| setPostState({ [e.target.name]: e.target.value }); | |
| }; | |
| return ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const users = [ | |
| { | |
| id: 1, | |
| name: "Leanne Graham", | |
| username: "Bret", | |
| email: "[email protected]", | |
| isActive: false, | |
| address: { | |
| street: "Kulas Light", | |
| suite: "Apt. 556", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const scheduler = require("./scheduler/scheduler"); | |
| const deleteInactives = require("./cron-jobs/deleteInactives"); | |
| // schedule the deleteInactive users job | |
| scheduler(10000, deleteInactives); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const User = require("../../models/user.schema"); | |
| const deleteInactives = async () => { | |
| const deletedUsers = await User.deleteMany({ isActive: false }); | |
| if (deletedUsers.ok === 1) { | |
| let verb = deletedUsers.n > 1 ? "users" : "user"; | |
| console.log(`${deletedUsers.deletedCount} Inactive ${verb} deleted`); | |
| } else { | |
| return "Error deleting users"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const scheduler = (timer, action) => { | |
| setInterval(action, timer) | |
| } | |
| process.nextTick(() => scheduler); | |
| module.exports = scheduler |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require("express"); | |
| const mongoose = require("mongoose"); | |
| const port = process.env.PORT || 4000; | |
| const uri = process.env.MONGODB_URI; | |
| const options = { | |
| useCreateIndex: true, | |
| useNewUrlParser: true, | |
| useFindAndModify: false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "test": { | |
| "SECRET_KEY": "yOUrsEkretKey", | |
| "MONGODB_URI_OFFLINE": "mongodb://localhost:27017/goals", | |
| "PORT": 4400, | |
| "SALT_ROUND": 15, | |
| "BASE_URL": "http://localhost:3000", | |
| "SSL_PORT": 4040, | |
| "SENDER_EMAIL": "[email protected]", | |
| "SENDER_PASS": "21b-19f318b0", |