first service
This commit is contained in:
parent
cdc344c528
commit
56aa416751
2 changed files with 89 additions and 80 deletions
|
|
@ -2,6 +2,14 @@ class ServicesProvider {
|
|||
constructor() {}
|
||||
|
||||
provide() {
|
||||
const invitesService = require('../services/invitesService');
|
||||
const nostrService = require('../services/nostrService');
|
||||
const loginService = require('../services/loginService');
|
||||
const sessionService = require('../services/sessionService');
|
||||
const profileService = require('../services/profileService');
|
||||
const OfferServiceProvider = require('../services/offerService');
|
||||
const offerService = new OfferServiceProvider().provide();
|
||||
|
||||
return {
|
||||
invitesService,
|
||||
nostrService,
|
||||
|
|
@ -13,11 +21,4 @@ class ServicesProvider {
|
|||
}
|
||||
}
|
||||
|
||||
const invitesService = require('../services/invitesService');
|
||||
const nostrService = require('../services/nostrService');
|
||||
const loginService = require('../services/loginService');
|
||||
const sessionService = require('../services/sessionService');
|
||||
const profileService = require('../services/profileService');
|
||||
const offerService = require('../services/offerService');
|
||||
|
||||
module.exports = ServicesProvider;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ const models = require('../models');
|
|||
|
||||
const errors = require('../errors');
|
||||
|
||||
class OfferServiceProvider {
|
||||
provide() {
|
||||
async function createOffer(publicKey, offerDetails) {
|
||||
const offerCreated = await models.OfferCreated.create({
|
||||
uuid: uuid.v7(),
|
||||
|
|
@ -20,7 +22,8 @@ async function createOffer(publicKey, offerDetails) {
|
|||
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_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,
|
||||
|
|
@ -94,4 +97,9 @@ async function getOffersByPublicKey(publicKey) {
|
|||
|
||||
return offersToReturn;
|
||||
}
|
||||
module.exports = { createOffer, getOffersByPublicKey, deleteOffer };
|
||||
|
||||
return { createOffer, getOffersByPublicKey, deleteOffer };
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = OfferServiceProvider;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue