create offer stitched with backend
This commit is contained in:
parent
4eef0a57e0
commit
b430b42b60
5 changed files with 37 additions and 14 deletions
|
|
@ -1,6 +1,30 @@
|
|||
const uuid = require('uuid');
|
||||
|
||||
const OfferCreated = require('../models/OfferCreated');
|
||||
const OfferDetailsSet = require('../models/OfferDetailsSet');
|
||||
|
||||
async function createOffer(publicKey, offerDetails) {
|
||||
console.log('oui oui, je suis offer creation oui');
|
||||
console.log(publicKey);
|
||||
console.log(offerDetails);
|
||||
const offerCreated = await OfferCreated.create({
|
||||
uuid: uuid.v7(),
|
||||
public_key: publicKey,
|
||||
created_at: new Date().toISOString(),
|
||||
});
|
||||
|
||||
const offerDetailsSet = await OfferDetailsSet.create({
|
||||
uuid: uuid.v7(),
|
||||
offer_uuid: offerCreated.uuid,
|
||||
wants: offerDetails.wants,
|
||||
premium: offerDetails.premium,
|
||||
trade_amount_eur: offerDetails.trade_amount_eur,
|
||||
location_details: offerDetails.location_details,
|
||||
time_availability_details: offerDetails.time_availability_details,
|
||||
show_offer_to_trusted: offerDetails.show_offer_to_trusted,
|
||||
show_offer_to_trusted_trusted: offerDetails.show_offer_to_trusted_trusted,
|
||||
show_offer_to_all_members: offerDetails.show_offer_to_all_members,
|
||||
is_onchain_accepted: offerDetails.is_onchain_accepted,
|
||||
is_lightning_accepted: offerDetails.is_lightning_accepted,
|
||||
are_big_notes_accepted: offerDetails.are_big_notes_accepted,
|
||||
created_at: new Date().toISOString(),
|
||||
});
|
||||
}
|
||||
module.exports = createOffer;
|
||||
module.exports = { createOffer };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue