typescript fixes & github action to build server
parent
6296d98911
commit
633630807d
|
@ -4,8 +4,13 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- '*'
|
- '*'
|
||||||
jobs:
|
jobs:
|
||||||
deploy-webapp:
|
build-webapp:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
- run: cd app && npm install && npm run build
|
- 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
|
|
@ -77,7 +77,7 @@ export class SQLiteAdapter extends Database {
|
||||||
|
|
||||||
public async getUser(email: string): Promise<any> {
|
public async getUser(email: string): Promise<any> {
|
||||||
return new Promise((resolve, reject) => {
|
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) {
|
if (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
console.log(`[database:sqlite] failed to get user ${email}`);
|
console.log(`[database:sqlite] failed to get user ${email}`);
|
||||||
|
@ -95,7 +95,7 @@ export class SQLiteAdapter extends Database {
|
||||||
|
|
||||||
public async getChats(userID: string): Promise<any[]> {
|
public async getChats(userID: string): Promise<any[]> {
|
||||||
return new Promise((resolve, reject) => {
|
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) {
|
if (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
console.log(`[database:sqlite] failed to get chats for user ${userID}`);
|
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<any[]> {
|
public async getMessages(userID: string): Promise<any[]> {
|
||||||
return new Promise((resolve, reject) => {
|
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) {
|
if (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
console.log(`[database:sqlite] failed to get messages for user ${userID}`);
|
console.log(`[database:sqlite] failed to get messages for user ${userID}`);
|
||||||
} else {
|
} else {
|
||||||
resolve(rows.map((row) => {
|
resolve(rows.map((row: any) => {
|
||||||
row.data = JSON.parse(row.data);
|
row.data = JSON.parse(row.data);
|
||||||
return row;
|
return row;
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -22,7 +22,7 @@ export default class SQLiteObjectStore extends ObjectStore {
|
||||||
|
|
||||||
public async get(key: string): Promise<string | null> {
|
public async get(key: string): Promise<string | null> {
|
||||||
return new Promise((resolve, reject) => {
|
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) {
|
if (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
} else {
|
} else {
|
||||||
|
@ -35,7 +35,7 @@ export default class SQLiteObjectStore extends ObjectStore {
|
||||||
|
|
||||||
public async put(key: string, value: string, contentType: string): Promise<void> {
|
public async put(key: string, value: string, contentType: string): Promise<void> {
|
||||||
return new Promise((resolve, reject) => {
|
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) {
|
if (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue