Skip to content

Conversation

@horlami228
Copy link
Contributor

create and list an item

quantityAvailable: { type: Number, required: true },
currency: { type: String, required: true },
exchange: { type: String, required: true },
marketId: { type: mongo.Schema.Types.ObjectId, required: true, ref: 'MarketStock' },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ref MarketStock?

sellerId: z.string().optional(),
})
)
.input(getQueryInput(MarketListingsInput))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer to keep it inline

console.log('Market.Service.updateMarketListing', input);

const updatedListing = await ctx.app.model.MarketListing.findByIdAndUpdate(input.listingId, input.data, {
const updatedListing = await ctx.app.model.MarketListing.findByIdAndUpdate(input.where.id.equals, input.data, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the helper

.use(hasRole('user', t))
.use(customErrorFormatter(t))
.input(z.object({ listingId: z.string() }))
.input(getQueryInput(z.object({ listingId: z.string() })))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.input(getQueryInput(MarketListing.partial()))

console.log('Market.Service.deleteMarketListing', input);

const deletedListing = await ctx.app.model.MarketListing.findByIdAndDelete(input.listingId).lean().exec();
const deletedListing = await ctx.app.model.MarketListing.findByIdAndDelete(input.where.id.quals).lean().exec();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

exchange: z.string(),
sellerId: ObjectId,
marketId: ObjectId,
category: z.enum(['Stock', 'ChainToken']),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need a new category to support game items, right?

sellerId: { type: mongo.Schema.Types.ObjectId, required: true, ref: 'MarketInvestor' },
quantityAvailable: { type: Number, required: true },
sellerId: { type: mongo.Schema.Types.ObjectId, required: true, ref: 'Profile' },
quantity: { type: Number, required: true },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default 1 seems fine

sellerId: { type: mongo.Schema.Types.ObjectId, required: true, ref: 'Profile' },
quantity: { type: Number, required: true },
currency: { type: String, required: true },
exchange: { type: String, required: true },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MarketExchange is a model, so why is this a string? I forgot tbh, but it doesn't make sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants