Skip to content

Commit

Permalink
fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
jho44 committed Feb 18, 2024
1 parent bb0a1fb commit 633f3ca
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/lib/logics/Calendar/Wrapper/logic.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import generateSchedRows from '$lib/logics/_shared/generateSchedRows';
import type { AvailabilityDates } from '$lib/logics/_shared/types';
import generateSchedRows from '$lib/server/_shared/generateSchedRows';
import { writeReq } from '$lib/logics/_shared/utils';

export const initVals = (dbVals: { dbDates: AvailabilityDates; timeZone: string }) => {
Expand Down
2 changes: 2 additions & 0 deletions src/lib/logics/_shared/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,5 @@ export const EMOTICONS_REVERSE: { [key: string]: string } = {

export const LEGEND_STR =
'Legend: 🏠(host) 🚗(visit) 👤(dropoff) 👥(together) 🏫(via school) ⭐(good) 🌟(great) 🙏(needed)\n';

export const NUM_DAYS_IN_SCHED = 21;
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { getEnglishDayAndMonthDay, startOfToday } from '$lib/logics/_shared/date';
import { UNAVAILABLE } from '$lib/logics/Calendar/_shared/constants';
import { extractAvailRange } from '$lib/logics/Calendar/_shared/utils';
import type { AvailabilityDates } from '$lib/logics/_shared/types';
import { getEnglishDayAndMonthDay, startOfToday } from '$lib/logics/_shared/date';
import { destructRange } from '$lib/logics/_shared/parse';
import type { Row } from '$lib/logics/_shared/types';
import type { AvailabilityDates, Row } from '$lib/logics/_shared/types';
import { AvailabilityStatus, type AvailabilityDate } from '@prisma/client';
import { DateTime } from 'luxon';
import AvailabilityDateRepository from '../repository/AvailabilityDate';
import { NUM_DAYS_IN_SCHED } from './constants';

export function convertAvailabilityDateToRow({
Expand Down Expand Up @@ -69,17 +67,6 @@ export function putDbDatesInDict(dbDates: AvailabilityDate[], timeZone: string)
return res;
}

export async function getDbDates(householdId: number, timeZone: string) {
const now = startOfToday(timeZone);

return await AvailabilityDateRepository.findAll({
householdId,
date: {
gte: now.toJSDate()
}
});
}

/*
generate rows for next NUM_DAYS_IN_SCHED days
*/
Expand Down
1 change: 0 additions & 1 deletion src/lib/server/_shared/constants.ts

This file was deleted.

13 changes: 13 additions & 0 deletions src/lib/server/_shared/getDbDates.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { startOfToday } from '$lib/logics/_shared/date';
import AvailabilityDateRepository from '../repository/AvailabilityDate';

export async function getDbDates(householdId: number, timeZone: string) {
const now = startOfToday(timeZone);

return await AvailabilityDateRepository.findAll({
householdId,
date: {
gte: now.toJSDate()
}
});
}
3 changes: 2 additions & 1 deletion src/lib/server/dbRoutes/acceptFriendReq.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { generateFullSchedule } from '$lib/logics/_shared/format';
import generateSchedRows, { putDbDatesInDict } from '$lib/logics/_shared/generateSchedRows';
import type { User } from '@prisma/client';
import { error } from '@sveltejs/kit';
import generateSchedRows, { getDbDates, putDbDatesInDict } from '../_shared/generateSchedRows';
import { getDbDates } from '../_shared/getDbDates';
import FriendRequestRepository from '../repository/FriendRequest';
import HouseholdRepository from '../repository/Household';
import HouseholdConnectionRepository from '../repository/HouseholdConnection';
Expand Down
5 changes: 3 additions & 2 deletions src/lib/server/loaders/calendar.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { getDbDates, putDbDatesInDict } from '$lib/server/_shared/generateSchedRows';
import type { HouseholdWithExtraInfo } from '$lib/logics/Calendar/_shared/types';
import { putDbDatesInDict } from '$lib/logics/_shared/generateSchedRows';
import { getDbDates } from '$lib/server/_shared/getDbDates';
import HouseholdChildRepository from '$lib/server/repository/HouseholdChild';
import HouseholdConnectionRepository from '$lib/server/repository/HouseholdConnection';
import type { HouseholdWithExtraInfo } from '$lib/logics/Calendar/_shared/types';

export const getDatesDict = async (householdId: number | null, timeZone: string) => {
if (!householdId) return {};
Expand Down
2 changes: 1 addition & 1 deletion src/lib/server/loaders/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type {
} from '$lib/logics/Dashboard/_shared/types';
import { EMOTICONS_REVERSE } from '$lib/logics/_shared/constants';
import { startOfToday } from '$lib/logics/_shared/date';
import generateSchedRows, { putDbDatesInDict } from '$lib/server/_shared/generateSchedRows';
import generateSchedRows, { putDbDatesInDict } from '$lib/logics/_shared/generateSchedRows';
import HouseholdConnectionRepository from '$lib/server/repository/HouseholdConnection';
import { AvailabilityStatus } from '@prisma/client';

Expand Down
2 changes: 1 addition & 1 deletion src/routes/circle/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import NavBar from '$lib/components/NavBar.svelte';
import Modal from '$lib/components/Modal.svelte';
import PhoneInput from '$lib/components/PhoneInput.svelte';
import { circleInviteMsg } from '$lib/format';
import { circleInviteMsg } from '$lib/logics/_shared/format';
let phoneInput: object;
let inviteesPhone: string;
Expand Down
4 changes: 2 additions & 2 deletions src/routes/dashboard/+page.server.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { CircleMember } from '$lib/logics/Dashboard/_shared/types';
import generateSchedRows, {
getDbDates,
putDbDatesInDict
} from '$lib/server/_shared/generateSchedRows';
} from '$lib/logics/_shared/generateSchedRows';
import { getDbDates } from '$lib/server/_shared/getDbDates';
import {
getCircleMembers,
getOverlaps,
Expand Down

0 comments on commit 633f3ca

Please sign in to comment.