1.0.6 • Published 3 years ago

mongoose-home-management v1.0.6

Weekly downloads
12
License
ISC
Repository
-
Last release
3 years ago

��# mongoose-home-management

mongoose-home-management provides mongoose models for managing a home like structure.

  • Homes can have multiple users and a name.
  • Rooms can be linked to one home and also have a name.
  • Devices can be linked to one room and also have a name.

Installation

npm install mongoose-home-management

Usage

For rooms and devices, a similar implementation can be used as found below.

import { IHome, HomeModel } from 'mongoose-user-schema';

//Creating a new home
const createNewHome = async (userId: ObjectID, name: string) => {
    let newHome: IHome = new HomeModel({ userIds: [userId], name: name });
    await newHome.save();
}

//Return all homes
const getHomes = async (): Promise<IHome[]> => {
    return await HomeModel.find({});
}
1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago