mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-06-29 15:47:09 +00:00
TEMPORARY FIX TO TEST BUILD
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 1m15s
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 1m15s
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import type { Device } from "@prisma/client";
|
||||
import { atom, createStore } from "jotai";
|
||||
import type { Device } from "./backend-types";
|
||||
|
||||
// Create a single store instance
|
||||
export const store = createStore();
|
||||
|
@ -1,6 +1,6 @@
|
||||
"use server";
|
||||
import type { TNationalPerson } from "@/lib/types";
|
||||
import type { User } from "@prisma/client";
|
||||
import { User } from "./types/user";
|
||||
|
||||
export async function getNationalPerson({
|
||||
idCard,
|
||||
@ -18,26 +18,27 @@ export async function getNationalPerson({
|
||||
}
|
||||
|
||||
export async function VerifyUserDetails({ user }: { user: User }) {
|
||||
const phoneNumber = String(user.phoneNumber).slice(4);
|
||||
console.log({ phoneNumber });
|
||||
const nationalData = await getNationalPerson({ idCard: user.id_card ?? "" });
|
||||
const dob = new Date(nationalData.dob);
|
||||
const age = new Date().getFullYear() - dob.getFullYear();
|
||||
console.log(user)
|
||||
// const phoneNumber = String(user.phoneNumber).slice(4);
|
||||
// console.log({ phoneNumber });
|
||||
// const nationalData = await getNationalPerson({ idCard: user.id_card ?? "" });
|
||||
// const dob = new Date(nationalData.dob);
|
||||
// const age = new Date().getFullYear() - dob.getFullYear();
|
||||
|
||||
console.log("ID card", user.id_card === nationalData.nic);
|
||||
console.log("name", user.name === nationalData.name_en);
|
||||
console.log("house", user.address === nationalData.house_name_en);
|
||||
console.log("phone", phoneNumber === nationalData.primary_contact);
|
||||
console.log("db phone", phoneNumber);
|
||||
console.log("national phone", nationalData.primary_contact);
|
||||
// console.log("ID card", user.id_card === nationalData.nic);
|
||||
// console.log("name", user.name === nationalData.name_en);
|
||||
// console.log("house", user.address === nationalData.house_name_en);
|
||||
// console.log("phone", phoneNumber === nationalData.primary_contact);
|
||||
// console.log("db phone", phoneNumber);
|
||||
// console.log("national phone", nationalData.primary_contact);
|
||||
|
||||
if (
|
||||
user.id_card === nationalData.nic &&
|
||||
user.name === nationalData.name_en &&
|
||||
user.address === nationalData.house_name_en &&
|
||||
age >= 18
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
// if (
|
||||
// user.id_card === nationalData.nic &&
|
||||
// user.name === nationalData.name_en &&
|
||||
// user.address === nationalData.house_name_en &&
|
||||
// age >= 18
|
||||
// ) {
|
||||
// return true;
|
||||
// }
|
||||
return false;
|
||||
}
|
||||
|
@ -19,6 +19,10 @@ export interface User {
|
||||
user_permissions: Permission[];
|
||||
first_name: string;
|
||||
last_name: string;
|
||||
id_card?: string;
|
||||
address?: string;
|
||||
verified?: boolean;
|
||||
dob?: string;
|
||||
mobile?: string;
|
||||
wallet_balance?: number;
|
||||
is_superuser: boolean;
|
||||
|
Reference in New Issue
Block a user