feat(db): Add migrations support to plugins
This commit is contained in:
		
							parent
							
								
									6ae0bdc3d9
								
							
						
					
					
						commit
						e34dc5dd62
					
				| 
						 | 
				
			
			@ -131,7 +131,7 @@ class Plugin:
 | 
			
		|||
 | 
			
		||||
    def notify(self, user, text: str, data=None):
 | 
			
		||||
        """Create a new notification for an user
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        Args:
 | 
			
		||||
            user: `flaschengeist.models.user.User` to notify
 | 
			
		||||
            text: Visibile notification text
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,6 +3,7 @@
 | 
			
		|||
Extends users plugin with balance functions
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
import pathlib
 | 
			
		||||
from flask import Blueprint, current_app
 | 
			
		||||
from werkzeug.local import LocalProxy
 | 
			
		||||
from werkzeug.exceptions import NotFound
 | 
			
		||||
| 
						 | 
				
			
			@ -67,6 +68,8 @@ class BalancePlugin(Plugin):
 | 
			
		|||
        super(BalancePlugin, self).__init__(config)
 | 
			
		||||
        from . import routes
 | 
			
		||||
 | 
			
		||||
        self.migrations_path = (pathlib.Path(__file__).parent / "migrations").resolve()
 | 
			
		||||
 | 
			
		||||
        @plugins_loaded
 | 
			
		||||
        def post_loaded(*args, **kwargs):
 | 
			
		||||
            if config.get("allow_service_debit", False) and "events" in current_app.config["FG_PLUGINS"]:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,6 @@
 | 
			
		|||
"""Pricelist plugin"""
 | 
			
		||||
 | 
			
		||||
import pathlib
 | 
			
		||||
from flask import Blueprint, jsonify, request, current_app
 | 
			
		||||
from werkzeug.local import LocalProxy
 | 
			
		||||
from werkzeug.exceptions import BadRequest, Forbidden, NotFound, Unauthorized
 | 
			
		||||
| 
						 | 
				
			
			@ -24,6 +25,7 @@ class PriceListPlugin(Plugin):
 | 
			
		|||
 | 
			
		||||
    def __init__(self, cfg):
 | 
			
		||||
        super().__init__(cfg)
 | 
			
		||||
        self.migrations_path = (pathlib.Path(__file__).parent / "migrations").resolve()
 | 
			
		||||
        config = {"discount": 0}
 | 
			
		||||
        config.update(cfg)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue