diff --git a/.env.example b/.env.example index ee81ea5..088e8d0 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,11 @@ DATABASE_URL=postgresql://postgres:postgres@localhost:5432/wedding_planner NEXTAUTH_SECRET=your-secret -NEXTAUTH_URL=http://localhost:3000 \ No newline at end of file +NEXTAUTH_URL=http://localhost:3000 +NEXT_PUBLIC_BASE_URL=http://localhost:3000 + +SMTP_HOST=smtp.example.com +SMTP_PORT=587 +SMTP_USER=your@email.com +SMTP_PASS=yourpassword +SMTP_FROM_NAME=Wedding Planner +SMTP_FROM_EMAIL=your@email.com \ No newline at end of file diff --git a/README.md b/README.md index 2937010..92464fa 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,15 @@ My goal for this project is to be an all-in-one self hosted event planner for ma ## Table of Contents - [Planned Features](#planned-features) +- [Updates](#updates) - [Getting Started](#getting-started) - [Built With](#built-with) ## Planned Features - [x] Account Creation - [x] First time setup to create the admin user - - [ ] Invite partner and or "Planner" via email (smtp) + - [x] Invite users via email (smtp) users can be COUPLE, PLANNER, GUEST + - [x] Create local accounts (no use of SMTP) - [ ] Creating custom events - [ ] Information about each event - Date/Time @@ -29,6 +31,15 @@ My goal for this project is to be an all-in-one self hosted event planner for ma - Seating Charts - Calendar/Timeline Builder +## Updates +#### 6.24.25 +- added ability to invite users via email making use of a smtp server and nodemailer + - inviteTokens added to db which are used to sign up and expire onDate and after use +- added ability to create local users if you don't want to use smtp `/admin/create-user` +- created user pages +- added usernames to `Users` table +- updated first time setup to include username creation + ## Getting Started This is very much a work in progress but this `README` will stay up to date on working features and steps to get it running **in its current state**. That being said if you're interested in starting it as is, you can follow these instructions. @@ -42,6 +53,14 @@ git clone https://github.com/briannelson95/wedding-planner.git DATABASE_URL=postgresql://postgres:postgres@localhost:5432/wedding_planner NEXTAUTH_SECRET=your-secret NEXTAUTH_URL=http://localhost:3000 +NEXT_PUBLIC_BASE_URL=http://localhost:3000 + +SMTP_HOST=smtp.example.com +SMTP_PORT=587 +SMTP_USER=your@email.com +SMTP_PASS=yourpassword +SMTP_FROM_NAME=Wedding Planner +SMTP_FROM_EMAIL=your@email.com ``` 3. Start the database @@ -49,7 +68,13 @@ NEXTAUTH_URL=http://localhost:3000 docker compose up -d ``` -4. Install dependencies and start the front end with `npm i && npm run dev` or `bun i && bun dev` +4. Migrate and Generate the Prima files +``` +npx prisma migrate dev --name init +npx prisma generate +``` + +5. Install dependencies and start the front end with `npm i && npm run dev` or `bun i && bun dev` ## Built With - NextJS 15 diff --git a/app/(auth)/admin/create-user/page.tsx b/app/(auth)/admin/create-user/page.tsx new file mode 100644 index 0000000..c0ac47b --- /dev/null +++ b/app/(auth)/admin/create-user/page.tsx @@ -0,0 +1,31 @@ +'use client' +import { useState } from 'react' + +export default function CreateUserPage() { + const [form, setForm] = useState({ username: '', password: '', role: 'GUEST' }) + const [success, setSuccess] = useState(false) + + async function handleSubmit(e: React.FormEvent) { + e.preventDefault() + await fetch('/api/admin/create-user', { + method: 'POST', + body: JSON.stringify(form), + }) + setSuccess(true) + } + + return ( +
+ ) +} diff --git a/app/(auth)/dashboard/page.tsx b/app/(auth)/dashboard/page.tsx index 0696fb4..0a217c9 100644 --- a/app/(auth)/dashboard/page.tsx +++ b/app/(auth)/dashboard/page.tsx @@ -4,7 +4,7 @@ import React from 'react' export default async function DashboardPage() { const events = await queries.fetchEvents() - console.log(events) + // console.log(events) return (ID: {item.id}
-Name: {item.name}
-Date: {item.date ? item.date.toISOString() : 'null'}
-Location: {item.location ? item.location : 'null'}
-Creator ID:{item.creatorId}
-Created At:{item.createdAt.toISOString()}
- -ID: {item.id}
+Name: {item.name}
+Date: {item.date ? item.date.toISOString() : 'null'}
+Location: {item.location ? item.location : 'null'}
+Creator ID:{item.creatorId}
+Created At:{item.createdAt.toISOString()}
+ +| Event Name | +Event Date | +Created by | +
|---|---|---|
| {item.name} | +{item.date?.toDateString()} | +{item.creatorId} | +
Email: {user.email}
+Role: {user.role}
+Joined: {user.createdAt.toDateString()}
+