How to use @lskjs/db - 8 common examples

To help you get started, we’ve selected a few @lskjs/db examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lskjs / lskjs / packages / permit / src / server / models / PermitModel.js View on Github external
export default function PermitModel(ctx) {
  const { db } = ctx;
  const { Schema } = db;
  const schema = new UniversalSchema({
    userId: {
      type: Schema.Types.ObjectId,
      ref: 'User',
      // required: true,
    },
    type: {
      type: String,
      required: true,
    },
    code: { // Код по котором будет искаться в базе
      type: String,
    },
    disabledAt: { // Дата когда пермит перестал быть валидным(досрочный expiredAt)
      type: Date,
    },
    activatedAt: { // Дата активации
github lskjs / lskjs / packages / lsk-modules / packages / auth / src / server / models / Passport / Passport.js View on Github external
export default function getSchema(ctx, module) {
  const mongoose = ctx.db;
  const schema = new MongooseSchema({
    userId: {
      type: mongoose.Schema.Types.ObjectId,
      // ref: 'User',
    },
    // Сырые данные которые пришли из соц сети
    raw: {
      type: Object,
      default: {},
    },
    // Обработанные данные из соцсети
    profile: {
      type: Object, // по идее тут должна быть структура данных
      default: {},
    },
    meta: {
      type: Object,
github lskjs / lskjs / packages / auth / src / server / models / PassportModel.js View on Github external
export default function getSchema(ctx) {
  const authModule = ctx.modules.auth;
  const mongoose = ctx.db;
  const schema = new MongooseSchema({
    userId: {
      type: mongoose.Schema.Types.ObjectId,
      // ref: 'User',
    },
    // Сырые данные которые пришли из соц сети
    raw: {
      type: Object,
      default: {},
    },
    // Обработанные данные из соцсети
    profile: {
      type: Object, // по идее тут должна быть структура данных
      default: {},
    },
    meta: {
      type: Object,
github lskjs / lskjs / packages / auth / src / server / models / UserModel.js View on Github external
export function getSchema(ctx, module) {
  const sample = get(module, 'config.sample', sample2);
  const schema = new MongooseSchema({
    username: {
      type: String,
      // required: true,
      // index: { unique: true },
      tolowercase: true,
      trim: true,
    },
    email: {
      type: String,
      index: {
        unique: true,
        sparse: true,
      },
    },
    password: {
      type: String,
github lskjs / lskjs / packages / mailer / src / models / Email.js View on Github external
export default (ctx, module) => {
  const mongoose = ctx.db;
  const { ObjectId } = mongoose.Schema.Types;
  const schema = new MongooseSchema({
    uid: {
      type: Number,
      required: true,
    },
    threadId: {
      type: ObjectId,
      ref: 'Thread',
      index: true,
    },
    subtype: { // Тип, входящая/исходящая почта
      type: String,
      required: true,
      enum: [
        'i', // входящая почта
        'o', // исходящая почта
      ],
github lskjs / lskjs / packages / lsk-modules / packages / auth / src / server / models / User / User.js View on Github external
export function getSchema(ctx, module) {
  const sample = get(module, 'config.sample', sample2);
  const schema = new MongooseSchema({
    username: {
      type: String,
      // required: true,
      // index: { unique: true },
      tolowercase: true,
      trim: true,
    },
    email: {
      type: String,
      index: {
        unique: true,
        sparse: true,
      },
    },
    password: {
      type: String,
github lskjs / lskjs / packages / worker / src / index.js View on Github external
getDatabase() {
    return this.config.db ? db(this, this.config.db) : null;
  }
  getMongooseModels() {
github lskjs / lskjs / packages / server / src / ServerApp.js View on Github external
getDatabase() {
    return this.config.db ? db(this, this.config.db) : null;
  }
  getErrors() {

@lskjs/db

LSK.js module for working with mongodb database

MIT
Latest version published 6 months ago

Package Health Score

60 / 100
Full package analysis

Popular @lskjs/db functions