-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [add] - messageReadIdからmessageReadTimeへ改名するファイル追加 * [add/change] - メッセ既読Idから時間へ変更 importも * [change] - interface更新 * [change] - 既読時間の書き込みファイルを更新 * [change] - Socketハンドラのメッセ既読Idを時間へ更新 * [add] - 履歴をメッセージの時間基準でも取れるように * [add] - _ * [add] - 履歴取得時の開始位置指定の判別に時間指定の探索を追加 * [change] - パッケージ情報の更新 * [change] - メッセージ既読時間格納Socketハンドラと関数の引数更新 * [add] - 既読時間設定時Date型として値を使えるかどうか検証するように * [fix] - メッセ位置計算部分にて条件にするSQL構文が間違っていた * [add] - 履歴取得Socketハンドラの引数更新 * [add] - 改行とログ
- Loading branch information
Showing
10 changed files
with
287 additions
and
162 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import sqlite3 from "sqlite3"; | ||
import type { IMessageReadTime } from "../../type/Message"; | ||
const db = new sqlite3.Database("./records/USER.db"); | ||
|
||
//メッセージの最終既読時間をJSONで取得 | ||
export default async function getMessageReadTime(userId:string) | ||
:Promise<IMessageReadTime|null> { | ||
try { | ||
|
||
return new Promise((resolve) => { | ||
db.all( | ||
` | ||
SELECT messageReadTime FROM USERS_SAVES | ||
WHERE userId='` + userId + `' | ||
`, | ||
(err:Error, messageReadTimeBeforeParsed:[{messageReadTime:string}]) => { | ||
if (err) { | ||
console.log("getMessageReadTime :: db : エラー->", err); | ||
resolve(null); | ||
return; | ||
} else { | ||
//console.log("getMessageReadTime :: db : data->", messageReadTimeBeforeParsed); | ||
//パースして返す | ||
const messageReadTime:IMessageReadTime = | ||
JSON.parse( | ||
messageReadTimeBeforeParsed[0]['messageReadTime'] | ||
); | ||
|
||
resolve(messageReadTime); | ||
return; | ||
} | ||
} | ||
); | ||
}); | ||
|
||
} catch(e) { | ||
|
||
console.log("getMessageReadTime :: エラー->", e); | ||
return null; | ||
|
||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.