docker compose run with .env file

docker compose volumes fix
import fix
add methods and indexes for models
master
Mustafa Yontar 4 years ago
parent 24b5ebc40a
commit 73a5820535
  1. 23
      docker-compose-dev.yaml
  2. 1
      main.py
  3. 15
      models/Account.py
  4. 34
      models/Group.py
  5. 17
      models/Payment.py

@ -3,9 +3,8 @@ version: "3"
services: services:
mongo: mongo:
image: mongo image: mongo
environment: env_file:
MONGO_INITDB_ROOT_USERNAME: xcoder .env
MONGO_INITDB_ROOT_PASSWORD: 4dun4710
volumes: volumes:
- mongo_data:/data/db/ - mongo_data:/data/db/
@ -13,22 +12,22 @@ services:
image: mongo-express image: mongo-express
ports: ports:
- 8081:8081 - 8081:8081
environment: env_file:
ME_CONFIG_MONGODB_ADMINUSERNAME: xcoder .env
ME_CONFIG_MONGODB_ADMINPASSWORD: 4dun4710
ME_CONFIG_OPTIONS_EDITORTHEME: ambiance
ME_CONFIG_BASICAUTH_USERNAME: xcoder
ME_CONFIG_BASICAUTH_PASSWORD: 4dun4710
web: web:
build: . build: .
ports: ports:
- 5000:5000 - 5000:5000
environment: env_file:
ADUNATIO_PRIV_KEY: /code/privkey.pem .env
FLASK_DEBUG: 1
volumes: volumes:
- .:/code - .:/code
volumes: volumes:
mongo_data: mongo_data:
driver_opts:
device: /home/john/PycharmProjects/Adunatio/mongo_data_dir/
type: xfs
o: bind

@ -4,7 +4,6 @@ from flask_jwt_extended import JWTManager, create_access_token
from mongoengine import connect from mongoengine import connect
from werkzeug.security import check_password_hash ,generate_password_hash from werkzeug.security import check_password_hash ,generate_password_hash
from internal_lib.AuthMethots import AuthJWT
from models.Account import Account from models.Account import Account
from models.Group import Group, PaymentGroup from models.Group import Group, PaymentGroup
from models.Payment import Payments from models.Payment import Payments

@ -1,9 +1,24 @@
from mongoengine import * from mongoengine import *
from models.Union import Union from models.Union import Union
from restapi import Methods
class Account(Document): class Account(Document):
meta = {
'index_background': True,
'index_cls': False,
'auto_create_index': True,
'can_query': True,
'with_sub_docs': True,
'methods': [Methods.Get, Methods.List, Methods.Create],
"indexes": [
('bank'),
("-bank"),
("union"),
('union', 'bank', "deleted")
],
}
union = ReferenceField(Union) union = ReferenceField(Union)
bank = StringField() bank = StringField()
number = StringField() number = StringField()

@ -1,18 +1,48 @@
from mongoengine import * from mongoengine import *
from models.Union import Union from models.Union import Union
from restapi import Methods
class Group(Document): class Group(Document):
meta = {
'index_background': True,
'index_cls': False,
'auto_create_index': True,
'can_query': True,
'with_sub_docs': True,
'methods': [Methods.Get, Methods.List, Methods.Create],
"indexes": [
('name'),
("-name"),
("union","deleted"),
("union","deleted","name"),
],
}
union = ReferenceField(Union) union = ReferenceField(Union)
name = StringField(required=True) name = StringField(required=True)
rights = ListField(StringField(),required=True) rights = ListField(StringField(), required=True)
deleted = BooleanField(default=False) deleted = BooleanField(default=False)
def __unicode__(self): def __unicode__(self):
return "{} {}".format(self.union.name,self.name) return "{} {}".format(self.union.name, self.name)
class PaymentGroup(Document): class PaymentGroup(Document):
meta = {
'index_background': True,
'index_cls': False,
'auto_create_index': True,
'can_query': True,
'with_sub_docs': True,
'methods': [Methods.Get, Methods.List, Methods.Create],
"indexes": [
('name'),
("-name"),
("union"),
('union','name',"deleted")
],
}
union = ReferenceField(Union) union = ReferenceField(Union)
name = StringField(required=True) name = StringField(required=True)
deleted = BooleanField(default=False) deleted = BooleanField(default=False)

@ -4,9 +4,26 @@ from models.Account import Account
from models.File import File from models.File import File
from models.Union import Union from models.Union import Union
from models.User import User from models.User import User
from restapi import Methods
class Payments(Document): class Payments(Document):
meta = {
'index_background': True,
'index_cls': False,
'auto_create_index': True,
'can_query': True,
'with_sub_docs': True,
'methods': [Methods.Get, Methods.List, Methods.Create],
"indexes": [
("union","deleted"),
("union","deleted","account"),
('user',"union"),
('user',"union","deleted"),
('union', "user","income","deleted"),
('union', "user","deleted")
],
}
""" """
all payments income and outcome together! all payments income and outcome together!
""" """

Loading…
Cancel
Save