mirror of
				https://github.com/StefBuwalda/dashboard_test.git
				synced 2025-10-31 03:39:58 +00:00 
			
		
		
		
	Add services to db if they don't exist
This commit is contained in:
		
							
								
								
									
										11
									
								
								models.py
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								models.py
									
									
									
									
									
								
							| @@ -1,5 +1,6 @@ | ||||
| from mem import db | ||||
| from datetime import datetime, timezone | ||||
| from validators import url as is_url | ||||
|  | ||||
|  | ||||
| class log(db.Model): | ||||
| @@ -19,5 +20,13 @@ class service(db.Model): | ||||
|     public_access: bool = db.Column(db.Boolean, nullable=False) | ||||
|     ping_method: int = db.Column(db.Integer, nullable=False) | ||||
|  | ||||
|     def __init__(self): | ||||
|     def __init__( | ||||
|         self, url: str, label: str, public_access: bool, ping_method: int | ||||
|     ): | ||||
|         if not is_url(url): | ||||
|             raise Exception("URL IS NOT A VALID URL") | ||||
|         super().__init__() | ||||
|         self.url = url | ||||
|         self.label = label | ||||
|         self.public_access = public_access | ||||
|         self.ping_method = ping_method | ||||
|   | ||||
		Reference in New Issue
	
	Block a user