chore(release): 0.4.0

This commit is contained in:
2026-05-05 15:00:14 +07:00
parent 5948d0e2a0
commit 9dfd0295d3
22 changed files with 239 additions and 89 deletions
+16 -2
View File
@@ -11,7 +11,14 @@ export const tripRepo = {
async findAll() {
return prisma.trip.findMany({
include: {
organizer: { select: { id: true, name: true, image: true } },
organizer: {
select: {
id: true,
name: true,
image: true,
organizerVerification: { select: { status: true } },
},
},
images: { orderBy: { order: "asc" }, take: 1 },
_count: {
select: {
@@ -76,7 +83,14 @@ export const tripRepo = {
return prisma.trip.findMany({
where,
include: {
organizer: { select: { id: true, name: true, image: true } },
organizer: {
select: {
id: true,
name: true,
image: true,
organizerVerification: { select: { status: true } },
},
},
images: { orderBy: { order: "asc" }, take: 1 },
_count: {
select: {
+7 -2
View File
@@ -28,10 +28,15 @@ export const userRepo = {
return prisma.user.create({ data });
},
/**
* Tandai user sudah accept T&C/Privacy. Idempotent: kalau sudah `true`,
* tidak overwrite `acceptedAt` (audit trail pertama tetap akurat).
*/
async markAcceptedTerms(id: string) {
return prisma.user.update({
where: { id },
const result = await prisma.user.updateMany({
where: { id, acceptedTermsAndPrivacy: false },
data: { acceptedTermsAndPrivacy: true, acceptedAt: new Date() },
});
return { updated: result.count > 0 };
},
};
+5 -1
View File
@@ -1,6 +1,7 @@
import { userRepo } from "@/server/repositories/user.repo";
import { tripRepo } from "@/server/repositories/trip.repo";
import { participantRepo } from "@/server/repositories/participant.repo";
import { organizerRepo } from "@/server/repositories/organizer.repo";
import { isPastTripLastDayForReview } from "@/lib/trip-dates";
export const profileService = {
@@ -10,10 +11,12 @@ export const profileService = {
throw new Error("Pengguna tidak ditemukan");
}
const [organizedTrips, participations] = await Promise.all([
const [organizedTrips, participations, verification] = await Promise.all([
tripRepo.findByOrganizerId(userId),
participantRepo.findWithTripForProfile(userId),
organizerRepo.findByUserId(userId),
]);
const isVerifiedOrganizer = verification?.status === "APPROVED";
const activeJoined = participations
.filter((p) => p.status !== "CANCELLED")
@@ -42,6 +45,7 @@ export const profileService = {
return {
user,
isVerifiedOrganizer,
organizedTrips,
activeJoined,
cancelledJoined,