diff --git a/apps/game/server/contacts/contacts.database.ts b/apps/game/server/contacts/contacts.database.ts index 092572d0b..e45e4b6a0 100644 --- a/apps/game/server/contacts/contacts.database.ts +++ b/apps/game/server/contacts/contacts.database.ts @@ -1,12 +1,19 @@ import { Contact, PreDBContact } from '@typings/contact'; import { ResultSetHeader } from 'mysql2'; import { DbInterface } from '@npwd/database'; +import { config } from '@npwd/config/server'; export class _ContactsDB { + private readonly defaultContacts: Contact[] = config.defaultContacts.map((contact) => ({ + id: `${contact.display}:${contact.number}`, + ...contact, + })); + async fetchAllContacts(identifier: string): Promise { const query = 'SELECT * FROM npwd_phone_contacts WHERE identifier = ? ORDER BY display ASC'; const [results] = await DbInterface._rawExec(query, [identifier]); - return results; + + return this.defaultContacts.concat(results); } async addContact( diff --git a/typings/config.ts b/typings/config.ts index 16383eb4c..5ccf8e3ff 100644 --- a/typings/config.ts +++ b/typings/config.ts @@ -109,7 +109,6 @@ interface VoiceMessageConfig { } export interface DefaultContact { - id: number; display: string; number: string; avatar?: string; diff --git a/typings/contact.ts b/typings/contact.ts index 5102dc5ff..c03987d7c 100644 --- a/typings/contact.ts +++ b/typings/contact.ts @@ -13,7 +13,7 @@ export interface PreDBContact { } export interface Contact extends PreDBContact { - id: number; + id: number | string; } export interface ContactPay {