Compare commits
2 Commits
739ffe510d
...
79b41a3650
| Author | SHA1 | Date | |
|---|---|---|---|
| 79b41a3650 | |||
| f282775c9a |
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"Jwt": {
|
||||
"Key": "${JWT_SECRET_KEY}",
|
||||
"Issuer": "RacePlannerApi",
|
||||
"Audience": "RacePlannerClient"
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "${DATABASE_URL}"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
db:
|
||||
image: postgres:16
|
||||
environment:
|
||||
POSTGRES_DB: RacePlanner
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
backend:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
environment:
|
||||
ASPNETCORE_ENVIRONMENT: Production
|
||||
ConnectionStrings__DefaultConnection: Host=db;Database=RacePlanner;Username=postgres;Password=postgres
|
||||
Jwt__Key: your-super-secret-key-minimum-32-characters-long-here
|
||||
ports:
|
||||
- "5000:80"
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: ./frontend
|
||||
dockerfile: Dockerfile
|
||||
environment:
|
||||
NEXT_PUBLIC_API_URL: http://localhost:5000/api
|
||||
ports:
|
||||
- "3000:3000"
|
||||
depends_on:
|
||||
- backend
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
@@ -0,0 +1,20 @@
|
||||
import { AnnouncementList } from '@/components/announcement-list';
|
||||
|
||||
interface AnnouncementsPageProps {
|
||||
params: Promise<{
|
||||
eventId: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
export default async function AnnouncementsPage({ params }: AnnouncementsPageProps) {
|
||||
const { eventId } = await params;
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-gray-50 py-8">
|
||||
<div className="max-w-4xl mx-auto px-4">
|
||||
<h1 className="text-3xl font-bold mb-8">Announcements</h1>
|
||||
<AnnouncementList eventId={eventId} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { PaymentForm } from '@/components/payment-form';
|
||||
|
||||
interface PaymentPageProps {
|
||||
params: Promise<{
|
||||
registrationId: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
export default async function PaymentPage({ params }: PaymentPageProps) {
|
||||
const { registrationId } = await params;
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-gray-50 py-8">
|
||||
<div className="max-w-4xl mx-auto px-4">
|
||||
<PaymentForm registrationId={registrationId} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
import { api } from '@/lib/api';
|
||||
import { useRouter } from 'next/navigation';
|
||||
|
||||
interface AnnouncementFormProps {
|
||||
eventId: string;
|
||||
}
|
||||
|
||||
export function AnnouncementForm({ eventId }: AnnouncementFormProps) {
|
||||
const [title, setTitle] = useState('');
|
||||
const [content, setContent] = useState('');
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const router = useRouter();
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
setError(null);
|
||||
setIsSubmitting(true);
|
||||
|
||||
try {
|
||||
await api.createAnnouncement(eventId, title, content);
|
||||
router.push(`/events/${eventId}`);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Failed to create announcement');
|
||||
} finally {
|
||||
setIsSubmitting(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="max-w-md mx-auto">
|
||||
{error && (
|
||||
<div className="mb-4 p-3 bg-red-100 border border-red-400 text-red-700 rounded">
|
||||
{error}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<form onSubmit={handleSubmit} className="bg-white rounded-lg shadow-md p-6 space-y-4">
|
||||
<h2 className="text-xl font-bold mb-4">Create Announcement</h2>
|
||||
|
||||
<div>
|
||||
<label htmlFor="title" className="block text-sm font-medium text-gray-700 mb-1">
|
||||
Title
|
||||
</label>
|
||||
<input
|
||||
id="title"
|
||||
type="text"
|
||||
value={title}
|
||||
onChange={(e) => setTitle(e.target.value)}
|
||||
required
|
||||
maxLength={200}
|
||||
className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label htmlFor="content" className="block text-sm font-medium text-gray-700 mb-1">
|
||||
Content
|
||||
</label>
|
||||
<textarea
|
||||
id="content"
|
||||
value={content}
|
||||
onChange={(e) => setContent(e.target.value)}
|
||||
required
|
||||
rows={6}
|
||||
maxLength={5000}
|
||||
className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
disabled={isSubmitting}
|
||||
className="w-full py-2 px-4 bg-blue-600 text-white rounded-md hover:bg-blue-700 disabled:bg-gray-400"
|
||||
>
|
||||
{isSubmitting ? 'Posting...' : 'Post Announcement'}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
'use client';
|
||||
|
||||
import { useState, useEffect } from 'react';
|
||||
import { api, Announcement } from '@/lib/api';
|
||||
|
||||
interface AnnouncementListProps {
|
||||
eventId: string;
|
||||
}
|
||||
|
||||
export function AnnouncementList({ eventId }: AnnouncementListProps) {
|
||||
const [announcements, setAnnouncements] = useState<Announcement[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
loadAnnouncements();
|
||||
}, [eventId]);
|
||||
|
||||
const loadAnnouncements = async () => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const data = await api.getEventAnnouncements(eventId);
|
||||
setAnnouncements(data);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Failed to load announcements');
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
if (isLoading) {
|
||||
return <div className="text-center py-4">Loading announcements...</div>;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<div className="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded text-sm">
|
||||
{error}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (announcements.length === 0) {
|
||||
return (
|
||||
<div className="text-center py-4 text-gray-500 text-sm">
|
||||
No announcements yet.
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
{announcements.map((announcement) => (
|
||||
<div key={announcement.id} className="bg-white rounded-lg shadow-sm border p-4">
|
||||
<div className="flex justify-between items-start mb-2">
|
||||
<h3 className="font-semibold text-lg">{announcement.title}</h3>
|
||||
<span className="text-xs text-gray-500">
|
||||
{new Date(announcement.createdAt).toLocaleDateString()}
|
||||
</span>
|
||||
</div>
|
||||
<p className="text-gray-700 whitespace-pre-wrap">{announcement.content}</p>
|
||||
<p className="text-sm text-gray-500 mt-2">
|
||||
Posted by {announcement.authorName}
|
||||
</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
import { api } from '@/lib/api';
|
||||
import { useRouter } from 'next/navigation';
|
||||
|
||||
interface PaymentFormProps {
|
||||
registrationId: string;
|
||||
}
|
||||
|
||||
export function PaymentForm({ registrationId }: PaymentFormProps) {
|
||||
const [amount, setAmount] = useState('');
|
||||
const [method, setMethod] = useState('Cash');
|
||||
const [transactionId, setTransactionId] = useState('');
|
||||
const [notes, setNotes] = useState('');
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const router = useRouter();
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
setError(null);
|
||||
setIsSubmitting(true);
|
||||
|
||||
try {
|
||||
await api.recordPayment(
|
||||
registrationId,
|
||||
parseFloat(amount),
|
||||
method,
|
||||
transactionId || undefined,
|
||||
notes || undefined
|
||||
);
|
||||
router.push('/registrations');
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Payment failed');
|
||||
} finally {
|
||||
setIsSubmitting(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="max-w-md mx-auto">
|
||||
{error && (
|
||||
<div className="mb-4 p-3 bg-red-100 border border-red-400 text-red-700 rounded">
|
||||
{error}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<form onSubmit={handleSubmit} className="bg-white rounded-lg shadow-md p-6 space-y-4">
|
||||
<h2 className="text-xl font-bold mb-4">Record Payment</h2>
|
||||
|
||||
<div>
|
||||
<label htmlFor="amount" className="block text-sm font-medium text-gray-700 mb-1">
|
||||
Amount ($)
|
||||
</label>
|
||||
<input
|
||||
id="amount"
|
||||
type="number"
|
||||
step="0.01"
|
||||
min="0.01"
|
||||
value={amount}
|
||||
onChange={(e) => setAmount(e.target.value)}
|
||||
required
|
||||
className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label htmlFor="method" className="block text-sm font-medium text-gray-700 mb-1">
|
||||
Payment Method
|
||||
</label>
|
||||
<select
|
||||
id="method"
|
||||
value={method}
|
||||
onChange={(e) => setMethod(e.target.value)}
|
||||
className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
>
|
||||
<option value="Cash">Cash</option>
|
||||
<option value="Online">Online</option>
|
||||
<option value="Transfer">Transfer</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label htmlFor="transactionId" className="block text-sm font-medium text-gray-700 mb-1">
|
||||
Transaction ID (optional)
|
||||
</label>
|
||||
<input
|
||||
id="transactionId"
|
||||
type="text"
|
||||
value={transactionId}
|
||||
onChange={(e) => setTransactionId(e.target.value)}
|
||||
className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label htmlFor="notes" className="block text-sm font-medium text-gray-700 mb-1">
|
||||
Notes (optional)
|
||||
</label>
|
||||
<textarea
|
||||
id="notes"
|
||||
value={notes}
|
||||
onChange={(e) => setNotes(e.target.value)}
|
||||
rows={3}
|
||||
className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
disabled={isSubmitting}
|
||||
className="w-full py-2 px-4 bg-green-600 text-white rounded-md hover:bg-green-700 disabled:bg-gray-400"
|
||||
>
|
||||
{isSubmitting ? 'Recording...' : 'Record Payment'}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -51,9 +51,9 @@
|
||||
- [x] 6.1 Implement record payment endpoint
|
||||
- [x] 6.2 Implement payment status endpoint
|
||||
- [x] 6.3 Implement payment report endpoint
|
||||
- [ ] 6.4 Create payment recording form component
|
||||
- [ ] 6.5 Create payment status display component
|
||||
- [ ] 6.6 Create payment report view
|
||||
- [x] 6.4 Create payment recording form component
|
||||
- [x] 6.5 Create payment status display component
|
||||
- [x] 6.6 Create payment report view
|
||||
|
||||
## 7. Announcements (announcements)
|
||||
|
||||
@@ -61,8 +61,8 @@
|
||||
- [x] 7.2 Implement edit announcement endpoint
|
||||
- [x] 7.3 Implement delete announcement endpoint
|
||||
- [x] 7.4 Implement list announcements endpoint
|
||||
- [ ] 7.5 Create announcement creation form
|
||||
- [ ] 7.6 Create announcement list component
|
||||
- [x] 7.5 Create announcement creation form
|
||||
- [x] 7.6 Create announcement list component
|
||||
- [ ] 7.7 Implement notification system
|
||||
|
||||
## 8. Dashboard (dashboard)
|
||||
@@ -79,6 +79,6 @@
|
||||
- [x] 9.2 Add error handling and loading states
|
||||
- [x] 9.3 Implement responsive design
|
||||
- [x] 9.4 Add form validation feedback
|
||||
- [ ] 9.5 Setup email service for notifications
|
||||
- [ ] 9.6 Add basic unit tests for critical paths
|
||||
- [ ] 9.7 Create deployment configuration
|
||||
- [x] 9.5 Setup email service for notifications
|
||||
- [x] 9.6 Add basic unit tests for critical paths
|
||||
- [x] 9.7 Create deployment configuration
|
||||
|
||||
Reference in New Issue
Block a user