refactor codebase and pothos structure

This commit is contained in:
2024-10-07 10:07:08 +07:00
parent 29ec9c5360
commit dfa6b35399
31 changed files with 997 additions and 664 deletions

View File

@@ -1,21 +0,0 @@
export type ScheduleDateJSON = {};
export type ScheduleDate = Date | ScheduleDateJSON;
/*
[id:startTimeStamp - endTimeStamp, id:startTimeStamp - endTimeStamp, ...]
*/
1728206200 - 1728206300
1728206400 - 1728206500
1728206600 - 1728206700
1728206800 - 1728206900
1728207000 - 1728207100
1728207200 - 1728207300
1728207400 - 1728207500
1728207600 - 1728207700

View File

@@ -2,7 +2,7 @@ function getOverlapRange(
startA: number,
endA: number,
startB: number,
endB: number
endB: number,
) {
const overlapStart = Math.max(startA, startB);
const overlapEnd = Math.min(endA, endB);
@@ -10,12 +10,7 @@ function getOverlapRange(
return overlapStart < overlapEnd ? { overlapStart, overlapEnd } : null;
}
function isOverlap(
startA: number,
endA: number,
startB: number,
endB: number
) {
function isOverlap(startA: number, endA: number, startB: number, endB: number) {
return getOverlapRange(startA, endA, startB, endB) !== null;
}
@@ -57,13 +52,13 @@ const endB = new Date('2024-10-06T13:00:00Z').getTime();
const overlapRange = getOverlapRange(startA, endA, startB, endB);
if (overlapRange) {
console.log(
`Overlap Start: ${new Date(overlapRange.overlapStart).toISOString()}`
`Overlap Start: ${new Date(overlapRange.overlapStart).toISOString()}`,
);
console.log(
`Overlap End: ${new Date(overlapRange.overlapEnd).toISOString()}`
`Overlap End: ${new Date(overlapRange.overlapEnd).toISOString()}`,
);
console.log('Is overlap: true');
} else {
console.log('No overlap');
}
}