From 8dd94309290a76ceaf7366feb120439d92201c78 Mon Sep 17 00:00:00 2001 From: chip Date: Sun, 18 Oct 2020 21:40:30 +0200 Subject: [PATCH 01/21] Feat(Contact): Added styles for MUI --- phone/src/apps/contacts/components/Contact.css | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 phone/src/apps/contacts/components/Contact.css diff --git a/phone/src/apps/contacts/components/Contact.css b/phone/src/apps/contacts/components/Contact.css new file mode 100644 index 0000000..a6986f2 --- /dev/null +++ b/phone/src/apps/contacts/components/Contact.css @@ -0,0 +1,3 @@ +#contact-app .Mui-focused::after { + border-bottom: #2196f3 solid 4px; +} \ No newline at end of file From 4905de53d28179e4cc76edeb47d4f7cd58a19065 Mon Sep 17 00:00:00 2001 From: chip Date: Sun, 18 Oct 2020 21:44:33 +0200 Subject: [PATCH 02/21] Feat(Contacts:UI): Dropdown menu for updating contacts --- phone/src/apps/contacts/hooks/useContactModal.ts | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 phone/src/apps/contacts/hooks/useContactModal.ts diff --git a/phone/src/apps/contacts/hooks/useContactModal.ts b/phone/src/apps/contacts/hooks/useContactModal.ts new file mode 100644 index 0000000..ce448bf --- /dev/null +++ b/phone/src/apps/contacts/hooks/useContactModal.ts @@ -0,0 +1,7 @@ +import { useRecoilState } from 'recoil'; +import { contactsState } from './state'; + +export const useContactModal = () => { + const [ showContactModal, setShowContactModal ] = useRecoilState(contactsState.showContactsModal); + return { showContactModal, setShowContactModal }; +} \ No newline at end of file From 3a9e3b2b9663053282dc1a83c72f86a2709ed02f Mon Sep 17 00:00:00 2001 From: chip Date: Sun, 18 Oct 2020 21:45:13 +0200 Subject: [PATCH 03/21] Tweak(OS:Navigation): Removed phone route --- .../apps/sellout/components/navigation/NavigationBar.tsx | 6 ------ 1 file changed, 6 deletions(-) diff --git a/phone/src/apps/sellout/components/navigation/NavigationBar.tsx b/phone/src/apps/sellout/components/navigation/NavigationBar.tsx index c6a25ab..85d38da 100644 --- a/phone/src/apps/sellout/components/navigation/NavigationBar.tsx +++ b/phone/src/apps/sellout/components/navigation/NavigationBar.tsx @@ -5,7 +5,6 @@ import { BottomNavigation, BottomNavigationAction } from "@material-ui/core"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faHome } from "@fortawesome/free-solid-svg-icons"; import AddCircleIcon from "@material-ui/icons/AddCircle"; -import FaceIcon from "@material-ui/icons/Face"; const useStyles = makeStyles((theme) => ({ root: { @@ -38,11 +37,6 @@ export const NavigationBar = () => { icon={} to="/sellout/new" /> - } - to="/sellout/new" - /> ); }; From 5cb1ce40c94ad9994a4fc57c872d97d49915829f Mon Sep 17 00:00:00 2001 From: chip Date: Sun, 18 Oct 2020 21:46:04 +0200 Subject: [PATCH 04/21] Feat(Sellout:state): New states for sellout app --- phone/src/apps/sellout/hooks/state.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phone/src/apps/sellout/hooks/state.ts b/phone/src/apps/sellout/hooks/state.ts index 94a8407..46d6a3e 100644 --- a/phone/src/apps/sellout/hooks/state.ts +++ b/phone/src/apps/sellout/hooks/state.ts @@ -3,6 +3,6 @@ import { atom } from "recoil"; export const selloutState = { listing: atom({ key: "listing", - default: null, + default: [], }), }; From 48642083a5eace5a410620f34e6ca204edd87d94 Mon Sep 17 00:00:00 2001 From: chip Date: Sun, 18 Oct 2020 21:47:12 +0200 Subject: [PATCH 05/21] Feat(Sellout:Item): Complete with url, names, and description' --- .../apps/sellout/components/SelloutList/SelloutItem.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/phone/src/apps/sellout/components/SelloutList/SelloutItem.tsx b/phone/src/apps/sellout/components/SelloutList/SelloutItem.tsx index 3e93cba..4b24873 100644 --- a/phone/src/apps/sellout/components/SelloutList/SelloutItem.tsx +++ b/phone/src/apps/sellout/components/SelloutList/SelloutItem.tsx @@ -51,14 +51,16 @@ export const SelloutItem = (listing) => { {listing.name} - {listing.number} - + */} - + {listing.url ? ( + + ): null } {listing.description} From a18ae8d839f1c51407a9510015aeee8f0cc9a196 Mon Sep 17 00:00:00 2001 From: chip Date: Sun, 18 Oct 2020 21:47:53 +0200 Subject: [PATCH 06/21] Feat(Sellout:ListingForm): NUI.send done | some styling --- .../sellout/components/form/ListingForm.tsx | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/phone/src/apps/sellout/components/form/ListingForm.tsx b/phone/src/apps/sellout/components/form/ListingForm.tsx index 669a91f..198a2ce 100644 --- a/phone/src/apps/sellout/components/form/ListingForm.tsx +++ b/phone/src/apps/sellout/components/form/ListingForm.tsx @@ -1,5 +1,8 @@ -import React from "react"; +import React, { useState } from "react"; import { makeStyles, Button, TextField } from "@material-ui/core"; +import Nui from "../../../../os/nui-events/utils/Nui"; + +import "../Sellout.css" const useStyles = makeStyles((theme) => ({ root: { @@ -27,11 +30,25 @@ const useStyles = makeStyles((theme) => ({ export const ListingForm = () => { const classes = useStyles(); + + const [ title, setTitle ] = useState(''); + const [ url, setUrl ] = useState(''); + const [ desc, setDesc ] = useState(''); + + const addListing = () => { + Nui.send('phone:addListing', { + title, + url, + desc + }) + } + return (

New Listing

setTitle(e.target.value)} placeholder="Title on listing.." inputProps={{ className: classes.textFieldInput }} style={{ width: "80%" }} @@ -41,6 +58,7 @@ export const ListingForm = () => { setUrl(e.target.value)} inputProps={{ className: classes.textFieldInput }} style={{ width: "80%" }} size="medium" @@ -49,6 +67,7 @@ export const ListingForm = () => { setDesc(e.target.value)} placeholder="Description" inputProps={{ className: classes.multilineFieldInput }} style={{ width: "80%" }} @@ -58,7 +77,7 @@ export const ListingForm = () => { variant="outlined" /> - +
); }; From 03ef4439ec056ab88e89e30e3650a6590e896d58 Mon Sep 17 00:00:00 2001 From: chip Date: Sun, 18 Oct 2020 21:49:25 +0200 Subject: [PATCH 07/21] Removed phone icon from nav bar --- phone/src/os/navigation-bar/components/Navigation.tsx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/phone/src/os/navigation-bar/components/Navigation.tsx b/phone/src/os/navigation-bar/components/Navigation.tsx index 8000d74..a15019a 100644 --- a/phone/src/os/navigation-bar/components/Navigation.tsx +++ b/phone/src/os/navigation-bar/components/Navigation.tsx @@ -32,11 +32,6 @@ export const Navigation = () => { className={classes.root} onChange={(_e, value) => value()} > - history.push("/phone")} - icon={} - /> history.push("/")} From c928d6a79ec33d997dc8e6441546253777df70de Mon Sep 17 00:00:00 2001 From: chip Date: Sun, 18 Oct 2020 21:49:56 +0200 Subject: [PATCH 08/21] New dropdown menu for each contact --- .../contacts/components/List/ContactList.tsx | 59 +++++++++++++++++-- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/phone/src/apps/contacts/components/List/ContactList.tsx b/phone/src/apps/contacts/components/List/ContactList.tsx index 43cc1e2..4e5ee36 100644 --- a/phone/src/apps/contacts/components/List/ContactList.tsx +++ b/phone/src/apps/contacts/components/List/ContactList.tsx @@ -3,7 +3,12 @@ import ListItemText from "@material-ui/core/ListItemText"; import { Button, ListItemAvatar, - Avatar as MuiAvatar + Avatar as MuiAvatar, + List, + ListItem, + TextField, + Collapse, + makeStyles } from "@material-ui/core"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; @@ -13,18 +18,41 @@ import { useFilteredContacts } from '../../hooks/useFilteredContacts'; import PhoneIcon from "@material-ui/icons/Phone"; import ChatIcon from "@material-ui/icons/Chat"; -import { List } from "../../../../ui/components/List"; -import { ListItem } from "../../../../ui/components/ListItem"; import { useContacts } from "../../hooks/useContacts"; +import { useContactModal } from '../../hooks/useContactModal'; import Nui from "../../../../os/nui-events/utils/Nui"; +import "../Contact.css" + +const useStyles = makeStyles((theme) => ({ + updateButton: { + margin: 'auto', + fontSize: 14, + width: 150, + background: "#2196f3", + marginBottom: 10, + padding: 8 + }, + collapseItem: { + margin: 'auto', + width: '50%' + } +})) + + export const ContactList = () => { + const classes = useStyles() + const { filteredContacts } = useFilteredContacts(); + const { showContactModal, setShowContactModal } = useContactModal(); const contacts = useContacts(); + const openContactInfo = () => { + setShowContactModal(!showContactModal); + } const startCall = (number) => { console.log(number); Nui.send("phone:startCall", { @@ -35,12 +63,13 @@ export const ContactList = () => { return ( {contacts.contacts.filter(contact => contact.display.includes(filteredContacts) || contact.number.includes(filteredContacts)).map((contact) => ( + <> {contact.avatar ? ( ): ( - {contact.display.slice(0, 1)} + {contact.display.slice(0, 1).toUpperCase()} )} @@ -54,10 +83,30 @@ export const ContactList = () => { > - + + + + + + + + + + + + + + ))} ); From bd9f48ee50bebe04a62b6565b15e735265175acf Mon Sep 17 00:00:00 2001 From: chip Date: Sun, 18 Oct 2020 21:50:24 +0200 Subject: [PATCH 09/21] Tweak(Contacts:Main): Minor changes --- phone/src/apps/contacts/components/ContactsApp.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phone/src/apps/contacts/components/ContactsApp.tsx b/phone/src/apps/contacts/components/ContactsApp.tsx index 5fc7cda..176e55b 100644 --- a/phone/src/apps/contacts/components/ContactsApp.tsx +++ b/phone/src/apps/contacts/components/ContactsApp.tsx @@ -9,8 +9,8 @@ import { AddContactModal } from "./ContactModal"; import { useModal } from '../hooks/useModal'; import { SearchContacts } from "./List/SearchContacts"; import PersonAddIcon from '@material-ui/icons/PersonAdd' - import Fab from '@material-ui/core/Fab'; +import { useContactModal } from '../hooks/useContactModal'; const useStyles = makeStyles((theme: Theme) => @@ -38,6 +38,7 @@ export const ContactsApp = () => { const classes = useStyles(); const { showModal, setShowModal } = useModal(); const contacts = useApp("CONTACTS"); + const { showContactModal } = useContactModal(); const openModal = () => { setShowModal(true); From 0f73edc6d08f824cbaa4b93bafbd852c9c3a8ea9 Mon Sep 17 00:00:00 2001 From: chip Date: Sun, 18 Oct 2020 21:50:50 +0200 Subject: [PATCH 10/21] Feat(Sellout:css): Css file for MUI stuff --- phone/src/apps/sellout/components/Sellout.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phone/src/apps/sellout/components/Sellout.css b/phone/src/apps/sellout/components/Sellout.css index 13183d3..8310949 100644 --- a/phone/src/apps/sellout/components/Sellout.css +++ b/phone/src/apps/sellout/components/Sellout.css @@ -1,3 +1,8 @@ #sellout-app .Mui-selected { color: #f44336 !important; } + + +#sellout-app .Mui-focused::after { + border-bottom: #f44336 solid 3px; +} \ No newline at end of file From 750c117ff9174d7ae8d290b9739405a6fc0bc7b0 Mon Sep 17 00:00:00 2001 From: chip Date: Sun, 18 Oct 2020 21:51:23 +0200 Subject: [PATCH 11/21] Tweak(useContacts): minor changes --- phone/src/apps/contacts/hooks/useContacts.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phone/src/apps/contacts/hooks/useContacts.ts b/phone/src/apps/contacts/hooks/useContacts.ts index 16f8117..b52fc7e 100644 --- a/phone/src/apps/contacts/hooks/useContacts.ts +++ b/phone/src/apps/contacts/hooks/useContacts.ts @@ -5,7 +5,7 @@ interface Contact { id: string; display: string; number: string; - img?: string + avatar?: string } interface IUseContacts { From 7ef4e112058149e84862da19330933f8b629d01a Mon Sep 17 00:00:00 2001 From: chip Date: Sun, 18 Oct 2020 21:51:54 +0200 Subject: [PATCH 12/21] Feat(Sellout:States): new states for sellout app --- phone/src/apps/contacts/hooks/state.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phone/src/apps/contacts/hooks/state.ts b/phone/src/apps/contacts/hooks/state.ts index 8b16291..8544929 100644 --- a/phone/src/apps/contacts/hooks/state.ts +++ b/phone/src/apps/contacts/hooks/state.ts @@ -12,5 +12,9 @@ export const contactsState = { filterContacts: atom({ key: 'filterContacts', default: "" + }), + showContactsModal: atom({ + key: 'showContactModal', + default: false }) }; From acf0c22a49f3af74f31cfd736c938424fec82b84 Mon Sep 17 00:00:00 2001 From: chip Date: Sun, 18 Oct 2020 21:52:27 +0200 Subject: [PATCH 13/21] Tweak(Phone): removed some emulate datas --- phone/src/Phone.tsx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/phone/src/Phone.tsx b/phone/src/Phone.tsx index d05b59f..2aa27b1 100644 --- a/phone/src/Phone.tsx +++ b/phone/src/Phone.tsx @@ -37,25 +37,25 @@ setTimeout(() => { window.dispatchEvent( new MessageEvent("message", { data: { - app: "BANK", + app: "CONTACTS", method: "setContacts", data: [ { id: 1, number: "345-4366", - display: "Gjelten", + display: "chip", avatar: 'https://i.imgur.com/Qpw6j8D.png' }, { id: 2, number: "456-4366", - display: "Loyd", + display: "shit", avatar: '' }, { id: 3, number: "123-4366", - display: "Fabian", + display: "rocky", avatar: 'https://i.imgur.com/B8ta5Aa.jpeg' }, ], @@ -85,24 +85,24 @@ setTimeout(() => { data: [ { id: 1, - name: "Donald Trump", + name: "Some guy", number: "123-4567", description: - "This is me just selling the whole country, because like why not dude", - img: "some shady link?", + "Selling this cool car", + url: "", }, { id: 2, - name: "Joe Biden", + name: "Some other dude", number: "666-6666", - description: "I think I might buy it Trump!", - img: "even shadier link?", + description: "Selling my wife", + url: "", }, ], }, }) ); -}); +}, 1000); function Phone() { useNuiService(); From 72c20f1742cae0a88dbb14038295a29486ef42a5 Mon Sep 17 00:00:00 2001 From: chip Date: Sun, 18 Oct 2020 21:53:38 +0200 Subject: [PATCH 14/21] Tweak(Contacts:Client): Lowerd wait for triggering event for fetching contacts --- resources/client/cl_contacts.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/client/cl_contacts.ts b/resources/client/cl_contacts.ts index 2ae7c15..ae0b53d 100644 --- a/resources/client/cl_contacts.ts +++ b/resources/client/cl_contacts.ts @@ -21,5 +21,6 @@ on(`__cfx_nui:${events.CONTACTS_ADD_CONTACT}`, (data: any) => { setTimeout(() => { emitNet(events.CONTACTS_GET_CONTACTS) - }, 1000) + }, 500) }); + From 68be13ed3936672a98f884e0eaa84838c5841879 Mon Sep 17 00:00:00 2001 From: chip Date: Sun, 18 Oct 2020 21:54:47 +0200 Subject: [PATCH 15/21] Feat(Main:Client): Fetching event when opening the phone --- resources/client/cl_main.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/client/cl_main.ts b/resources/client/cl_main.ts index 5f4d7f2..a638865 100644 --- a/resources/client/cl_main.ts +++ b/resources/client/cl_main.ts @@ -151,6 +151,7 @@ async function Phone() { isPhoneOpen = true await phoneOpenAnim() emitNet(events.CONTACTS_GET_CONTACTS); + emitNet(events.SELLOUT_FETCH_LISTING); emitNet('phone:getCredentials') // Gets the credentials. Will eventually most likely only get the phone number and name, idk. SetCursorLocation(0.936, 0.922) //Experimental let res = GetActiveScreenResolution() @@ -188,6 +189,7 @@ async function Phone() { isPhoneOpen = true await phoneOpenAnim() emitNet(events.CONTACTS_GET_CONTACTS); + emitNet(events.SELLOUT_FETCH_LISTING); emitNet('phone:getCredentials') SetCursorLocation(0.936, 0.922) //Experimental let res = GetActiveScreenResolution() From dcafb2700a8a7fc882e1304fd8f5a002c360204e Mon Sep 17 00:00:00 2001 From: chip Date: Sun, 18 Oct 2020 21:55:35 +0200 Subject: [PATCH 16/21] Feat(Imports): Added imports for sellout app --- resources/client/client.ts | 1 + resources/server/server.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/resources/client/client.ts b/resources/client/client.ts index 99b9e9b..cac1009 100644 --- a/resources/client/client.ts +++ b/resources/client/client.ts @@ -2,6 +2,7 @@ import { ESXClient } from "fivem-esx-js/client/esx_client"; import './cl_main'; import './cl_twitter'; import './cl_contacts'; +import './cl_sellout'; export let ESX: ESXClient = null; diff --git a/resources/server/server.ts b/resources/server/server.ts index f20558a..0c41938 100644 --- a/resources/server/server.ts +++ b/resources/server/server.ts @@ -4,6 +4,7 @@ import './db'; import './sv_twitter'; import './sv_main'; import './sv_contacts'; +import './sv_sellout'; export let ESX: ESXServer = null; From 9002646a857f5c918f99b4453c000beece509585 Mon Sep 17 00:00:00 2001 From: chip Date: Sun, 18 Oct 2020 21:56:24 +0200 Subject: [PATCH 17/21] Commented out a trigger evetbn --- resources/server/sv_contacts.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/server/sv_contacts.ts b/resources/server/sv_contacts.ts index 514ae8e..bb235c3 100644 --- a/resources/server/sv_contacts.ts +++ b/resources/server/sv_contacts.ts @@ -40,7 +40,7 @@ onNet(events.CONTACTS_ADD_CONTACT, (number: string, display: string, avatar: str const xPlayer = ESX.GetPlayerFromId(_source); const _identifier = xPlayer.getIdentifier() addContact(_identifier, number, display, avatar); - emit(events.CONTACTS_GET_CONTACTS); + //emit(events.CONTACTS_GET_CONTACTS); } catch(error) { console.log("Failed to add contact: ", error); From 4da31a35fb976635b49dfa1cb310bbd922fbb7b8 Mon Sep 17 00:00:00 2001 From: chip Date: Sun, 18 Oct 2020 21:56:44 +0200 Subject: [PATCH 18/21] Added events for selloutapp --- resources/utils/events.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/resources/utils/events.ts b/resources/utils/events.ts index ac53e6d..8762e1d 100644 --- a/resources/utils/events.ts +++ b/resources/utils/events.ts @@ -25,5 +25,10 @@ export default { CONTACTS_GET_CONTACTS: 'phone:getContacts', CONTACTS_ADD_CONTACT_NUI: 'contacts:add', CONTACTS_ADD_CONTACT: 'contacts:add', - CONTACTS_UPDATE_CONTACTS: 'phone:updateContacts' + CONTACTS_UPDATE_CONTACTS: 'phone:updateContacts', + + // Sellout + SELLOUT_ADD_LISTING: 'phone:addListing', + SELLOUT_FETCH_LISTING: 'phone:fetchAllListing', + SELLOUT_SEND_LISTING: 'phone:sendAllListings' } \ No newline at end of file From cf6c973708305ee6faae0a47a6b822864c72e8d8 Mon Sep 17 00:00:00 2001 From: chip Date: Sun, 18 Oct 2020 21:57:26 +0200 Subject: [PATCH 19/21] Feat(Sellout:Server): Server functionality --- resources/server/sv_sellout.ts | 51 ++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 resources/server/sv_sellout.ts diff --git a/resources/server/sv_sellout.ts b/resources/server/sv_sellout.ts new file mode 100644 index 0000000..bbf1667 --- /dev/null +++ b/resources/server/sv_sellout.ts @@ -0,0 +1,51 @@ +import events from '../utils/events'; +import { ESX, getSource } from './server'; +import { pool } from './db'; + + +interface IListing { + title: string; + name: string; + url: string; + description: string; +} + +async function addListing(identifier: string, name: string, title: string, url: string, description: string): Promise { + const query = "INSERT INTO npwd_sellout_listings (identifier, name, title, url, description) VALUES (?, ?, ?, ?, ?)" + console.log("hallllllollooooo"); + await pool.query(query, [identifier, name, title, url, description]) +} + +async function fetchAllListings(): Promise { + const query = "SELECT * FROM npwd_sellout_listings ORDER BY id DESC"; + + const [ results ] = await pool.query(query); + const listings = results; + + return listings; +} + +onNet(events.SELLOUT_ADD_LISTING, (data: any) => { + try { + const xPlayer = ESX.GetPlayerFromId(getSource()) + const _identifier = xPlayer.getIdentifier() + const name = xPlayer.getName() + console.log("ADDED") + + addListing(_identifier, name, data.title, data.url, data.desc) + } catch (error) { + console.log(error) + } +}) + +onNet(events.SELLOUT_FETCH_LISTING, async () => { + try { + console.log("Fetching all listings") + const listings = await fetchAllListings(); + console.log("ADDED") + emitNet(events.SELLOUT_SEND_LISTING, getSource(), listings) + + } catch(error) { + console.log(error) + } +}) \ No newline at end of file From 12c3646d7449c3a557f08cf5ea6425e87d9217b7 Mon Sep 17 00:00:00 2001 From: chip Date: Sun, 18 Oct 2020 21:57:46 +0200 Subject: [PATCH 20/21] Feat(Sellout:Client): Client functionality --- resources/client/cl_sellout.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 resources/client/cl_sellout.ts diff --git a/resources/client/cl_sellout.ts b/resources/client/cl_sellout.ts new file mode 100644 index 0000000..6a46c92 --- /dev/null +++ b/resources/client/cl_sellout.ts @@ -0,0 +1,21 @@ +import events from '../utils/events'; + +RegisterNuiCallbackType(events.SELLOUT_ADD_LISTING); +on(`__cfx_nui:${events.SELLOUT_ADD_LISTING}`, (data: any) => { + emitNet(events.SELLOUT_ADD_LISTING, data) + + setTimeout(() => { + emitNet(events.SELLOUT_FETCH_LISTING); + console.log("Fetched") + }, 500) +}) + +onNet(events.SELLOUT_SEND_LISTING, (listing: any) => { + SendNuiMessage( + JSON.stringify({ + app: "SELLOUT", + method: "setListings", + data: listing + }) + ) +}) \ No newline at end of file From f9dbcd1394299eddbf0f7e528a5939321c894770 Mon Sep 17 00:00:00 2001 From: chip Date: Sun, 18 Oct 2020 21:58:28 +0200 Subject: [PATCH 21/21] Feat(Functions:Server): File for adding useful server functions --- resources/server/functions.ts | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 resources/server/functions.ts diff --git a/resources/server/functions.ts b/resources/server/functions.ts new file mode 100644 index 0000000..c9f7c0a --- /dev/null +++ b/resources/server/functions.ts @@ -0,0 +1,9 @@ +import { pool } from './db'; +import { ESX, getSource } from './server'; + +export const usePhoneNumber = async (identifier: string) => { + const query = "SELECT phone_number FROM users WHERE identifier = ?" + const result = await pool.query(query, [identifier]); + + return result +} \ No newline at end of file