mirror of
https://github.com/urosran/cally.git
synced 2025-07-15 09:45:20 +00:00
-Fixed create todo issues
This commit is contained in:
@ -3,6 +3,7 @@ import firestore from "@react-native-firebase/firestore";
|
|||||||
import { useAuthContext } from "@/contexts/AuthContext";
|
import { useAuthContext } from "@/contexts/AuthContext";
|
||||||
import { DAYS_OF_WEEK_ENUM, IToDo, REPEAT_TYPE } from "@/hooks/firebase/types/todoData";
|
import { DAYS_OF_WEEK_ENUM, IToDo, REPEAT_TYPE } from "@/hooks/firebase/types/todoData";
|
||||||
import { addMonths, addWeeks, addYears } from "date-fns";
|
import { addMonths, addWeeks, addYears } from "date-fns";
|
||||||
|
import assign from "@react-native-community/cli-config/build/assign";
|
||||||
|
|
||||||
export const daysOfWeek = [
|
export const daysOfWeek = [
|
||||||
DAYS_OF_WEEK_ENUM.MONDAY,
|
DAYS_OF_WEEK_ENUM.MONDAY,
|
||||||
@ -13,7 +14,7 @@ export const daysOfWeek = [
|
|||||||
DAYS_OF_WEEK_ENUM.SATURDAY,
|
DAYS_OF_WEEK_ENUM.SATURDAY,
|
||||||
DAYS_OF_WEEK_ENUM.SUNDAY];
|
DAYS_OF_WEEK_ENUM.SUNDAY];
|
||||||
|
|
||||||
const getNextDailyDates = (date) => {
|
export const getNextDailyDates = (date) => {
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
const dates = [];
|
const dates = [];
|
||||||
|
|
||||||
@ -27,7 +28,7 @@ const getNextDailyDates = (date) => {
|
|||||||
return dates;
|
return dates;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getNextWeeklyDates = (selectedDays, date) => {
|
export const getNextWeeklyDates = (selectedDays, date) => {
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
const currentDay = date.getDay();
|
const currentDay = date.getDay();
|
||||||
const dates = [];
|
const dates = [];
|
||||||
@ -45,7 +46,7 @@ const getNextWeeklyDates = (selectedDays, date) => {
|
|||||||
return dates;
|
return dates;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getNextMonthlyDates = (date) => {
|
export const getNextMonthlyDates = (date) => {
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
const dates = [];
|
const dates = [];
|
||||||
|
|
||||||
@ -59,7 +60,7 @@ const getNextMonthlyDates = (date) => {
|
|||||||
return dates;
|
return dates;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getNextYearlyDates = (date) => {
|
export const getNextYearlyDates = (date) => {
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
const dates = [];
|
const dates = [];
|
||||||
|
|
||||||
@ -102,7 +103,7 @@ export const useCreateTodo = () => {
|
|||||||
|
|
||||||
const todosRef = firestore().collection("Todos");
|
const todosRef = firestore().collection("Todos");
|
||||||
const ruleDocRef = todosRef.doc();
|
const ruleDocRef = todosRef.doc();
|
||||||
const ruleDoc = await todosRef.add(
|
await todosRef.add(
|
||||||
{...todoData,
|
{...todoData,
|
||||||
id: ruleDocRef.id,
|
id: ruleDocRef.id,
|
||||||
familyId: profileData?.familyId,
|
familyId: profileData?.familyId,
|
||||||
@ -126,7 +127,7 @@ export const useCreateTodo = () => {
|
|||||||
familyId: profileData?.familyId,
|
familyId: profileData?.familyId,
|
||||||
creatorId: currentUser?.uid,
|
creatorId: currentUser?.uid,
|
||||||
connectedTodoId: ruleDocRef.id,
|
connectedTodoId: ruleDocRef.id,
|
||||||
assignees: assignee ? [assignee] : null
|
assignees: assignee ? [assignee] : todoData.assignees
|
||||||
}
|
}
|
||||||
|
|
||||||
batch.set(newDocRef, nextTodo)
|
batch.set(newDocRef, nextTodo)
|
||||||
|
Reference in New Issue
Block a user