Skip to content

Commit

Permalink
Task assigning from channel real time(yet to display tasks)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pudi-Sravan committed Jun 19, 2024
1 parent bc01ef5 commit 92c71c4
Show file tree
Hide file tree
Showing 8 changed files with 633 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/context api/context.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const AllconversProvider = ({ children }) => {
const [confirmdm, setConformdm] = useState(false);
const [channelchat, setChannelchat] = useState(false);
const [fetchchannelupdate, setFetchchannelupdate] = useState(false);
const [assigntask, setAssigntask] = useState(false);
// Fetch user data once on component mount
useEffect(() => {
const fetchUserData = async () => {
Expand Down Expand Up @@ -71,6 +72,8 @@ export const AllconversProvider = ({ children }) => {
setChannelchat,
fetchchannelupdate,
setFetchchannelupdate,
assigntask,
setAssigntask,
};

return (
Expand Down
78 changes: 78 additions & 0 deletions src/database.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,3 +282,81 @@ export async function updatechannel(id, channels) {
return false;
}
}
export async function insertchanneldolistid(id) {
try {
const { data, error } = await supabase
.from("Channel_todolist")
.insert([{ id: id }])
.select();
if (data) {
console.log("done insert for id of channel do list");
return true;
} else {
//insert new row with a new users uuid into channels_list where all dm contacts data be stored
console.log("insert id for channel do list", error);
return false;
}
} catch (error) {
console.log(error);
return false;
}
}
export async function insert_todoid(id) {
try {
const { data, error } = await supabase
.from("Todo_list")
.insert([{ id: id }])
.select();
if (data) {
console.log("done insert for id of to do list");
return true;
} else {
//insert new row with a new users uuid into tos_list where all dm contacts data be stored
console.log("insert id for to do list", error);
return false;
}
} catch (error) {
console.log(error);
return false;
}
}
export async function fetchusertodo(id) {
try {
const { data: usertodo, error } = await supabase
.from("Todo_list")
.select("todo_list")
.eq("id", id);
if (error) {
console.log("error fething user todo", error);
} else {
console.log("recieved user todo");
if (usertodo[0].todo_list == null) {
return [];
} else {
return usertodo[0].todo_list;
}
}
} catch (error) {
console.log(error);
}
}
export async function fetchchanneltodo(id) {
try {
const { data: channeltodo, error } = await supabase
.from("Channel_todolist")
.select("todo_list")
.eq("id", id);
if (error) {
console.log("error fething channel todo", error);
} else {
console.log("recieved channel todo");
if (channeltodo[0].todo_list == null) {
return [];
} else {
return channeltodo[0].todo_list;
}
}
} catch (error) {
console.log(error);
}
}
Loading

0 comments on commit 92c71c4

Please sign in to comment.