mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
comment cleanup
This commit is contained in:
parent
a30da69063
commit
353c472984
1 changed files with 12 additions and 18 deletions
|
@ -61,8 +61,6 @@ import {
|
|||
} from '../../../types/typeSchemas'
|
||||
import { paths } from '../../../utils/files'
|
||||
|
||||
// TODO: remove FINALIZE-s and TOTEST-s
|
||||
|
||||
interface MergeResult {
|
||||
newData: Subject[]
|
||||
newSubjects: Subject[]
|
||||
|
@ -541,7 +539,7 @@ function setup(data: SubmoduleData): Submodule {
|
|||
}${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(
|
||||
`\tLast sync date: ${logger.C('blue')}${new Date(
|
||||
lastSync
|
||||
|
@ -561,7 +559,7 @@ function setup(data: SubmoduleData): Submodule {
|
|||
})
|
||||
|
||||
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 }>>(
|
||||
(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
|
||||
try {
|
||||
|
@ -736,7 +734,6 @@ function setup(data: SubmoduleData): Submodule {
|
|||
const { subjCount: oldSubjCount, questionCount: oldQuestionCount } =
|
||||
countOfQdbs(getQuestionDbs())
|
||||
const oldQuestionDbCount = getQuestionDbs().length
|
||||
// TOTEST: test if backup wrks
|
||||
backupData(getQuestionDbs())
|
||||
logger.Log('\tOld data backed up!')
|
||||
|
||||
|
@ -765,7 +762,6 @@ function setup(data: SubmoduleData): Submodule {
|
|||
getQuestionDbs(),
|
||||
mergeResults
|
||||
)
|
||||
// TOTEST: test muliple new question dbs from multiple sources
|
||||
// setting new index & path
|
||||
writeNewData(
|
||||
newQuestionDbs,
|
||||
|
@ -895,8 +891,7 @@ function setup(data: SubmoduleData): Submodule {
|
|||
// ---------------------------------------------------------------------------------------
|
||||
// APP SETUP
|
||||
// ---------------------------------------------------------------------------------------
|
||||
app.get('/p2pinfo', (req: Request, res: Response<RemotePeerInfo>) => {
|
||||
logger.LogReq(req)
|
||||
app.get('/p2pinfo', (_req: Request, res: Response<RemotePeerInfo>) => {
|
||||
res.json(getSelfInfo(true))
|
||||
})
|
||||
|
||||
|
@ -989,15 +984,14 @@ function setup(data: SubmoduleData): Submodule {
|
|||
|
||||
app.get('/syncp2pdata', (req: Request, res: Response) => {
|
||||
logger.LogReq(req)
|
||||
// FINALIZE: uncomment
|
||||
// const user = req.session.user
|
||||
// if (user.id !== 1) {
|
||||
// res.json({
|
||||
// status: 'error',
|
||||
// msg: 'only user 1 can call this EP',
|
||||
// })
|
||||
// return
|
||||
// }
|
||||
const user = req.session.user
|
||||
if (user.id !== 1) {
|
||||
res.json({
|
||||
status: 'error',
|
||||
msg: 'only user 1 can call this EP',
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// FIXME: /syncResult EP if this EP times out, but we still need the result
|
||||
if (syncInProgress) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue