upd: login tanpa otp

Deskripsi:
- struktur db
- update api
- update api version app

No Issues
This commit is contained in:
2025-09-02 14:38:32 +08:00
parent a533f3b085
commit dfa7b571f1
3 changed files with 18 additions and 16 deletions

View File

@@ -107,6 +107,7 @@ model User {
gender String @default("M") //M= Male, F= Female
img String?
isFirstLogin Boolean @default(true)
isWithoutOTP Boolean @default(false)
isActive Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt

View File

@@ -7,7 +7,7 @@ export async function POST(req: NextRequest) {
const { phone }: ILogin = await req.json();
const user = await prisma.user.findUnique({
where: { phone, isActive: true },
select: { id: true, phone: true },
select: { id: true, phone: true, isWithoutOTP: true },
});
if (!user) {
@@ -21,6 +21,7 @@ export async function POST(req: NextRequest) {
success: true,
message: "Sukses",
phone: user.phone,
isWithoutOTP: user.isWithoutOTP,
id: user.id,
});

View File

@@ -2,7 +2,7 @@ import { NextResponse } from "next/server";
export async function GET(request: Request) {
try {
return NextResponse.json({ success: true, version: "1.7.9", tahap: "beta", update: "-api mobile; -tambah laporan pada project dan tugas divisi; -tambah upload link pada project dan tugas divisi; -tambah detail tanggal dan jam pada project dan tugas divisi" }, { status: 200 });
return NextResponse.json({ success: true, version: "1.8.0", tahap: "beta", update: "-api mobile; -login tanpa otp (mobile app); -tambah laporan pada project dan tugas divisi; -tambah upload link pada project dan tugas divisi; -tambah detail tanggal dan jam pada project dan tugas divisi" }, { status: 200 });
} catch (error) {
console.error(error);
return NextResponse.json({ success: false, version: "Gagal mendapatkan version, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });