Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 02bd9fb

Browse files
committed
Allow to add deadline while creating the goal
1 parent 715d0b8 commit 02bd9fb

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

src/adapters/fauna/clear-db.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const client = new faunadb.Client({
99
})
1010

1111
async function main() {
12-
client.query(
12+
await client.query(
1313
q.Do(
1414
q.Map(q.Paginate(q.Documents(q.Collection('users'))), (userRef) =>
1515
q.Delete(userRef)
@@ -49,6 +49,7 @@ async function main() {
4949
)
5050
)
5151
)
52+
console.log('THE END')
5253
}
5354

5455
main().catch((e) => console.error(e))

src/components/goals/NewGoal.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { useForm } from 'react-hook-form'
33
import { useMutation, useQueryClient } from 'react-query'
44
import toast, { Toaster } from 'react-hot-toast'
55
import { useRef, useState } from 'react'
6-
import { useSession } from 'next-auth/client'
76
import { Markdown } from '@/components'
87

98
type Inputs = {

src/components/modal/Modal.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Transition } from '@headlessui/react'
2-
import { UserPlus } from 'phosphor-react'
32
import { User } from 'src/pages/members'
43
import { signIn } from 'next-auth/client'
54
import type { TablerIcon } from 'tabler-icons'

src/pages/[username]/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Goal, NewGoal, Profile, Title } from '@/components'
1+
import { Goal, Profile, Title } from '@/components'
22
import { PaddedLayout } from 'src/layouts'
33
import faunadb from 'faunadb'
44
import { InferGetServerSidePropsType } from 'next'

src/pages/api/fauna/goals/create-and-participate-in-a-goal.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const FaunaCreateHandler: NextApiHandler = async (
2323
}
2424

2525
try {
26-
const { title, description } = req.body
26+
const { title, description, deadline } = req.body
2727
const userId = (session.user as User).id
2828
const response = await client.query(
2929
q.Let(
@@ -33,6 +33,7 @@ const FaunaCreateHandler: NextApiHandler = async (
3333
createdBy: q.Ref(q.Collection('users'), userId),
3434
title,
3535
description,
36+
deadline: q.Time(new Date(deadline).toISOString()),
3637
timestamps: {
3738
createdAt: q.Now(),
3839
updatedAt: q.Now(),

0 commit comments

Comments
 (0)