mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
feat(resources/server): move some functions to 'misc'
This commit is contained in:
1 parent
4029e8c7a1
commit
b033eae51e
7 files changed
+65
-21
No files matched your search
@@ -0,0 +1,50 @@
|
|||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { useSnackbar } from '../../../ui/hooks/useSnackbar';
|
||||||
|
import { photoState } from './state';
|
||||||
|
import { useCallback, useState } from 'react';
|
||||||
|
import { useNuiCallback } from 'fivem-nui-react-lib';
|
||||||
|
import { GalleryPhoto, PhotoEvents } from '../../../../../typings/photo';
|
||||||
|
import { usePhotoService } from './usePhotoService';
|
||||||
|
|
||||||
|
/*
|
||||||
|
export const usePhotoActions = () => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const { addAlert } = useSnackbar();
|
||||||
|
|
||||||
|
const [photos, setPhotos] = usePhotoService();
|
||||||
|
const [isUploading, setUploading] = useState(false);
|
||||||
|
|
||||||
|
const onPhotoSuccess = useCallback((photo) => {
|
||||||
|
setUploading(false);
|
||||||
|
if (!photo?.image) return;
|
||||||
|
setPhotos((curr) => [photo, ...curr]);
|
||||||
|
}, [setPhotos])
|
||||||
|
|
||||||
|
const onPhotoError = useCallback(
|
||||||
|
(i18nKey) => {
|
||||||
|
setUploading(false);
|
||||||
|
addAlert({ type: 'error', message: t(i18nKey) });
|
||||||
|
},
|
||||||
|
[addAlert, t],
|
||||||
|
);
|
||||||
|
|
||||||
|
const [_takePhoto] = useNuiCallback<void, GalleryPhoto>(
|
||||||
|
'CAMERA',
|
||||||
|
PhotoEvents.TAKE_PHOTO,
|
||||||
|
onPhotoSuccess,
|
||||||
|
onPhotoError,
|
||||||
|
);
|
||||||
|
|
||||||
|
const takePhoto = () => {
|
||||||
|
_takePhoto(undefined, { timeout: 60000 });
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
return {
|
||||||
|
photos,
|
||||||
|
setPhotos,
|
||||||
|
takePhoto,
|
||||||
|
isLoading: isUploading
|
||||||
|
}
|
||||||
|
|
||||||
|
}*/
|
||||||
+3
-9
@@ -1,11 +1,7 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"lib": [
|
"lib": ["dom", "dom.iterable", "esnext"],
|
||||||
"dom",
|
|
||||||
"dom.iterable",
|
|
||||||
"esnext"
|
|
||||||
],
|
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
@@ -18,12 +14,10 @@
|
|||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"jsx": "react",
|
"jsx": "react-jsx",
|
||||||
"strictNullChecks": false,
|
"strictNullChecks": false,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"noFallthroughCasesInSwitch": true
|
"noFallthroughCasesInSwitch": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["src"]
|
||||||
"src"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
MarketplaceReportDTO,
|
MarketplaceReportDTO,
|
||||||
} from '../../../typings/marketplace';
|
} from '../../../typings/marketplace';
|
||||||
import { notesLogger } from '../notes/notes.utils';
|
import { notesLogger } from '../notes/notes.utils';
|
||||||
import { reportListingToDiscord } from '../discord';
|
import { reportListingToDiscord } from '../misc/discord';
|
||||||
import { PromiseEventResp, PromiseRequest } from '../utils/PromiseNetEvents/promise.types';
|
import { PromiseEventResp, PromiseRequest } from '../utils/PromiseNetEvents/promise.types';
|
||||||
|
|
||||||
class _MarketplaceService {
|
class _MarketplaceService {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import axios, { AxiosResponse } from 'axios';
|
import axios, { AxiosResponse } from 'axios';
|
||||||
|
|
||||||
import { Tweet, Profile } from '../../typings/twitter';
|
import { Tweet, Profile } from '../../../typings/twitter';
|
||||||
import { IMAGE_DELIMITER } from '../../phone/src/apps/twitter/utils/images';
|
import { IMAGE_DELIMITER } from '../../../phone/src/apps/twitter/utils/images';
|
||||||
import { mainLogger } from './sv_logger';
|
import { mainLogger } from '../sv_logger';
|
||||||
import { MarketplaceListing } from '../../typings/marketplace';
|
import { MarketplaceListing } from '../../../typings/marketplace';
|
||||||
|
|
||||||
const discordLogger = mainLogger.child({ module: 'discord' });
|
const discordLogger = mainLogger.child({ module: 'discord' });
|
||||||
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import { pool } from './db';
|
import { pool } from '../db';
|
||||||
import { config } from './server';
|
import { config } from '../server';
|
||||||
import { mainLogger } from './sv_logger';
|
import { mainLogger } from '../sv_logger';
|
||||||
import { getRandomPhoneNumber } from './utils/getRandomPhoneNumber';
|
import { getRandomPhoneNumber } from '../utils/getRandomPhoneNumber';
|
||||||
import PlayerService from './players/player.service';
|
import PlayerService from '../players/player.service';
|
||||||
|
|
||||||
export async function generatePhoneNumber(identifier: string): Promise<string> {
|
export async function generatePhoneNumber(identifier: string): Promise<string> {
|
||||||
const getQuery = `SELECT phone_number FROM ${config.database.playerTable} WHERE ${config.database.identifierColumn} = ?`;
|
const getQuery = `SELECT phone_number FROM ${config.database.playerTable} WHERE ${config.database.identifierColumn} = ?`;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { generatePhoneNumber } from '../functions';
|
import { generatePhoneNumber } from '../misc/functions';
|
||||||
import { PhoneEvents } from '../../../typings/phone';
|
import { PhoneEvents } from '../../../typings/phone';
|
||||||
import { Player } from './player.class';
|
import { Player } from './player.class';
|
||||||
import { PlayerAddData } from './player.interfaces';
|
import { PlayerAddData } from './player.interfaces';
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import PlayerService from '../players/player.service';
|
|||||||
import TwitterDB, { _TwitterDB } from './twitter.db';
|
import TwitterDB, { _TwitterDB } from './twitter.db';
|
||||||
import { NewTweet, Profile, Tweet, TwitterEvents } from '../../../typings/twitter';
|
import { NewTweet, Profile, Tweet, TwitterEvents } from '../../../typings/twitter';
|
||||||
import { twitterLogger } from './twitter.utils';
|
import { twitterLogger } from './twitter.utils';
|
||||||
import { reportTweetToDiscord } from '../discord';
|
import { reportTweetToDiscord } from '../misc/discord';
|
||||||
|
|
||||||
class _TwitterService {
|
class _TwitterService {
|
||||||
private readonly twitterDB: _TwitterDB;
|
private readonly twitterDB: _TwitterDB;
|
||||||
|
|||||||
Reference in new issue
Block a user