from app import mongo


class Medication:
    rel_path = 'medications'

    @classmethod
    def save(cls, data):
        doc = mongo.db[cls.rel_path].find_one(data)
        if doc:
            return mongo.db[cls.rel_path].update_one(doc, {'$set': data})
        return mongo.db[cls.rel_path].insert_one(data)

    @classmethod
    def all(cls):
        return mongo.db[cls.rel_path].find({})

db82fb954e94901c06010ff72b678c49c11436f1
<mask token>


class Medication:
    <mask token>
    <mask token>
    <mask token>

<mask token>


class Medication:
    <mask token>
    <mask token>

    @classmethod
    def all(cls):
        return mongo.db[cls.rel_path].find({})

<mask token>


class Medication:
    <mask token>

    @classmethod
    def save(cls, data):
        doc = mongo.db[cls.rel_path].find_one(data)
        if doc:
            return mongo.db[cls.rel_path].update_one(doc, {'$set': data})
        return mongo.db[cls.rel_path].insert_one(data)

    @classmethod
    def all(cls):
        return mongo.db[cls.rel_path].find({})

<mask token>


class Medication:
    rel_path = 'medications'

    @classmethod
    def save(cls, data):
        doc = mongo.db[cls.rel_path].find_one(data)
        if doc:
            return mongo.db[cls.rel_path].update_one(doc, {'$set': data})
        return mongo.db[cls.rel_path].insert_one(data)

    @classmethod
    def all(cls):
        return mongo.db[cls.rel_path].find({})

from app import mongo


class Medication:
    rel_path = 'medications'

    @classmethod
    def save(cls, data):
        doc = mongo.db[cls.rel_path].find_one(data)
        if doc:
            return mongo.db[cls.rel_path].update_one(doc, {'$set': data})
        return mongo.db[cls.rel_path].insert_one(data)

    @classmethod
    def all(cls):
        return mongo.db[cls.rel_path].find({})
