@prisma/client#BlockTransaction TypeScript Examples
The following examples show how to use
@prisma/client#BlockTransaction.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: blocks-transactions.service.ts From ironfish-api with Mozilla Public License 2.0 | 6 votes |
async find(
blockId: number,
transactionId: number,
): Promise<BlockTransaction | null> {
return this.prisma.blockTransaction.findUnique({
where: {
block_id_transaction_id: {
block_id: blockId,
transaction_id: transactionId,
},
},
});
}
Example #2
Source File: blocks-transactions.service.ts From ironfish-api with Mozilla Public License 2.0 | 6 votes |
async upsert(
prisma: BasePrismaClient,
block: Block,
transaction: Transaction,
): Promise<BlockTransaction> {
return prisma.blockTransaction.upsert({
create: {
block_id: block.id,
transaction_id: transaction.id,
},
update: {
block_id: block.id,
transaction_id: transaction.id,
},
where: {
block_id_transaction_id: {
block_id: block.id,
transaction_id: transaction.id,
},
},
});
}
Example #3
Source File: blocks-transactions.service.ts From ironfish-api with Mozilla Public License 2.0 | 6 votes |
async list(
options: ListBlockTransactionOptions,
): Promise<BlockTransaction[]> {
if (options.blockId) {
return this.prisma.blockTransaction.findMany({
where: {
block_id: options.blockId,
},
});
} else if (options.transactionId) {
return this.prisma.blockTransaction.findMany({
where: {
transaction_id: options.transactionId,
},
});
} else {
throw new UnprocessableEntityException();
}
}