Skip to content

Commit

Permalink
Use @build5/database in functions
Browse files Browse the repository at this point in the history
Fixes
  • Loading branch information
Boldizsar Mezei committed Oct 22, 2023
1 parent 9ac60fc commit 57533ea
Show file tree
Hide file tree
Showing 401 changed files with 393 additions and 915 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
"packages/functions"
],
"scripts": {
"build:functions": "npm run build:interfaces && npm i --workspace=packages/functions && npm run build --workspace=packages/functions",
"build:functions": "npm run build:database && npm i --workspace=packages/functions && npm run build --workspace=packages/functions",
"build:interfaces": "npm i --workspace=packages/interfaces && npm run build --workspace=packages/interfaces",
"build:lib": "npm run build:interfaces && npm i --workspace=packages/lib && npm run build --workspace=packages/lib",
"build:indexes": "npm i --workspace=packages/indexes && npm run build --workspace=packages/indexes",
"build:database": "npm run build:interfaces && npm i --workspace=packages/database && npm run build --workspace=packages/database",
"build:api": "npm run build:interfaces && npm run build:database && npm i --workspace=packages/api && npm run build --workspace=packages/api",
"build:api": "npm run build:database && npm i --workspace=packages/api && npm run build --workspace=packages/api",
"build": "npm i --workspaces && npm run build --workspaces",
"clean:api": "rm -rf packages/api/lib; rm -rf packages/api/node_modules",
"clean:database": "rm -rf packages/database/lib; rm -rf packages/database/node_modules",
Expand Down
1 change: 1 addition & 0 deletions packages/functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
},
"dependencies": {
"@build-5/interfaces": "*",
"@build-5/database": "*",
"@ffmpeg-installer/ffmpeg": "1.1.0",
"@ffprobe-installer/ffprobe": "2.0.0",
"@iota/sdk": "1.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/functions/src/controls/address/address.control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
Network,
WenError,
} from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import { build5Db } from '@build-5/database';
import { createAddressValidationOrder } from '../../services/payment/tangle-service/address/address-validation.service';
import { invalidArgument } from '../../utils/error.utils';
import { Context } from '../common';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { build5Db } from '@build-5/database';
import {
ApiError,
AwardApproveParticipantRequest,
AwardApproveParticipantResponse,
Transaction,
} from '@build-5/interfaces';
import { get } from 'lodash';
import { build5Db } from '../../firebase/firestore/build5Db';
import { approveAwardParticipant } from '../../services/payment/tangle-service/award/award.approve.participant.service';
import { Context } from '../common';

Expand Down
2 changes: 1 addition & 1 deletion packages/functions/src/controls/award/award.cancel.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { build5Db } from '@build-5/database';
import { Award, AwardCancelRequest, COL, WenError } from '@build-5/interfaces';
import dayjs from 'dayjs';
import { build5Db } from '../../firebase/firestore/build5Db';
import { invalidArgument } from '../../utils/error.utils';
import { assertIsGuardian } from '../../utils/token.utils';
import { Context } from '../common';
Expand Down
2 changes: 1 addition & 1 deletion packages/functions/src/controls/award/award.create.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { build5Db } from '@build-5/database';
import { Award, AwardCreateRequest, COL, SUB_COL } from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import { createAward } from '../../services/payment/tangle-service/award/award.create.service';
import { Context } from '../common';

Expand Down
2 changes: 1 addition & 1 deletion packages/functions/src/controls/award/award.fund.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { build5Db } from '@build-5/database';
import { AwardFundRequest, COL, Transaction } from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import {
createAwardFundOrder,
getAwardForFunding,
Expand Down
2 changes: 1 addition & 1 deletion packages/functions/src/controls/award/award.owner.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { build5Db } from '@build-5/database';
import {
Award,
AwardAddOwnerRequest,
Expand All @@ -7,7 +8,6 @@ import {
WenError,
} from '@build-5/interfaces';
import dayjs from 'dayjs';
import { build5Db } from '../../firebase/firestore/build5Db';
import { dateToTimestamp } from '../../utils/dateTime.utils';
import { invalidArgument } from '../../utils/error.utils';
import { Context } from '../common';
Expand Down
2 changes: 1 addition & 1 deletion packages/functions/src/controls/award/award.participate.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { build5Db } from '@build-5/database';
import {
Award,
AwardParticipant,
Expand All @@ -7,7 +8,6 @@ import {
WenError,
} from '@build-5/interfaces';
import dayjs from 'dayjs';
import { build5Db } from '../../firebase/firestore/build5Db';
import { dateToTimestamp } from '../../utils/dateTime.utils';
import { invalidArgument } from '../../utils/error.utils';
import { Context } from '../common';
Expand Down
2 changes: 1 addition & 1 deletion packages/functions/src/controls/award/award.reject.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { build5Db } from '@build-5/database';
import { Award, AwardRejectRequest, COL, WenError } from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import { invalidArgument } from '../../utils/error.utils';
import { assertIsGuardian } from '../../utils/token.utils';
import { Context } from '../common';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { build5Db, getSnapshot } from '@build-5/database';
import {
COL,
Collection,
Expand All @@ -19,7 +20,6 @@ import {
import { Ed25519Address } from '@iota/sdk';
import dayjs from 'dayjs';
import { last } from 'lodash';
import { build5Db, getSnapshot } from '../../firebase/firestore/build5Db';
import { Wallet } from '../../services/wallet/wallet';
import { AddressDetails, WalletService } from '../../services/wallet/wallet.service';
import { assertMemberHasValidAddress, assertSpaceHasValidAddress } from '../../utils/address.utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { build5Db } from '@build-5/database';
import { ApproveCollectionRequest, COL, Collection, WenError } from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import { invalidArgument } from '../../utils/error.utils';
import { assertIsGuardian } from '../../utils/token.utils';
import { Context } from '../common';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { build5Db } from '@build-5/database';
import {
COL,
Collection,
Expand All @@ -12,7 +13,6 @@ import {
SUB_COL,
WenError,
} from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import { hasStakedSoonTokens } from '../../services/stake.service';
import { assertSpaceHasValidAddress } from '../../utils/address.utils';
import { dateToTimestamp, serverTime } from '../../utils/dateTime.utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { build5Db } from '@build-5/database';
import { COL, Collection, RejectCollectionRequest, WenError } from '@build-5/interfaces';
import dayjs from 'dayjs';
import { build5Db } from '../../firebase/firestore/build5Db';
import { invalidArgument } from '../../utils/error.utils';
import { assertIsGuardian } from '../../utils/token.utils';
import { Context } from '../common';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { build5Db, getSnapshot } from '@build-5/database';
import {
COL,
Collection,
Expand All @@ -11,7 +12,6 @@ import {
} from '@build-5/interfaces';
import dayjs from 'dayjs';
import { isEmpty, last, set } from 'lodash';
import { build5Db, getSnapshot } from '../../firebase/firestore/build5Db';
import { dateToTimestamp } from '../../utils/dateTime.utils';
import { invalidArgument } from '../../utils/error.utils';
import { assertValidationAsync } from '../../utils/schema.utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { build5Db } from '@build-5/database';
import {
COL,
CreditUnrefundableRequest,
Expand All @@ -11,7 +12,6 @@ import {
WenError,
} from '@build-5/interfaces';
import dayjs from 'dayjs';
import { build5Db } from '../../firebase/firestore/build5Db';
import { WalletService } from '../../services/wallet/wallet.service';
import { dateToTimestamp } from '../../utils/dateTime.utils';
import { invalidArgument } from '../../utils/error.utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import fs from 'fs';
import mime from 'mime-types';
import os from 'os';
import path from 'path';
import { build5Storage } from '../../firebase/storage/build5Storage';
import { build5Storage } from '@build-5/database';
import { getBucket } from '../../utils/config.utils';
import { invalidArgument } from '../../utils/error.utils';
import { assertValidationAsync } from '../../utils/schema.utils';
Expand Down
2 changes: 1 addition & 1 deletion packages/functions/src/controls/member/member.create.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { build5Db } from '@build-5/database';
import { COL, Member } from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import { getRandomNonce } from '../../utils/wallet.utils';
import { Context } from '../common';

Expand Down
2 changes: 1 addition & 1 deletion packages/functions/src/controls/member/member.update.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { build5Db } from '@build-5/database';
import {
COL,
Member,
Expand All @@ -7,7 +8,6 @@ import {
NftStatus,
WenError,
} from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import { invalidArgument } from '../../utils/error.utils';
import { cleanupParams } from '../../utils/schema.utils';
import { Context } from '../common';
Expand Down
2 changes: 1 addition & 1 deletion packages/functions/src/controls/nft/nft.bid.control.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { build5Db } from '@build-5/database';
import { COL, NftBidRequest, Transaction, WenError } from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import { createNftBidOrder } from '../../services/payment/tangle-service/nft/nft-bid.service';
import { invalidArgument } from '../../utils/error.utils';
import { Context } from '../common';
Expand Down
2 changes: 1 addition & 1 deletion packages/functions/src/controls/nft/nft.create.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { build5Db } from '@build-5/database';
import {
COL,
Collection,
Expand All @@ -11,7 +12,6 @@ import {
} from '@build-5/interfaces';
import dayjs from 'dayjs';
import { isEmpty } from 'lodash';
import { build5Db } from '../../firebase/firestore/build5Db';
import { dateToTimestamp } from '../../utils/dateTime.utils';
import { invalidArgument } from '../../utils/error.utils';
import { getRandomEthAddress } from '../../utils/wallet.utils';
Expand Down
2 changes: 1 addition & 1 deletion packages/functions/src/controls/nft/nft.deposit.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { build5Db } from '@build-5/database';
import {
COL,
Network,
Expand All @@ -9,7 +10,6 @@ import {
TransactionValidationType,
} from '@build-5/interfaces';
import dayjs from 'dayjs';
import { build5Db } from '../../firebase/firestore/build5Db';
import { WalletService } from '../../services/wallet/wallet.service';
import { dateToTimestamp } from '../../utils/dateTime.utils';
import { getRandomEthAddress } from '../../utils/wallet.utils';
Expand Down
2 changes: 1 addition & 1 deletion packages/functions/src/controls/nft/nft.puchase.control.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { build5Db } from '@build-5/database';
import { COL, NftPurchaseRequest, Transaction } from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import { createNftPuchaseOrder } from '../../services/payment/tangle-service/nft/nft-purchase.service';
import { Context } from '../common';

Expand Down
2 changes: 1 addition & 1 deletion packages/functions/src/controls/nft/nft.set.for.sale.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { build5Db } from '@build-5/database';
import { COL, Member, Nft, NftSetForSaleRequest, WenError } from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import { getNftSetForSaleParams } from '../../services/payment/tangle-service/nft/nft-set-for-sale.service';
import { invalidArgument } from '../../utils/error.utils';
import { Context } from '../common';
Expand Down
2 changes: 1 addition & 1 deletion packages/functions/src/controls/nft/nft.stake.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { build5Db } from '@build-5/database';
import { COL, Network, NftStakeRequest, StakeType, Transaction } from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import { createNftStakeOrder } from '../../services/payment/nft/nft-stake-service';
import { Context } from '../common';

Expand Down
2 changes: 1 addition & 1 deletion packages/functions/src/controls/nft/nft.update.unsold.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { build5Db } from '@build-5/database';
import { COL, Nft, NftUpdateUnsoldRequest, WenError } from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import { invalidArgument } from '../../utils/error.utils';
import { assertIsGuardian } from '../../utils/token.utils';
import { Context } from '../common';
Expand Down
2 changes: 1 addition & 1 deletion packages/functions/src/controls/nft/nft.withdraw.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { build5Db } from '@build-5/database';
import {
COL,
Collection,
Expand All @@ -8,7 +9,6 @@ import {
NftWithdrawRequest,
WenError,
} from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import { createNftWithdrawOrder } from '../../services/payment/tangle-service/nft/nft-purchase.service';
import { assertMemberHasValidAddress, getAddress } from '../../utils/address.utils';
import { invalidArgument } from '../../utils/error.utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { build5Db } from '@build-5/database';
import { ApproveProposalRequest, COL, Proposal, RejectProposalRequest } from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import { getProposalApprovalData } from '../../services/payment/tangle-service/proposal/ProposalApporvalService';
import { Context } from '../common';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { build5Db } from '@build-5/database';
import { COL, Proposal, ProposalCreateRequest, SUB_COL } from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import { createProposal } from '../../services/payment/tangle-service/proposal/ProposalCreateService';
import { Context } from '../common';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { build5Db } from '@build-5/database';
import {
COL,
ProposalType,
Expand All @@ -7,7 +8,6 @@ import {
Transaction,
WenError,
} from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import {
getProposal,
getProposalMember,
Expand Down
2 changes: 1 addition & 1 deletion packages/functions/src/controls/rank/rank.control.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { build5Db } from '@build-5/database';
import { COL, Collection, Rank, RankRequest, SUB_COL, Token, WenError } from '@build-5/interfaces';
import { set } from 'lodash';
import { build5Db } from '../../firebase/firestore/build5Db';
import { hasStakedSoonTokens } from '../../services/stake.service';
import { getRankingSpace } from '../../utils/config.utils';
import { invalidArgument } from '../../utils/error.utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { build5Db } from '@build-5/database';
import { COL, SpaceMember, SpaceMemberUpsertRequest, SUB_COL } from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import { acceptSpaceMember } from '../../services/payment/tangle-service/space/SpaceAcceptMemberService';
import { Context } from '../common';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { build5Db } from '@build-5/database';
import { COL, SpaceMember, SpaceMemberUpsertRequest, SUB_COL } from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import { getBlockMemberUpdateData } from '../../services/payment/tangle-service/space/SpaceBlockMemberService';
import { Context } from '../common';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { build5Db } from '@build-5/database';
import { COL, SUB_COL, SpaceMemberUpsertRequest } from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import { assertIsGuardian } from '../../utils/token.utils';
import { Context } from '../common';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { build5Db } from '@build-5/database';
import { COL, SUB_COL, SpaceLeaveRequest } from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import { getLeaveSpaceData } from '../../services/payment/tangle-service/space/SpaceLeaveService';
import { Context } from '../common';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { build5Db } from '@build-5/database';
import { COL, SUB_COL, SpaceMemberUpsertRequest } from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import { assertIsGuardian } from '../../utils/token.utils';
import { Context } from '../common';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { build5Db } from '@build-5/database';
import {
COL,
Collection,
Expand All @@ -11,7 +12,6 @@ import {
WenError,
} from '@build-5/interfaces';
import dayjs from 'dayjs';
import { build5Db } from '../../firebase/firestore/build5Db';
import { WalletService } from '../../services/wallet/wallet.service';
import { generateRandomAmount } from '../../utils/common.utils';
import { dateToTimestamp } from '../../utils/dateTime.utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { build5Db } from '@build-5/database';
import { COL, SUB_COL, Space, SpaceCreateRequest } from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import { getCreateSpaceData } from '../../services/payment/tangle-service/space/SpaceCreateService';
import { Context } from '../common';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { build5Db } from '@build-5/database';
import {
COL,
Proposal,
ProposalType,
SUB_COL,
SpaceMemberUpsertRequest,
} from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import { addRemoveGuardian } from '../../services/payment/tangle-service/space/SpaceGuardianService';
import { Context } from '../common';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { build5Db } from '@build-5/database';
import { COL, Space, SpaceJoinRequest, SUB_COL, WenError } from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import { getJoinSpaceData } from '../../services/payment/tangle-service/space/SpaceJoinService';
import { invalidArgument } from '../../utils/error.utils';
import { Context } from '../common';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { build5Db } from '@build-5/database';
import {
BaseProposalAnswerValue,
COL,
Expand All @@ -17,7 +18,6 @@ import {
} from '@build-5/interfaces';
import dayjs from 'dayjs';
import { get, startCase } from 'lodash';
import { build5Db } from '../../firebase/firestore/build5Db';
import { dateToTimestamp } from '../../utils/dateTime.utils';
import { invalidArgument } from '../../utils/error.utils';
import { cleanupParams } from '../../utils/schema.utils';
Expand Down
2 changes: 1 addition & 1 deletion packages/functions/src/controls/stake/stake.deposit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { build5Db } from '@build-5/database';
import { COL, StakeType, TokenStakeRequest } from '@build-5/interfaces';
import { build5Db } from '../../firebase/firestore/build5Db';
import { createStakeOrder } from '../../services/payment/tangle-service/token/stake.service';
import { Context } from '../common';

Expand Down
Loading

0 comments on commit 57533ea

Please sign in to comment.