refactor user accounts structure
This commit is contained in:
@@ -14,15 +14,16 @@ export class GoodsService {
|
||||
base_sale_price: true,
|
||||
is_default_guild_good: true,
|
||||
local_sku: true,
|
||||
guild_id: true,
|
||||
} as GoodOmit
|
||||
|
||||
async findAll(guildId: string) {
|
||||
const [goods, count] = await this.prisma.$transaction([
|
||||
this.prisma.good.findMany({
|
||||
where: {
|
||||
guild_id: guildId,
|
||||
is_default_guild_good: true,
|
||||
category: {
|
||||
guild_id: guildId,
|
||||
},
|
||||
},
|
||||
include: {
|
||||
category: {
|
||||
@@ -44,9 +45,11 @@ export class GoodsService {
|
||||
async findOne(guild_id: string, id: string) {
|
||||
const good = await this.prisma.good.findUnique({
|
||||
where: {
|
||||
guild_id,
|
||||
id,
|
||||
is_default_guild_good: true,
|
||||
category: {
|
||||
guild_id,
|
||||
},
|
||||
},
|
||||
|
||||
include: {
|
||||
@@ -69,11 +72,6 @@ export class GoodsService {
|
||||
|
||||
const good = await this.prisma.good.create({
|
||||
data: {
|
||||
guild: {
|
||||
connect: {
|
||||
id: guild_id,
|
||||
},
|
||||
},
|
||||
category: {
|
||||
connect: {
|
||||
id: category_id,
|
||||
|
||||
Reference in New Issue
Block a user