se agregó fecha de consulta a la api
This commit is contained in:
@@ -11,11 +11,13 @@ export class AlmacenamientoService {
|
||||
) {}
|
||||
|
||||
// Example method to create a new record
|
||||
async create(correo: string): Promise<void> {
|
||||
async create(correo: string): Promise<any> {
|
||||
const existente = await this.almacenamientoRepository.findOneBy({ correo });
|
||||
if (!existente) {
|
||||
throw new Error("Este usuario no tiene acceso")
|
||||
}
|
||||
existente.fechaAmpliacion=new Date()
|
||||
const save = await this.almacenamientoRepository.save(existente)
|
||||
const apiUrl = process.env.API_URL;
|
||||
|
||||
const entrada = {
|
||||
@@ -24,7 +26,7 @@ export class AlmacenamientoService {
|
||||
};
|
||||
|
||||
try{
|
||||
let resonse= fetch(apiUrl, {
|
||||
let resonse= await fetch(apiUrl, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -33,8 +35,8 @@ export class AlmacenamientoService {
|
||||
},
|
||||
body: JSON.stringify(entrada)
|
||||
})
|
||||
|
||||
return
|
||||
console.log(resonse)
|
||||
return resonse;
|
||||
|
||||
}catch(error){
|
||||
throw new Error(error)
|
||||
|
||||
@@ -7,6 +7,11 @@ export class Almacenamiento {
|
||||
|
||||
@Column('varchar', { name: 'correo', length: 100 })
|
||||
correo: string;
|
||||
|
||||
|
||||
@Column('timestamp', {
|
||||
name: 'fecha_ampliacion',
|
||||
default: () => 'CURRENT_TIMESTAMP',
|
||||
})
|
||||
fechaAmpliacion: Date;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user