styling: Enforced styling across all files (#55)

This commit is contained in:
Taso authored and GitHub committed 2021-01-12 21:31:03 -05:00
1 parent c9b3174505
commit 54daa42454
165 files changed
+1879 -1725

No files matched your search

+26 -23
View File
@@ -1,44 +1,47 @@
import events from '../utils/events';
import { ESX, getSource } from './server';
import { pool } from './db';
import { useIdentifier } from './functions';
import { IPhoto } from '../../phone/src/common/typings/photo';
import events from "../utils/events";
import { ESX, getSource } from "./server";
import { pool } from "./db";
import { useIdentifier } from "./functions";
import { IPhoto } from "../../phone/src/common/typings/photo";
async function uploadPhoto(identifier: string, image: string) {
const query = 'INSERT INTO npwd_phone_gallery (identifier, image) VALUES (?, ?)';
await pool.query(query, [identifier, image])
const query =
"INSERT INTO npwd_phone_gallery (identifier, image) VALUES (?, ?)";
await pool.query(query, [identifier, image]);
}
async function getPhotosByIdentifier(identifier: string): Promise<IPhoto[]> {
const query = "SELECT id, image FROM npwd_phone_gallery WHERE identifier = ? ORDER BY id DESC";
const [ results ] = await pool.query(query, [identifier]);
const query =
"SELECT id, image FROM npwd_phone_gallery WHERE identifier = ? ORDER BY id DESC";
const [results] = await pool.query(query, [identifier]);
const photos = <IPhoto[]>results;
return photos;
}
async function deletePhoto(photo: IPhoto, identifier: string) {
const query = "DELETE FROM npwd_phone_gallery WHERE id = ? AND identifier = ?";
await pool.query(query, [photo.id, identifier])
console.log(photo.id)
const query =
"DELETE FROM npwd_phone_gallery WHERE id = ? AND identifier = ?";
await pool.query(query, [photo.id, identifier]);
console.log(photo.id);
}
onNet(events.CAMERA_UPLOAD_PHOTO, async (image: string) => {
const identifier = await useIdentifier()
await uploadPhoto(identifier, image)
})
const identifier = await useIdentifier();
await uploadPhoto(identifier, image);
});
onNet(events.CAMERA_FETCH_PHOTOS, async () => {
const identifier = await useIdentifier();
const photos = await getPhotosByIdentifier(identifier)
emitNet(events.CAMERA_SEND_PHOTOS, getSource(), photos)
})
const photos = await getPhotosByIdentifier(identifier);
emitNet(events.CAMERA_SEND_PHOTOS, getSource(), photos);
});
onNet(events.CAMERA_DELETE_PHOTO, async (photo: IPhoto) => {
try {
const identifier = await useIdentifier()
await deletePhoto(photo, identifier)
emitNet(events.CAMERA_DELETE_PHOTO_SUCCESS, getSource())
const identifier = await useIdentifier();
await deletePhoto(photo, identifier);
emitNet(events.CAMERA_DELETE_PHOTO_SUCCESS, getSource());
} catch (error) {
console.log(error)
console.log(error);
}
})
});