comment cleanup

This commit is contained in:
mrfry 2023-04-02 08:36:26 +02:00
parent a30da69063
commit 353c472984

View file

@ -61,8 +61,6 @@ import {
} from '../../../types/typeSchemas' } from '../../../types/typeSchemas'
import { paths } from '../../../utils/files' import { paths } from '../../../utils/files'
// TODO: remove FINALIZE-s and TOTEST-s
interface MergeResult { interface MergeResult {
newData: Subject[] newData: Subject[]
newSubjects: Subject[] newSubjects: Subject[]
@ -541,7 +539,7 @@ function setup(data: SubmoduleData): Submodule {
}${logger.C()} peers` }${logger.C()} peers`
) )
const lastSync = new Date('2012-03-12').getTime() // FINALIZE date: this is only for testing // selfInfo.lastSync const lastSync = selfInfo.lastSync
logger.Log( logger.Log(
`\tLast sync date: ${logger.C('blue')}${new Date( `\tLast sync date: ${logger.C('blue')}${new Date(
lastSync lastSync
@ -561,7 +559,7 @@ function setup(data: SubmoduleData): Submodule {
}) })
const requests = peers.map((peer) => { const requests = peers.map((peer) => {
const lastSyncWithPeer = new Date('2012-03-12').getTime() // FINALIZE same as above // peer.lastSync || 0 const lastSyncWithPeer = peer.lastSync || 0
return new Promise<RequestResult<SyncDataRes & { peer: PeerInfo }>>( return new Promise<RequestResult<SyncDataRes & { peer: PeerInfo }>>(
(resolve) => { (resolve) => {
@ -680,7 +678,7 @@ function setup(data: SubmoduleData): Submodule {
} = {} } = {}
// ------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------
// new users handlin TOTEST: test // new users handlin
// ------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------
const oldUserCount = dbtools.SelectAll(userDB, 'users').length const oldUserCount = dbtools.SelectAll(userDB, 'users').length
try { try {
@ -736,7 +734,6 @@ function setup(data: SubmoduleData): Submodule {
const { subjCount: oldSubjCount, questionCount: oldQuestionCount } = const { subjCount: oldSubjCount, questionCount: oldQuestionCount } =
countOfQdbs(getQuestionDbs()) countOfQdbs(getQuestionDbs())
const oldQuestionDbCount = getQuestionDbs().length const oldQuestionDbCount = getQuestionDbs().length
// TOTEST: test if backup wrks
backupData(getQuestionDbs()) backupData(getQuestionDbs())
logger.Log('\tOld data backed up!') logger.Log('\tOld data backed up!')
@ -765,7 +762,6 @@ function setup(data: SubmoduleData): Submodule {
getQuestionDbs(), getQuestionDbs(),
mergeResults mergeResults
) )
// TOTEST: test muliple new question dbs from multiple sources
// setting new index & path // setting new index & path
writeNewData( writeNewData(
newQuestionDbs, newQuestionDbs,
@ -895,8 +891,7 @@ function setup(data: SubmoduleData): Submodule {
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
// APP SETUP // APP SETUP
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
app.get('/p2pinfo', (req: Request, res: Response<RemotePeerInfo>) => { app.get('/p2pinfo', (_req: Request, res: Response<RemotePeerInfo>) => {
logger.LogReq(req)
res.json(getSelfInfo(true)) res.json(getSelfInfo(true))
}) })
@ -989,15 +984,14 @@ function setup(data: SubmoduleData): Submodule {
app.get('/syncp2pdata', (req: Request, res: Response) => { app.get('/syncp2pdata', (req: Request, res: Response) => {
logger.LogReq(req) logger.LogReq(req)
// FINALIZE: uncomment const user = req.session.user
// const user = req.session.user if (user.id !== 1) {
// if (user.id !== 1) { res.json({
// res.json({ status: 'error',
// status: 'error', msg: 'only user 1 can call this EP',
// msg: 'only user 1 can call this EP', })
// }) return
// return }
// }
// FIXME: /syncResult EP if this EP times out, but we still need the result // FIXME: /syncResult EP if this EP times out, but we still need the result
if (syncInProgress) { if (syncInProgress) {