Files
neptune-back/src/offer/offer.service.sql
Mathis fa91630a29 Add various module, service, and DTO files for new features
Integrate modules and services related to crypto, user, role, offer, and promoCode functionalities. Includes DTOs for validating data shapes, and services to handle business logic, with controller endpoints for different operations.
2024-11-12 13:30:05 +01:00

36 lines
763 B
SQL

SELECT
o.amount,
o.created_at,
o.id_user,
c.id AS crypto_id,
c.name AS crypto_name,
c.value AS crypto_value,
c.image AS crypto_image,
c.quantity AS crypto_quantity
FROM
"Offer" o
JOIN
"Crypto" c ON o.id_crypto = c.id
ORDER BY
o.created_at DESC;
INSERT INTO "Offer" (id, id_crypto, id_user, amount, created_at, updated_at)
VALUES (gen_random_uuid(), 'dto.id_crypto', 'userId', 'dto.amount', NOW(), NOW());
SELECT * FROM "Offer" WHERE id = 'offerId';
SELECT * FROM "Crypto" WHERE id = 'dto.id_crypto';
UPDATE "Offer"
SET
id_crypto = 'dto.id_crypto',
amount = 'dto.amount',
updated_at = NOW()
WHERE
id = 'offerId';
SELECT * FROM "Offer" WHERE id = 'id';
DELETE FROM "Offer" WHERE id = 'id';