mirror of
https://github.com/R0m1k3/PleinR.git
synced 2026-10-18 12:47:56 +02:00
Ajoute la page fiche adhérent publique (/adherents/[id])
Profil public d'un commerçant : vitrine, catégorie, localisation, description, bouton de contact et promotions en cours. Réservée aux adhérents actifs (404 sinon). Les cartes « À l'honneur » de l'accueil pointent désormais vers la fiche. Nouvelles requêtes getPublicMember / getMemberLivePromotions. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XwfhYHzC9hQWPDnQ2p53GL
This commit is contained in:
3 files changed
+373
-3
No files matched your search
@@ -44,6 +44,43 @@ export async function getLivePromotions(limit = 6) {
|
||||
return rows;
|
||||
}
|
||||
|
||||
export async function getPublicMember(id: number) {
|
||||
const [m] = await db
|
||||
.select({
|
||||
id: members.id,
|
||||
name: members.name,
|
||||
email: members.email,
|
||||
description: members.description,
|
||||
city: members.city,
|
||||
address: members.address,
|
||||
status: members.status,
|
||||
logoUrl: members.logoUrl,
|
||||
categoryLabel: categories.label,
|
||||
accent: categories.accent,
|
||||
tint: categories.tint,
|
||||
})
|
||||
.from(members)
|
||||
.leftJoin(categories, eq(members.categoryId, categories.id))
|
||||
.where(eq(members.id, id));
|
||||
return m ?? null;
|
||||
}
|
||||
|
||||
export async function getMemberLivePromotions(memberId: number) {
|
||||
return db
|
||||
.select({
|
||||
id: promotions.id,
|
||||
title: promotions.title,
|
||||
text: promotions.text,
|
||||
category: promotions.category,
|
||||
badge: promotions.badge,
|
||||
imageUrl: promotions.imageUrl,
|
||||
validUntil: promotions.validUntil,
|
||||
})
|
||||
.from(promotions)
|
||||
.where(and(eq(promotions.memberId, memberId), eq(promotions.status, "live")))
|
||||
.orderBy(desc(promotions.createdAt));
|
||||
}
|
||||
|
||||
export async function getHighlightedMembers(limit = 3) {
|
||||
const rows = await db
|
||||
.select({
|
||||
|
||||
Reference in new issue
Block a user