ActivityDay.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import { Mushaf } from '../QuranReader';
  2. export enum ActivityDayType {
  3. QURAN = 'QURAN',
  4. LESSON = 'LESSON',
  5. }
  6. export type ActivityDay<T> = {
  7. id: string;
  8. date: Date;
  9. progress: number;
  10. } & T;
  11. export type QuranActivityDay = {
  12. ranges: string[];
  13. pagesRead: number;
  14. versesRead: number;
  15. secondsRead: number;
  16. manuallyAddedSeconds?: number;
  17. dailyTargetPages?: number;
  18. dailyTargetSeconds?: number;
  19. dailyTargetRanges: string[];
  20. remainingDailyTargetRanges: string[];
  21. };
  22. type ActivityDayBody = {
  23. type: ActivityDayType;
  24. };
  25. export type UpdateQuranActivityDayBody = {
  26. ranges?: string[];
  27. pages?: number;
  28. date?: string;
  29. seconds?: number;
  30. mushafId: Mushaf;
  31. };
  32. export type UpdateLessonActivityDayBody = {
  33. lessonId: string;
  34. };
  35. export type UpdateActivityDayBody<T> = ActivityDayBody & T;
  36. export type UpdateActivityDayParams = UpdateActivityDayBody<
  37. UpdateQuranActivityDayBody | UpdateLessonActivityDayBody
  38. >;
  39. export type FilterActivityDaysParams = {
  40. from: string;
  41. to: string;
  42. limit?: number;
  43. cursor?: string;
  44. type: ActivityDayType;
  45. };
  46. export type CurrentQuranActivityDay = ActivityDay<QuranActivityDay> & { hasRead: boolean };