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

+30 -28
View File
@@ -1,10 +1,8 @@
import events from '../utils/events';
import { ESX } from './server';
import events from "../utils/events";
import { ESX } from "./server";
import { getSource } from "./functions";
import { pool } from './db';
import { usePhoneNumber } from './functions';
import { pool } from "./db";
import { usePhoneNumber } from "./functions";
interface Listing {
title: string;
@@ -13,48 +11,52 @@ interface Listing {
description: string;
}
async function fetchAllListings(): Promise<Listing[]> {
const query = "SELECT * FROM npwd_sellout_listings ORDER BY id DESC";
const [ results ] = await pool.query(query);
const [results] = await pool.query(query);
const listings = <Listing[]>results;
return listings;
}
async function addListing(identifier: string, name: string, number: any, listing: Listing): Promise<any> {
const query = "INSERT INTO npwd_sellout_listings (identifier, name, number, title, url, description) VALUES (?, ?, ?, ?, ?, ?)"
async function addListing(
identifier: string,
name: string,
number: any,
listing: Listing
): Promise<any> {
const query =
"INSERT INTO npwd_sellout_listings (identifier, name, number, title, url, description) VALUES (?, ?, ?, ?, ?, ?)";
await pool.query(query, [
identifier,
identifier,
name,
number,
listing.title,
listing.url,
listing.title,
listing.url,
listing.description,
])
}
]);
}
onNet(events.SELLOUT_FETCH_LISTING, async () => {
try {
const _source = (global as any).source;
const listings = await fetchAllListings();
emitNet(events.SELLOUT_SEND_LISTING, _source, listings)
} catch(error) {
console.log(error)
emitNet(events.SELLOUT_SEND_LISTING, _source, listings);
} catch (error) {
console.log(error);
}
})
});
onNet(events.SELLOUT_ADD_LISTING, async (listing: Listing) => {
try {
const xPlayer = ESX.GetPlayerFromId(getSource())
const _identifier = xPlayer.getIdentifier()
const name = xPlayer.getName()
const phoneNumber = await usePhoneNumber(_identifier)
addListing(_identifier, name, phoneNumber, listing)
const xPlayer = ESX.GetPlayerFromId(getSource());
const _identifier = xPlayer.getIdentifier();
const name = xPlayer.getName();
const phoneNumber = await usePhoneNumber(_identifier);
addListing(_identifier, name, phoneNumber, listing);
} catch (error) {
console.log("Failed to add contact: ", error)
console.log("Failed to add contact: ", error);
}
})
});