Compare commits
No commits in common. "62e2255b5e46aca6647e491afb7e1fc3d879a7b4" and "db0d2cf2152f90534541cb28a2ef8f26b6f21cb5" have entirely different histories.
62e2255b5e
...
db0d2cf215
Binary file not shown.
@ -13,8 +13,21 @@ export async function POST(req: Request) {
|
|||||||
// Ensure user exists in DB (sync from Clerk if needed)
|
// Ensure user exists in DB (sync from Clerk if needed)
|
||||||
await ensureUserSynced(userId, db)
|
await ensureUserSynced(userId, db)
|
||||||
|
|
||||||
|
let client = await db.getClientByUserId(userId)
|
||||||
|
|
||||||
|
if (!client) {
|
||||||
|
// Auto-create client profile if it doesn't exist
|
||||||
|
console.log('Client profile not found, creating new one for user:', userId)
|
||||||
|
client = await db.createClient({
|
||||||
|
userId,
|
||||||
|
membershipType: 'basic',
|
||||||
|
membershipStatus: 'active',
|
||||||
|
joinDate: new Date()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Check if already checked in
|
// Check if already checked in
|
||||||
const activeCheckIn = await db.getActiveCheckIn(userId)
|
const activeCheckIn = await db.getActiveCheckIn(client.id)
|
||||||
if (activeCheckIn) {
|
if (activeCheckIn) {
|
||||||
return new NextResponse('Already checked in', { status: 400 })
|
return new NextResponse('Already checked in', { status: 400 })
|
||||||
}
|
}
|
||||||
@ -22,7 +35,7 @@ export async function POST(req: Request) {
|
|||||||
const body = await req.json()
|
const body = await req.json()
|
||||||
const { type = 'gym', notes } = body
|
const { type = 'gym', notes } = body
|
||||||
|
|
||||||
const attendance = await db.checkIn(userId, type, notes)
|
const attendance = await db.checkIn(client.id, type, notes)
|
||||||
return NextResponse.json(attendance)
|
return NextResponse.json(attendance)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Check-in error:', error)
|
console.error('Check-in error:', error)
|
||||||
|
|||||||
@ -8,8 +8,13 @@ export async function POST(req: Request) {
|
|||||||
if (!userId) return new NextResponse('Unauthorized', { status: 401 })
|
if (!userId) return new NextResponse('Unauthorized', { status: 401 })
|
||||||
|
|
||||||
const db = await getDatabase()
|
const db = await getDatabase()
|
||||||
|
const client = await db.getClientByUserId(userId)
|
||||||
|
|
||||||
const activeCheckIn = await db.getActiveCheckIn(userId)
|
if (!client) {
|
||||||
|
return new NextResponse('Client profile not found', { status: 404 })
|
||||||
|
}
|
||||||
|
|
||||||
|
const activeCheckIn = await db.getActiveCheckIn(client.id)
|
||||||
if (!activeCheckIn) {
|
if (!activeCheckIn) {
|
||||||
return new NextResponse('No active check-in found', { status: 404 })
|
return new NextResponse('No active check-in found', { status: 404 })
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,20 @@ export async function GET(req: Request) {
|
|||||||
// Ensure user exists in DB (sync from Clerk if needed)
|
// Ensure user exists in DB (sync from Clerk if needed)
|
||||||
await ensureUserSynced(userId, db)
|
await ensureUserSynced(userId, db)
|
||||||
|
|
||||||
const history = await db.getAttendanceHistory(userId)
|
let client = await db.getClientByUserId(userId)
|
||||||
|
|
||||||
|
if (!client) {
|
||||||
|
// Auto-create client profile if it doesn't exist
|
||||||
|
console.log('Client profile not found, creating new one for user:', userId)
|
||||||
|
client = await db.createClient({
|
||||||
|
userId,
|
||||||
|
membershipType: 'basic',
|
||||||
|
membershipStatus: 'active',
|
||||||
|
joinDate: new Date()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const history = await db.getAttendanceHistory(client.id)
|
||||||
return NextResponse.json(history)
|
return NextResponse.json(history)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('History error:', error)
|
console.error('History error:', error)
|
||||||
|
|||||||
@ -19,52 +19,7 @@ export async function GET(request: NextRequest) {
|
|||||||
users.map(async (user) => {
|
users.map(async (user) => {
|
||||||
const { password: _, ...userWithoutPassword } = user;
|
const { password: _, ...userWithoutPassword } = user;
|
||||||
const client = await db.getClientByUserId(user.id);
|
const client = await db.getClientByUserId(user.id);
|
||||||
|
return { ...userWithoutPassword, client };
|
||||||
// Get active check-in status and statistics for ALL users
|
|
||||||
let isCheckedIn = false;
|
|
||||||
let checkInTime = null;
|
|
||||||
let lastCheckInTime = null;
|
|
||||||
let checkInsThisWeek = 0;
|
|
||||||
let checkInsThisMonth = 0;
|
|
||||||
|
|
||||||
// Query attendance by userId (works for all user types now)
|
|
||||||
const activeCheckIn = await db.getActiveCheckIn(user.id);
|
|
||||||
if (activeCheckIn) {
|
|
||||||
isCheckedIn = true;
|
|
||||||
checkInTime = activeCheckIn.checkInTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get attendance history for statistics
|
|
||||||
const attendanceHistory = await db.getAttendanceHistory(user.id);
|
|
||||||
|
|
||||||
if (attendanceHistory.length > 0) {
|
|
||||||
// Last check-in is the most recent attendance record
|
|
||||||
lastCheckInTime = attendanceHistory[0].checkInTime;
|
|
||||||
|
|
||||||
// Calculate check-ins in last 7 days
|
|
||||||
const weekAgo = new Date();
|
|
||||||
weekAgo.setDate(weekAgo.getDate() - 7);
|
|
||||||
checkInsThisWeek = attendanceHistory.filter(
|
|
||||||
a => new Date(a.checkInTime) >= weekAgo
|
|
||||||
).length;
|
|
||||||
|
|
||||||
// Calculate check-ins in last 30 days
|
|
||||||
const monthAgo = new Date();
|
|
||||||
monthAgo.setDate(monthAgo.getDate() - 30);
|
|
||||||
checkInsThisMonth = attendanceHistory.filter(
|
|
||||||
a => new Date(a.checkInTime) >= monthAgo
|
|
||||||
).length;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
...userWithoutPassword,
|
|
||||||
client,
|
|
||||||
isCheckedIn,
|
|
||||||
checkInTime,
|
|
||||||
lastCheckInTime,
|
|
||||||
checkInsThisWeek,
|
|
||||||
checkInsThisMonth
|
|
||||||
};
|
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -9,20 +9,6 @@ import { formatDate } from "@/lib/utils";
|
|||||||
|
|
||||||
ModuleRegistry.registerModules([AllCommunityModule]);
|
ModuleRegistry.registerModules([AllCommunityModule]);
|
||||||
|
|
||||||
function getTimeAgo(date: Date): string {
|
|
||||||
const now = new Date();
|
|
||||||
const diffMs = now.getTime() - date.getTime();
|
|
||||||
const diffMins = Math.floor(diffMs / 60000);
|
|
||||||
const diffHours = Math.floor(diffMins / 60);
|
|
||||||
const diffDays = Math.floor(diffHours / 24);
|
|
||||||
|
|
||||||
if (diffMins < 1) return 'just now';
|
|
||||||
if (diffMins < 60) return `${diffMins}m ago`;
|
|
||||||
if (diffHours < 24) return `${diffHours}h ago`;
|
|
||||||
return `${diffDays}d ago`;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
interface User {
|
interface User {
|
||||||
id: string;
|
id: string;
|
||||||
email: string;
|
email: string;
|
||||||
@ -31,8 +17,6 @@ interface User {
|
|||||||
role: string;
|
role: string;
|
||||||
phone?: string;
|
phone?: string;
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
isCheckedIn?: boolean;
|
|
||||||
checkInTime?: Date;
|
|
||||||
client?: {
|
client?: {
|
||||||
id: string;
|
id: string;
|
||||||
membershipType: string;
|
membershipType: string;
|
||||||
@ -168,27 +152,6 @@ export function UserGrid({
|
|||||||
},
|
},
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
headerName: "Currently Checked In",
|
|
||||||
valueGetter: (params) => params.data?.isCheckedIn,
|
|
||||||
filter: "agTextColumnFilter",
|
|
||||||
sortable: true,
|
|
||||||
cellRenderer: (params: any) => {
|
|
||||||
if (!params.data?.isCheckedIn) {
|
|
||||||
return <span className="text-gray-400">—</span>;
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkInTime = params.data.checkInTime ? new Date(params.data.checkInTime) : null;
|
|
||||||
const timeAgo = checkInTime ? getTimeAgo(checkInTime) : '';
|
|
||||||
|
|
||||||
return (
|
|
||||||
<span className="px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800 border border-green-200">
|
|
||||||
✓ Checked In {timeAgo && `(${timeAgo})`}
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
minWidth: 180,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
headerName: "Join Date",
|
headerName: "Join Date",
|
||||||
valueGetter: (params) =>
|
valueGetter: (params) =>
|
||||||
|
|||||||
@ -13,11 +13,6 @@ interface User {
|
|||||||
role: string;
|
role: string;
|
||||||
phone?: string;
|
phone?: string;
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
isCheckedIn?: boolean;
|
|
||||||
checkInTime?: Date;
|
|
||||||
lastCheckInTime?: Date;
|
|
||||||
checkInsThisWeek?: number;
|
|
||||||
checkInsThisMonth?: number;
|
|
||||||
client?: {
|
client?: {
|
||||||
id: string;
|
id: string;
|
||||||
membershipType: string;
|
membershipType: string;
|
||||||
@ -449,7 +444,7 @@ export function UserManagement() {
|
|||||||
</a>
|
</a>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<div className="grid grid-cols-3 gap-4">
|
<div className="grid grid-cols-2 gap-4">
|
||||||
<div>
|
<div>
|
||||||
<h4 className="font-medium mb-2">Basic Information</h4>
|
<h4 className="font-medium mb-2">Basic Information</h4>
|
||||||
<div className="space-y-1 text-sm">
|
<div className="space-y-1 text-sm">
|
||||||
@ -505,28 +500,6 @@ export function UserManagement() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div>
|
|
||||||
<h4 className="font-medium mb-2">Check-In Statistics</h4>
|
|
||||||
<div className="space-y-1 text-sm">
|
|
||||||
<p>
|
|
||||||
<span className="font-medium">Last Check-In:</span>{" "}
|
|
||||||
{selectedUser.lastCheckInTime
|
|
||||||
? new Date(
|
|
||||||
selectedUser.lastCheckInTime,
|
|
||||||
).toLocaleString()
|
|
||||||
: "Never"}
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<span className="font-medium">This Week:</span>{" "}
|
|
||||||
{selectedUser.checkInsThisWeek || 0} check-ins
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<span className="font-medium">This Month:</span>{" "}
|
|
||||||
{selectedUser.checkInsThisMonth || 0} check-ins
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
@ -106,61 +106,19 @@ export class SQLiteDatabase implements IDatabase {
|
|||||||
CREATE INDEX IF NOT EXISTS idx_fitness_profiles_userId ON fitness_profiles(userId);
|
CREATE INDEX IF NOT EXISTS idx_fitness_profiles_userId ON fitness_profiles(userId);
|
||||||
`)
|
`)
|
||||||
|
|
||||||
// Attendance table migration: change from clientId to userId
|
// Attendance table
|
||||||
// Check if old table exists and migrate
|
|
||||||
const tableInfo = this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='attendance'").get() as any;
|
|
||||||
|
|
||||||
if (tableInfo) {
|
|
||||||
// Check if table has clientId column (old schema)
|
|
||||||
const columns = this.db.prepare("PRAGMA table_info(attendance)").all() as any[];
|
|
||||||
const hasClientId = columns.some((col: any) => col.name === 'clientId');
|
|
||||||
|
|
||||||
if (hasClientId) {
|
|
||||||
console.log('Migrating attendance table from clientId to userId...');
|
|
||||||
|
|
||||||
// Create new table with userId
|
|
||||||
this.db.exec(`
|
|
||||||
CREATE TABLE IF NOT EXISTS attendance_new (
|
|
||||||
id TEXT PRIMARY KEY,
|
|
||||||
userId TEXT NOT NULL,
|
|
||||||
checkInTime DATETIME NOT NULL,
|
|
||||||
checkOutTime DATETIME,
|
|
||||||
type TEXT NOT NULL CHECK (type IN ('gym', 'class', 'personal_training')),
|
|
||||||
notes TEXT,
|
|
||||||
createdAt DATETIME NOT NULL,
|
|
||||||
FOREIGN KEY (userId) REFERENCES users (id) ON DELETE CASCADE
|
|
||||||
)
|
|
||||||
`);
|
|
||||||
|
|
||||||
// Migrate data: map clientId to userId via clients table
|
|
||||||
this.db.exec(`
|
|
||||||
INSERT INTO attendance_new (id, userId, checkInTime, checkOutTime, type, notes, createdAt)
|
|
||||||
SELECT a.id, c.userId, a.checkInTime, a.checkOutTime, a.type, a.notes, a.createdAt
|
|
||||||
FROM attendance a
|
|
||||||
JOIN clients c ON a.clientId = c.id
|
|
||||||
`);
|
|
||||||
|
|
||||||
// Drop old table and rename new one
|
|
||||||
this.db.exec(`DROP TABLE attendance`);
|
|
||||||
this.db.exec(`ALTER TABLE attendance_new RENAME TO attendance`);
|
|
||||||
|
|
||||||
console.log('Attendance table migration completed');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Create new attendance table with userId
|
|
||||||
this.db.exec(`
|
this.db.exec(`
|
||||||
CREATE TABLE IF NOT EXISTS attendance (
|
CREATE TABLE IF NOT EXISTS attendance (
|
||||||
id TEXT PRIMARY KEY,
|
id TEXT PRIMARY KEY,
|
||||||
userId TEXT NOT NULL,
|
clientId TEXT NOT NULL,
|
||||||
checkInTime DATETIME NOT NULL,
|
checkInTime DATETIME NOT NULL,
|
||||||
checkOutTime DATETIME,
|
checkOutTime DATETIME,
|
||||||
type TEXT NOT NULL CHECK (type IN ('gym', 'class', 'personal_training')),
|
type TEXT NOT NULL CHECK (type IN ('gym', 'class', 'personal_training')),
|
||||||
notes TEXT,
|
notes TEXT,
|
||||||
createdAt DATETIME NOT NULL,
|
createdAt DATETIME NOT NULL,
|
||||||
FOREIGN KEY (userId) REFERENCES users (id) ON DELETE CASCADE
|
FOREIGN KEY (clientId) REFERENCES clients (id) ON DELETE CASCADE
|
||||||
)
|
)
|
||||||
`);
|
`)
|
||||||
}
|
|
||||||
|
|
||||||
// Recommendations table
|
// Recommendations table
|
||||||
// Removed DROP TABLE to persist data. Schema is now stable.
|
// Removed DROP TABLE to persist data. Schema is now stable.
|
||||||
@ -182,16 +140,16 @@ export class SQLiteDatabase implements IDatabase {
|
|||||||
FOREIGN KEY (userId) REFERENCES users (id) ON DELETE CASCADE,
|
FOREIGN KEY (userId) REFERENCES users (id) ON DELETE CASCADE,
|
||||||
FOREIGN KEY (fitnessProfileId) REFERENCES fitness_profiles (userId)
|
FOREIGN KEY (fitnessProfileId) REFERENCES fitness_profiles (userId)
|
||||||
)
|
)
|
||||||
`);
|
`)
|
||||||
|
|
||||||
this.db.exec(`
|
this.db.exec(`
|
||||||
CREATE INDEX IF NOT EXISTS idx_recommendations_userId ON recommendations(userId);
|
CREATE INDEX IF NOT EXISTS idx_recommendations_userId ON recommendations(userId);
|
||||||
`);
|
`)
|
||||||
|
|
||||||
this.db.exec(`
|
this.db.exec(`
|
||||||
CREATE INDEX IF NOT EXISTS idx_attendance_userId ON attendance(userId);
|
CREATE INDEX IF NOT EXISTS idx_attendance_clientId ON attendance(clientId);
|
||||||
CREATE INDEX IF NOT EXISTS idx_attendance_checkInTime ON attendance(checkInTime);
|
CREATE INDEX IF NOT EXISTS idx_attendance_checkInTime ON attendance(checkInTime);
|
||||||
`);
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// User operations
|
// User operations
|
||||||
@ -431,7 +389,7 @@ export class SQLiteDatabase implements IDatabase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Attendance operations
|
// Attendance operations
|
||||||
async checkIn(userId: string, type: 'gym' | 'class' | 'personal_training', notes?: string): Promise<Attendance> {
|
async checkIn(clientId: string, type: 'gym' | 'class' | 'personal_training', notes?: string): Promise<Attendance> {
|
||||||
if (!this.db) throw new Error('Database not connected')
|
if (!this.db) throw new Error('Database not connected')
|
||||||
|
|
||||||
const id = Math.random().toString(36).substr(2, 9)
|
const id = Math.random().toString(36).substr(2, 9)
|
||||||
@ -439,7 +397,7 @@ export class SQLiteDatabase implements IDatabase {
|
|||||||
|
|
||||||
const attendance: Attendance = {
|
const attendance: Attendance = {
|
||||||
id,
|
id,
|
||||||
userId,
|
clientId,
|
||||||
checkInTime: now,
|
checkInTime: now,
|
||||||
type,
|
type,
|
||||||
notes,
|
notes,
|
||||||
@ -447,23 +405,20 @@ export class SQLiteDatabase implements IDatabase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const stmt = this.db.prepare(
|
const stmt = this.db.prepare(
|
||||||
`INSERT INTO attendance(id, userId, checkInTime, type, notes, createdAt)
|
`INSERT INTO attendance(id, clientId, checkInTime, type, notes, createdAt)
|
||||||
VALUES(?, ?, ?, ?, ?, ?)`
|
VALUES(?, ?, ?, ?, ?, ?)`
|
||||||
)
|
)
|
||||||
|
|
||||||
stmt.run(
|
stmt.run(
|
||||||
attendance.id, attendance.userId, attendance.checkInTime.toISOString(),
|
attendance.id, attendance.clientId, attendance.checkInTime.toISOString(),
|
||||||
attendance.type, attendance.notes, attendance.createdAt.toISOString()
|
attendance.type, attendance.notes, attendance.createdAt.toISOString()
|
||||||
)
|
)
|
||||||
|
|
||||||
// Update client last visit if user is a client
|
// Update client last visit
|
||||||
const client = await this.getClientByUserId(userId);
|
|
||||||
if (client) {
|
|
||||||
this.db.prepare('UPDATE clients SET lastVisit = ? WHERE id = ?').run(
|
this.db.prepare('UPDATE clients SET lastVisit = ? WHERE id = ?').run(
|
||||||
now.toISOString(),
|
now.toISOString(),
|
||||||
client.id
|
clientId
|
||||||
);
|
)
|
||||||
}
|
|
||||||
|
|
||||||
return attendance
|
return attendance
|
||||||
}
|
}
|
||||||
@ -485,10 +440,10 @@ export class SQLiteDatabase implements IDatabase {
|
|||||||
return row ? this.mapRowToAttendance(row) : null
|
return row ? this.mapRowToAttendance(row) : null
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAttendanceHistory(userId: string): Promise<Attendance[]> {
|
async getAttendanceHistory(clientId: string): Promise<Attendance[]> {
|
||||||
if (!this.db) throw new Error('Database not connected')
|
if (!this.db) throw new Error('Database not connected')
|
||||||
const stmt = this.db.prepare('SELECT * FROM attendance WHERE userId = ? ORDER BY checkInTime DESC')
|
const stmt = this.db.prepare('SELECT * FROM attendance WHERE clientId = ? ORDER BY checkInTime DESC')
|
||||||
const rows = stmt.all(userId)
|
const rows = stmt.all(clientId)
|
||||||
return rows.map(row => this.mapRowToAttendance(row))
|
return rows.map(row => this.mapRowToAttendance(row))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -499,10 +454,10 @@ export class SQLiteDatabase implements IDatabase {
|
|||||||
return rows.map(row => this.mapRowToAttendance(row))
|
return rows.map(row => this.mapRowToAttendance(row))
|
||||||
}
|
}
|
||||||
|
|
||||||
async getActiveCheckIn(userId: string): Promise<Attendance | null> {
|
async getActiveCheckIn(clientId: string): Promise<Attendance | null> {
|
||||||
if (!this.db) throw new Error('Database not connected')
|
if (!this.db) throw new Error('Database not connected')
|
||||||
const stmt = this.db.prepare('SELECT * FROM attendance WHERE userId = ? AND checkOutTime IS NULL ORDER BY checkInTime DESC LIMIT 1')
|
const stmt = this.db.prepare('SELECT * FROM attendance WHERE clientId = ? AND checkOutTime IS NULL ORDER BY checkInTime DESC LIMIT 1')
|
||||||
const row = stmt.get(userId)
|
const row = stmt.get(clientId)
|
||||||
return row ? this.mapRowToAttendance(row) : null
|
return row ? this.mapRowToAttendance(row) : null
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -554,7 +509,7 @@ export class SQLiteDatabase implements IDatabase {
|
|||||||
private mapRowToAttendance(row: any): Attendance {
|
private mapRowToAttendance(row: any): Attendance {
|
||||||
return {
|
return {
|
||||||
id: row.id,
|
id: row.id,
|
||||||
userId: row.userId,
|
clientId: row.clientId,
|
||||||
checkInTime: new Date(row.checkInTime),
|
checkInTime: new Date(row.checkInTime),
|
||||||
checkOutTime: row.checkOutTime ? new Date(row.checkOutTime) : undefined,
|
checkOutTime: row.checkOutTime ? new Date(row.checkOutTime) : undefined,
|
||||||
type: row.type,
|
type: row.type,
|
||||||
|
|||||||
@ -39,7 +39,7 @@ export interface FitnessProfile {
|
|||||||
|
|
||||||
export interface Attendance {
|
export interface Attendance {
|
||||||
id: string;
|
id: string;
|
||||||
userId: string;
|
clientId: string;
|
||||||
checkInTime: Date;
|
checkInTime: Date;
|
||||||
checkOutTime?: Date;
|
checkOutTime?: Date;
|
||||||
type: "gym" | "class" | "personal_training";
|
type: "gym" | "class" | "personal_training";
|
||||||
@ -121,14 +121,14 @@ export interface IDatabase {
|
|||||||
|
|
||||||
// Attendance operations
|
// Attendance operations
|
||||||
checkIn(
|
checkIn(
|
||||||
userId: string,
|
clientId: string,
|
||||||
type: "gym" | "class" | "personal_training",
|
type: "gym" | "class" | "personal_training",
|
||||||
notes?: string,
|
notes?: string,
|
||||||
): Promise<Attendance>;
|
): Promise<Attendance>;
|
||||||
checkOut(attendanceId: string): Promise<Attendance | null>;
|
checkOut(attendanceId: string): Promise<Attendance | null>;
|
||||||
getAttendanceHistory(userId: string): Promise<Attendance[]>;
|
getAttendanceHistory(clientId: string): Promise<Attendance[]>;
|
||||||
getAllAttendance(): Promise<Attendance[]>;
|
getAllAttendance(): Promise<Attendance[]>;
|
||||||
getActiveCheckIn(userId: string): Promise<Attendance | null>;
|
getActiveCheckIn(clientId: string): Promise<Attendance | null>;
|
||||||
|
|
||||||
// Recommendation operations
|
// Recommendation operations
|
||||||
createRecommendation(
|
createRecommendation(
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
export const API_BASE_URL = __DEV__
|
export const API_BASE_URL = __DEV__
|
||||||
? 'https://8679109544e4.ngrok-free.app'
|
? 'https://694d46f62d87.ngrok-free.app'
|
||||||
: 'https://your-production-url.com'
|
: 'https://your-production-url.com'
|
||||||
|
|
||||||
export const API_ENDPOINTS = {
|
export const API_ENDPOINTS = {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user