verify model
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import dotenv from "dotenv"
|
import dotenv from "dotenv"
|
||||||
|
import Bvn from "../model/bvnModel.js";
|
||||||
|
|
||||||
export const fetch = async (req, res)=>{
|
export const fetch = async (req, res)=>{
|
||||||
try{
|
try{
|
||||||
@@ -24,7 +24,19 @@ export const fetch = async (req, res)=>{
|
|||||||
,
|
,
|
||||||
config
|
config
|
||||||
)
|
)
|
||||||
.then( ( response ) => {
|
.then( async ( response ) => {
|
||||||
|
//console.log(response.data.data);
|
||||||
|
//console.log("===============================================");
|
||||||
|
const bvnData = new Bvn(response.data.data);
|
||||||
|
const saveBvn = await bvnData.save();
|
||||||
|
console.log("===============================================");
|
||||||
|
console.log(saveBvn._id);
|
||||||
|
console.log("===============================================");
|
||||||
|
|
||||||
|
if ( response.data.status === "success"){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return res.json({res : response.data});
|
return res.json({res : response.data});
|
||||||
//console.log( response )
|
//console.log( response )
|
||||||
} )
|
} )
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
import mongoose from "mongoose";
|
||||||
|
|
||||||
|
const bvnSchema = new mongoose.Schema({
|
||||||
|
bvn:{
|
||||||
|
type:String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
status:{
|
||||||
|
type:String,
|
||||||
|
required: false
|
||||||
|
},
|
||||||
|
firstname:{
|
||||||
|
type:String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
lastname:{
|
||||||
|
type:String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
middlename:{
|
||||||
|
type:String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
phone:{
|
||||||
|
type:String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
birthdate:{
|
||||||
|
type:String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
gender:{
|
||||||
|
type:String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
nationality:{
|
||||||
|
type:String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
photo:{
|
||||||
|
type:String,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
export default mongoose.model("bvns", bvnSchema );
|
||||||
Reference in New Issue
Block a user