From 864a6c24024e926319212dd9527098e9b093a33a Mon Sep 17 00:00:00 2001 From: Christopher Date: Tue, 2 Mar 2021 19:56:41 +0100 Subject: [PATCH] feat(resources/marketplace): added typings server side --- resources/server/sv_sellout.ts | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/resources/server/sv_sellout.ts b/resources/server/sv_sellout.ts index 767ae9d..d0a42be 100644 --- a/resources/server/sv_sellout.ts +++ b/resources/server/sv_sellout.ts @@ -4,21 +4,16 @@ import { getSource } from './functions'; import { pool } from './db'; import { usePhoneNumber } from './functions'; import { mainLogger } from './sv_logger'; +import { MarketplaceListing } from '../../phone/src/common/typings/marketplace'; const selloutLogger = mainLogger.child({ module: 'sellout' }); -interface Listing { - title: string; - name: string; - url?: string; - description: string; -} -async function fetchAllListings(): Promise { +async function fetchAllListings(): Promise { const query = 'SELECT * FROM npwd_sellout_listings ORDER BY id DESC'; const [results] = await pool.query(query); - const listings = results; + const listings = results; return listings; } @@ -27,8 +22,8 @@ async function addListing( identifier: string, name: string, number: any, - listing: Listing -): Promise { + listing: MarketplaceListing +): Promise { const query = 'INSERT INTO npwd_sellout_listings (identifier, name, number, title, url, description) VALUES (?, ?, ?, ?, ?, ?)'; await pool.query(query, [ @@ -53,7 +48,7 @@ onNet(events.SELLOUT_FETCH_LISTING, async () => { } }); -onNet(events.SELLOUT_ADD_LISTING, async (listing: Listing) => { +onNet(events.SELLOUT_ADD_LISTING, async (listing: MarketplaceListing) => { const _source = getSource(); try { const xPlayer = ESX.GetPlayerFromId(_source);