mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
tweak(bank/client:server): commented out update functionality, doing that shit later
This commit is contained in:
1 parent
1eabe28bfc
commit
b0df2fce0a
3 files changed
+53
-6
No files matched your search
@@ -30,3 +30,17 @@ on(`__cfx_nui:${events.NOTE_DELETE_NOTE}`, (data: any) => {
|
|||||||
emitNet(events.NOTE_FETCH_ALL_NOTES)
|
emitNet(events.NOTE_FETCH_ALL_NOTES)
|
||||||
}, 500);
|
}, 500);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// coming soon tm
|
||||||
|
|
||||||
|
/*RegisterNuiCallbackType(events.NOTE_UPDATE_NOTE);
|
||||||
|
on(`__cfx_nui:${events.NOTE_UPDATE_NOTE}`, (data: any) => {
|
||||||
|
const note = data;
|
||||||
|
emitNet(events.NOTE_UPDATE_NOTE, note)
|
||||||
|
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
emitNet(events.NOTE_FETCH_ALL_NOTES)
|
||||||
|
}, 500);
|
||||||
|
})*/
|
||||||
@@ -12,6 +12,12 @@ interface NoteId {
|
|||||||
id: number
|
id: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface UpdateNote {
|
||||||
|
id: number;
|
||||||
|
title: string;
|
||||||
|
content: string;
|
||||||
|
}
|
||||||
|
|
||||||
async function addNote(identifier: string, note: Note): Promise<any> {
|
async function addNote(identifier: string, note: Note): Promise<any> {
|
||||||
const query = "INSERT INTO npwd_notes (identifier, title, content) VALUES (?, ?, ?)"
|
const query = "INSERT INTO npwd_notes (identifier, title, content) VALUES (?, ?, ?)"
|
||||||
await pool.query(query,
|
await pool.query(query,
|
||||||
@@ -30,11 +36,21 @@ async function fetchAllNotes(identifier: string): Promise<Note[]> {
|
|||||||
return notes;
|
return notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteNote(noteId: number) {
|
async function deleteNote(noteId: number, identifier: string) {
|
||||||
const query = "DELETE FROM npwd_notes WHERE id = ?";
|
const query = "DELETE FROM npwd_notes WHERE id = ? AND identifier = ?";
|
||||||
await pool.query(query, [noteId])
|
await pool.query(query, [noteId, identifier])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*async function updateNote(note: UpdateNote, identifier: string): Promise<any> {
|
||||||
|
const query = "UPDATE npwd_notes SET title = ?, content = ? WHERE id = ? AND identifier = ?"
|
||||||
|
await pool.query(query, [
|
||||||
|
note.title,
|
||||||
|
note.content,
|
||||||
|
note.id,
|
||||||
|
identifier
|
||||||
|
])
|
||||||
|
}*/
|
||||||
|
|
||||||
onNet(events.NOTE_ADD_NOTE, async (note: Note) => {
|
onNet(events.NOTE_ADD_NOTE, async (note: Note) => {
|
||||||
try {
|
try {
|
||||||
console.log(note.content, note.title);
|
console.log(note.content, note.title);
|
||||||
@@ -59,6 +75,22 @@ onNet(events.NOTE_FETCH_ALL_NOTES, async () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
onNet(events.NOTE_DELETE_NOTE, async (noteId: NoteId) => {
|
onNet(events.NOTE_DELETE_NOTE, async (noteId: NoteId) => {
|
||||||
const id = noteId.id
|
try {
|
||||||
await deleteNote(id)
|
const _identifier = await useIdentifier();
|
||||||
|
const id = noteId.id
|
||||||
|
await deleteNote(id, _identifier)
|
||||||
|
} catch(error) {
|
||||||
|
console.log("NOTE ERROR:", error)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// coming soon tm
|
||||||
|
|
||||||
|
/*onNet(events.NOTE_UPDATE_NOTE, async (note: UpdateNote) => {
|
||||||
|
try {
|
||||||
|
const _identifier = await useIdentifier();
|
||||||
|
updateNote(note, _identifier)
|
||||||
|
} catch (error) {
|
||||||
|
console.log("NOTE ERROR:", error)
|
||||||
|
}
|
||||||
|
})*/
|
||||||
@@ -45,5 +45,6 @@ export default {
|
|||||||
NOTE_ADD_NOTE: 'phone:addNote',
|
NOTE_ADD_NOTE: 'phone:addNote',
|
||||||
NOTE_FETCH_ALL_NOTES: 'phone:fetchAllNotes',
|
NOTE_FETCH_ALL_NOTES: 'phone:fetchAllNotes',
|
||||||
NOTE_SEND_NOTE: 'phone:sendNote',
|
NOTE_SEND_NOTE: 'phone:sendNote',
|
||||||
NOTE_DELETE_NOTE: 'phone:deleteNote'
|
NOTE_DELETE_NOTE: 'phone:deleteNote',
|
||||||
|
NOTE_UPDATE_NOTE: 'phone:updateNote'
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user