This commit is contained in:
Taso committed 2021-04-18 15:38:50 -04:00
1 parent 949ea4ba4b
commit e01fa0ab0a
16 files changed
+406 -231

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
import { config } from '../server';
import { pool } from '../db';
export class PlayerRepo {
async fetchIdentifierFromPhoneNumber(phoneNumber: string): Promise<string | null> {
const query = `SELECT ${config.database.identifierColumn} FROM ${config.database.playerTable} WHERE phone_number = ?`;
const [results] = await pool.query(query, [phoneNumber]);
// Get identifier from results
return (results as { identifier: string }[])[0].identifier || null;
}
}
export default new PlayerRepo();