Skip to content

Commit

Permalink
Pipeline fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurfiorette committed Mar 20, 2021
2 parents a94ff8c + 3868c44 commit de6ce70
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
3 changes: 1 addition & 2 deletions app/src/trading/logic/calculatePrices.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { NextFunction } from '../../util/middleware';
import { OfferContext } from '../types'
import { getAllItemsPrice } from '../../steam/market';
import { ItemPrice } from '../types';
import { AccountOptions } from '../../account/account';
import { ItemPrice,OfferContext } from '../types';

export default async function middleware(context: OfferContext, next: NextFunction) {
const { processor, offer } = context;
Expand Down
5 changes: 3 additions & 2 deletions app/src/trading/logic/checkSides.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { OfferContext, Next } from '../pipeline';
import { NextFunction } from '../../util/middleware';
import { OfferContext } from '../types';

export default function middleware(context: OfferContext, next: Next) {
export default function middleware(context: OfferContext, next: NextFunction) {
const { processor, offer } = context;

if (offer.itemsToReceive.length < 1) {
Expand Down
6 changes: 4 additions & 2 deletions app/src/trading/logic/glitched.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { OfferContext, Next } from '../pipeline';
import { NextFunction } from "../../util/middleware";
import { OfferContext } from "../types";

export default function middleware(context: OfferContext, next: Next) {

export default function middleware(context: OfferContext, next: NextFunction) {
const { processor, offer } = context;

if (offer.isGlitched()) {
Expand Down
6 changes: 4 additions & 2 deletions app/src/trading/logic/isOwner.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { OfferContext, Next } from '../pipeline';
import { NextFunction } from "../../util/middleware";
import { OfferContext } from "../types";

export default function middleware(context: OfferContext, next: Next) {

export default function middleware(context: OfferContext, next: NextFunction) {
const { processor, offer } = context;
const { owners } = processor.account.options.trading;

Expand Down
6 changes: 3 additions & 3 deletions app/src/trading/processor.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Account from '../account/account';
import { Offer } from './types';
import { OfferContext, Pipeline } from './pipeline';
import { Offer, OfferContext } from './types';
import logic from './logic';
import Pipeline from '../util/middleware';

export type Processor = (offer: Offer) => Promise<Offer>;

Expand All @@ -10,7 +10,7 @@ function createContext(offer: Offer, processor: TradeProcessor): OfferContext {
}

export default class TradeProcessor {
private readonly pipeline = new Pipeline(logic);
private readonly pipeline = new Pipeline<OfferContext>(logic);

constructor(readonly account: Account) {}

Expand Down

0 comments on commit de6ce70

Please sign in to comment.