π―
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from ..serialization_types import Btypes | |
| class CreateOrderReq(Btypes): | |
| def __init__(self, user_id: str, items: list): | |
| self.user_id = user_id | |
| self.items = items | |
| class GetOrderReq(Btypes): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from .model import Order | |
| from datetime import datetime | |
| def save_order(order: Order) -> Order: | |
| order.updated_at = datetime.now().isoformat() | |
| Order.orders[order.id] = order | |
| return order | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import uuid | |
| from datetime import datetime | |
| from app.serializers import CreateOrderReq, GetOrderReq, OrderResp | |
| from .model import Order, OrderStatus | |
| from .repository import get_order as query_order | |
| from .repository import save_order | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "net/http" | |
| ) | |
| func HelloServer(w http.ResponseWriter, r *http.Request) { | |
| fmt.Fprintf(w, "Hello World!") | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "net/http" | |
| "time" | |
| "github.com/dgrijalva/jwt-go" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "io/ioutil" | |
| "log" | |
| "net/http" | |
| ) | |
| func HelloServer(w http.ResponseWriter, r *http.Request) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "mappings": { | |
| "dynamic": false, | |
| "fields": { | |
| "body_en": { | |
| "type": "string", | |
| "analyzer": "lucene.standard" | |
| }, | |
| "chapter_en": { | |
| "type": "string", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "$search": { | |
| "compound": { | |
| "must": { | |
| "text": { | |
| "query": "Bangladeshi", | |
| "path": "restaurant_name" | |
| } | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| db[collection].aggregate( | |
| [ | |
| { | |
| "$search": { | |
| "compound": { | |
| "must": [ | |
| { | |
| "text": { | |
| "query": term, | |
| "path": ["body_en", "chapter_en"], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| db[collection].aggregate( | |
| [ | |
| { | |
| "$search": { | |
| "text": { | |
| "query": term, | |
| "path": ["body_en", "chapter_en"], | |
| "fuzzy": {"maxEdits": 1, "maxExpansions": 10}, | |
| }, | |
| "highlight": {"path": ["body_en", "chapter_en"]}, |