From 633630807d74b0f21271fce83012b7b0ebf7b67b Mon Sep 17 00:00:00 2001 From: Cogent Apps Date: Tue, 14 Mar 2023 20:25:54 +0000 Subject: [PATCH] typescript fixes & github action to build server --- .github/workflows/build.yml | 9 +++++++-- server/src/database/sqlite.ts | 8 ++++---- server/src/object-store/sqlite.ts | 4 ++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7583e7a..f80f30d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,8 +4,13 @@ on: branches: - '*' jobs: - deploy-webapp: + build-webapp: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - - run: cd app && npm install && npm run build \ No newline at end of file + - run: cd app && npm install && npm run build + build-server: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - run: cd server && npm install && npx -y tsc \ No newline at end of file diff --git a/server/src/database/sqlite.ts b/server/src/database/sqlite.ts index 5852d62..ec57d52 100644 --- a/server/src/database/sqlite.ts +++ b/server/src/database/sqlite.ts @@ -77,7 +77,7 @@ export class SQLiteAdapter extends Database { public async getUser(email: string): Promise { return new Promise((resolve, reject) => { - db.get(`SELECT * FROM authentication WHERE email = ?`, [email], (err, row) => { + db.get(`SELECT * FROM authentication WHERE email = ?`, [email], (err: any, row: any) => { if (err) { reject(err); console.log(`[database:sqlite] failed to get user ${email}`); @@ -95,7 +95,7 @@ export class SQLiteAdapter extends Database { public async getChats(userID: string): Promise { return new Promise((resolve, reject) => { - db.all(`SELECT * FROM chats WHERE user_id = ?`, [userID], (err, rows) => { + db.all(`SELECT * FROM chats WHERE user_id = ?`, [userID], (err: any, rows: any) => { if (err) { reject(err); console.log(`[database:sqlite] failed to get chats for user ${userID}`); @@ -109,12 +109,12 @@ export class SQLiteAdapter extends Database { public async getMessages(userID: string): Promise { return new Promise((resolve, reject) => { - db.all(`SELECT * FROM messages WHERE user_id = ?`, [userID], (err, rows) => { + db.all(`SELECT * FROM messages WHERE user_id = ?`, [userID], (err: any, rows: any) => { if (err) { reject(err); console.log(`[database:sqlite] failed to get messages for user ${userID}`); } else { - resolve(rows.map((row) => { + resolve(rows.map((row: any) => { row.data = JSON.parse(row.data); return row; })); diff --git a/server/src/object-store/sqlite.ts b/server/src/object-store/sqlite.ts index a81df58..04b30b0 100644 --- a/server/src/object-store/sqlite.ts +++ b/server/src/object-store/sqlite.ts @@ -22,7 +22,7 @@ export default class SQLiteObjectStore extends ObjectStore { public async get(key: string): Promise { return new Promise((resolve, reject) => { - db.get(`SELECT * FROM objects WHERE key = ?`, [key], (err, row) => { + db.get(`SELECT * FROM objects WHERE key = ?`, [key], (err: any, row: any) => { if (err) { reject(err); } else { @@ -35,7 +35,7 @@ export default class SQLiteObjectStore extends ObjectStore { public async put(key: string, value: string, contentType: string): Promise { return new Promise((resolve, reject) => { - db.run(`INSERT OR REPLACE INTO objects (key, value) VALUES (?, ?)`, [key, value], (err) => { + db.run(`INSERT OR REPLACE INTO objects (key, value) VALUES (?, ?)`, [key, value], (err: any) => { if (err) { reject(err); } else {