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