mirror of
https://github.com/Kevsl/crypto-exchange-api.git
synced 2025-07-09 06:00:12 +02:00
fixed crypto up after buy
This commit is contained in:
parent
312115142e
commit
28e061722a
8
prisma/migrations/20240607092158_/migration.sql
Normal file
8
prisma/migrations/20240607092158_/migration.sql
Normal 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");
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user