Skip to content

Commit

Permalink
Merge pull request #10 from lapig-ufg/email
Browse files Browse the repository at this point in the history
creat_at
  • Loading branch information
jairomr authored Oct 3, 2024
2 parents 37d7296 + e80fc67 commit 634c7f1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/models/payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import List
from app.models.oauth2 import UserInfo
from pydantic_geojson import FeatureModel, FeatureCollectionModel, PolygonModel
from datetime import datetime

class User(BaseModel):
name: str
Expand All @@ -19,6 +20,7 @@ class LapigFeatureCollectionModel(FeatureCollectionModel):

class ResultPayload(BaseModel):
user: User
created_at: datetime = datetime.now(tz=datetime.timezone.utc)
geojson: LapigFeatureCollectionModel
request_user: UserInfo
class PayloadSaveGeojson(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@



@celery.task(name="gee_get_index_pasture",bind=True)
@celery.task(name="Index Pasture GEE",bind=True)
def gee_get_index_pasture(self, payload: ResultPayload):
result = task_index_pasture(self.request.id, payload)
payload_send_mail ={
Expand Down
2 changes: 2 additions & 0 deletions workers/gee.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from workers.utils.gee2chat import get_chat_pasture, get_chat_pasture_vigor
from app.models.payload import ResultPayload
from celery.utils.log import get_task_logger
from datetime import datetime
from pymongo import MongoClient
import ee
import geemap
Expand All @@ -10,6 +11,7 @@
logger = get_task_logger(__name__)

def task_index_pasture(task_id: str, payload: ResultPayload):
payload['created_at'] = datetime.now(tz=datetime.timezone.utc)
geojson = payload.get('geojson')
def gee_credentials(private_key_file):
data = json.load(open(private_key_file))
Expand Down

0 comments on commit 634c7f1

Please sign in to comment.