Skip to content

Commit

Permalink
feat(server/invoices): delete invoice export
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeWasTakenn committed Aug 30, 2024
1 parent 80e789a commit d32324c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lib/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import type {
SetAccountAccess,
PayAccountInvoice,
CreateAccountInvoice,
DeleteAccountInvoice,
} from 'server/accounts';
import type { OxPlayer } from 'server/player/class';
import type { GetCharIdFromStateId } from 'server/player/db';
Expand Down Expand Up @@ -48,6 +49,7 @@ interface OxServer extends OxCommon {
RemoveGroupPermission: typeof RemoveGroupPermission;
PayAccountInvoice: typeof PayAccountInvoice;
CreateAccoutnInvoice: typeof CreateAccountInvoice;
DeleteAccountInvoice: typeof DeleteAccountInvoice;
}

export const Ox = OxCore as OxServer;
Expand Down
4 changes: 4 additions & 0 deletions server/accounts/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,3 +327,7 @@ export async function CreateInvoice(invoice: Omit<OxAccountInvoice, 'id'>) {
[invoice.creatorId, invoice.fromId, invoice.toId, invoice.amount, invoice.message]
);
}

export async function DeleteInvoice(invoiceId: number) {
return db.update('DELETE FROM `accounts_invoices` WHERE `id` = ?', [invoiceId]);
}
9 changes: 6 additions & 3 deletions server/accounts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
WithdrawMoney,
UpdateInvoice,
CreateInvoice,
DeleteInvoice,
} from './db';
import { GetCharIdFromStateId } from 'player/db';

Expand Down Expand Up @@ -117,15 +118,17 @@ export async function RemoveAccountAccess(accountId: number, id: number | string
return charId && UpdateAccountAccess(accountId, charId);
}

export async function PayAccountInvoice(invoiceId: number, charId: number) {
export function PayAccountInvoice(invoiceId: number, charId: number) {
return UpdateInvoice(invoiceId, charId);
}

export async function CreateAccountInvoice(invoice: Omit<OxAccountInvoice, 'id'>) {
export function CreateAccountInvoice(invoice: Omit<OxAccountInvoice, 'id'>) {
return CreateInvoice(invoice);
}

export async function DeleteAccountInvoice(invoiceId: number) {}
export function DeleteAccountInvoice(invoiceId: number) {
return DeleteInvoice(invoiceId);
}

exports('GetAccountById', GetAccountById);
exports('GetCharacterAccount', GetCharacterAccount);
Expand Down

0 comments on commit d32324c

Please sign in to comment.