File

src/shared/custodial/internalCustodial.service.ts

Index

Methods

Constructor

constructor(custodialModel: Model<CustodialDocument>)
Parameters :
Name Type Optional
custodialModel Model<CustodialDocument> No

Methods

Async create
create(createCustodial: Custodial)
Parameters :
Name Type Optional
createCustodial Custodial No
Async findOne
findOne(address: string)
Parameters :
Name Type Optional
address string No
import { Injectable } from "@nestjs/common";
import { InjectModel } from "@nestjs/mongoose";
import { Model } from "mongoose";
import { Custodial } from "./entities/custodial.entity";
import { CustodialDocument } from "./schemas/custodial.schema";

@Injectable()
export class InternalCustodialService {
  constructor(
    @InjectModel(Custodial.name)
    private readonly custodialModel: Model<CustodialDocument>,
  ) {}
  async create(createCustodial: Custodial): Promise<CustodialDocument> {
    const custodial = new this.custodialModel({
      ...createCustodial,
    });
    return custodial.save();
  }
  async findOne(address: string): Promise<CustodialDocument> {
    return this.custodialModel.findOne({ address });
  }
}

results matching ""

    No results matching ""