fixed crypto up after buy

This commit is contained in:
Kevsl 2024-06-07 11:35:30 +02:00
parent 312115142e
commit 28e061722a
3 changed files with 18 additions and 1 deletions

View File

@ -0,0 +1,8 @@
/*
Warnings:
- A unique constraint covering the columns `[name]` on the table `Crypto` will be added. If there are existing duplicate values, this will fail.
*/
-- CreateIndex
CREATE UNIQUE INDEX "Crypto_name_key" ON "Crypto"("name");

View File

@ -11,7 +11,7 @@ generator client {
model Crypto {
id String @id @default(uuid())
name String
name String @unique
value Float
image String
created_at DateTime @default(now())

View File

@ -102,6 +102,15 @@ export class CryptoService {
});
}
}
const newCryptoValue = crypto.value * 1.1;
await this.prisma.crypto.update({
where: {
id: dto.id_crypto,
},
data: {
value: newCryptoValue,
},
});
return crypto;
}