forked from ttc/micro-service-api
-socket
This commit is contained in:
32
exthernal-ttc-api/src/services/socketService.js
Normal file
32
exthernal-ttc-api/src/services/socketService.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import { GeneralService } from '../share/generalservice.js'
|
||||
import { getDTM } from '../utils/date.js'
|
||||
|
||||
export class SocketService {
|
||||
|
||||
constructor() {
|
||||
this.generalService = new GeneralService()
|
||||
}
|
||||
|
||||
getCurrentDTM() {
|
||||
return getDTM()
|
||||
}
|
||||
|
||||
// ตัวอย่างฟังก์ชันบันทึก Notification
|
||||
async saveNotificationLog(database, fromUserSeq, toUserSeq, title, msg) {
|
||||
// สมมติว่ามีตาราง comhtr
|
||||
// ตรวจสอบก่อนว่ามีตารางไหม หรือข้ามไปถ้ายังไม่ได้สร้าง
|
||||
/*
|
||||
const sql = `
|
||||
INSERT INTO ${database}.comhtr
|
||||
(from_seq, to_seq, title, message, created_dtm)
|
||||
VALUES ($1, $2, $3, $4, $5)
|
||||
`
|
||||
const params = [fromUserSeq, toUserSeq, title, msg, getDTM()]
|
||||
await this.generalService.executeQueryParam(database, sql, params)
|
||||
*/
|
||||
|
||||
// Demo: แค่ Log ไว้ก่อน
|
||||
this.generalService.devhint(2, 'SocketService', `Saving Log DB: [${database}] From ${fromUserSeq} to ${toUserSeq}`)
|
||||
return true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user