mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
Fix: prettier config in resources\ not being standard.
This commit is contained in:
1 parent
d56112a0cb
commit
ec1451a9aa
28 files changed
+349
-349
No files matched your search
@@ -1,30 +1,30 @@
|
||||
import events from "../utils/events";
|
||||
import { pool } from "./db";
|
||||
import { useIdentifier, getSource } from "./functions";
|
||||
import { Note, NoteId } from "../../phone/src/common/typings/notes";
|
||||
import events from '../utils/events';
|
||||
import { pool } from './db';
|
||||
import { useIdentifier, getSource } from './functions';
|
||||
import { Note, NoteId } from '../../phone/src/common/typings/notes';
|
||||
|
||||
async function addNote(identifier: string, note: Note): Promise<any> {
|
||||
const query =
|
||||
"INSERT INTO npwd_notes (identifier, title, content) VALUES (?, ?, ?)";
|
||||
'INSERT INTO npwd_notes (identifier, title, content) VALUES (?, ?, ?)';
|
||||
await pool.query(query, [identifier, note.title, note.content]);
|
||||
}
|
||||
|
||||
async function fetchAllNotes(identifier: string): Promise<Note[]> {
|
||||
const query =
|
||||
"SELECT * FROM npwd_notes WHERE identifier = ? ORDER BY id DESC";
|
||||
'SELECT * FROM npwd_notes WHERE identifier = ? ORDER BY id DESC';
|
||||
const [result] = await pool.query(query, [identifier]);
|
||||
const notes = <Note[]>result;
|
||||
return notes;
|
||||
}
|
||||
|
||||
async function deleteNote(noteId: number, identifier: string) {
|
||||
const query = "DELETE FROM npwd_notes WHERE id = ? AND identifier = ?";
|
||||
const query = 'DELETE FROM npwd_notes WHERE id = ? AND identifier = ?';
|
||||
await pool.query(query, [noteId, identifier]);
|
||||
}
|
||||
|
||||
async function updateNote(note: Note, identifier: string): Promise<any> {
|
||||
const query =
|
||||
"UPDATE npwd_notes SET title = ?, content = ? WHERE id = ? AND identifier = ?";
|
||||
'UPDATE npwd_notes SET title = ?, content = ? WHERE id = ? AND identifier = ?';
|
||||
await pool.query(query, [note.title, note.content, note.id, identifier]);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ onNet(events.NOTE_ADD_NOTE, async (note: Note) => {
|
||||
addNote(_identifier, note);
|
||||
emitNet(events.NOTE_SEND_NOTE_SUCCESS, getSource());
|
||||
} catch (error) {
|
||||
console.log("NOTES ERROR: ", error);
|
||||
console.log('NOTES ERROR: ', error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -45,7 +45,7 @@ onNet(events.NOTE_FETCH_ALL_NOTES, async () => {
|
||||
const notes = await fetchAllNotes(_identifier);
|
||||
emitNet(events.NOTE_SEND_NOTE, _source, notes);
|
||||
} catch (error) {
|
||||
console.log("NOTE ERROR: ", error);
|
||||
console.log('NOTE ERROR: ', error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -55,7 +55,7 @@ onNet(events.NOTE_DELETE_NOTE, async (noteId: NoteId) => {
|
||||
const id = noteId.id;
|
||||
await deleteNote(id, _identifier);
|
||||
} catch (error) {
|
||||
console.log("NOTE ERROR:", error);
|
||||
console.log('NOTE ERROR:', error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user