Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ repos:

# Run the Ruff linter.
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.8
rev: v0.15.4
hooks:
# Linter
- id: ruff
types_or: [python, pyi, jupyter, toml]
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-check
args: [ --fix ]
types_or: [python, pyi, jupyter, pyproject]
# Formatter
- id: ruff-format
types_or: [python, pyi, jupyter, toml]
types_or: [python, pyi, jupyter, pyproject]

- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.403
Expand Down
11 changes: 8 additions & 3 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cd "$FIREBASE_FUNCTIONS_DIR"

cd "$BASE_DIR"

firebase use ${FIREBASE_PROJECT?error}
firebase use "${FIREBASE_PROJECT?error}"

firebase target:apply hosting auth "$FIREBASE_AUTH_SITE"

Expand All @@ -32,6 +32,11 @@ firebase functions:config:set \
osm.client_secret="$OSM_OAUTH_CLIENT_SECRET" \
osm.client_secret_web="$OSM_OAUTH_CLIENT_SECRET_WEB"

firebase deploy --only hosting
if [ "${SKIP_HOSTING:-false}" != "true" ]; then
firebase deploy --only hosting
fi

firebase deploy --only database
firebase deploy --only functions

export FIREBASE_CLI_IMAGE_CLEANUP_DAYS=${FIREBASE_CLI_IMAGE_CLEANUP_DAYS:-30}
firebase deploy --only functions --non-interactive
2 changes: 2 additions & 0 deletions functions/definition/project/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ FbEnumProjectType:
value: 4
- label: 'STREET'
value: 7
- label: 'LOCATE'
value: 9

FbProjectReadonlyType:
model: alias
Expand Down
68 changes: 68 additions & 0 deletions functions/definition/project/project_types/locate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/toggle-corp/typesync/refs/tags/v1.0.0/schema.local.json

FBEnumSubGridSize:
model: alias
type:
type: enum
members:
- label: 'SIZE_2X2'
value: '2x2'
- label: 'SIZE_4X4'
value: '4x4'
- label: 'SIZE_8X8'
value: '8x8'


FbProjectLocateCreateOnlyInput:
model: alias
docs: Represents LOCATE project fields that are valid while creating a project
type:
type: object
fields:
zoomLevel:
type: int
tileServer:
type: FbObjRasterTileServer
subGridSize:
type: FBEnumSubGridSize
customOptions:
optional: true
type:
type: list
elementType: FbObjCustomOption
exportMetaKey:
type: string
exportMetaValue:
type: string


FbProjectLocateMappingResult:
model: alias
docs: Represents LOCATE mapswipe project results
# path: results/{projectId}/{groupId}/{userId}
type:
type: object
fields:
appVersion:
type: string
clientType:
# FIXME: this is an enum
type: string
optional: true
endTime:
type: timestamp
startTime:
type: timestamp
results:
optional: true
type:
type: map
valueType:
type: list
elementType: int
usergroups:
optional: true
type:
# NOTE: The key is usergroupId
type: map
valueType: boolean
25 changes: 25 additions & 0 deletions functions/definition/tutorial/project_types/locate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/toggle-corp/typesync/refs/tags/v1.0.0/schema.local.json

FbLocateTutorial:
model: alias
type:
type: object
fields:
projectType:
type:
type: literal
value: 9
tileServer:
type: FbObjRasterTileServer
subGridSize:
type: FBEnumSubGridSize
zoomLevel:
type: int

FbLocateTutorialTask:
model: alias
type:
type: object
fields:
url:
type: string
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ FbTileMapServiceTutorialTask:
type: string
referenceAnswer:
type: int
taskPartitionIndex:
type: int
optional: true
screen:
type: int
taskId:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,13 @@ class Config: # type: ignore[reportIncompatibleVariableOverride]
use_enum_values = True
frozen = True
extra = "forbid"


class FbLocateTutorialTaskComplete(
models.FbTileMapServiceTutorialTask,
models.FbLocateTutorialTask,
):
class Config: # type: ignore[reportIncompatibleVariableOverride]
use_enum_values = True
frozen = True
extra = "forbid"
83 changes: 83 additions & 0 deletions functions/generated/pyfirebase/pyfirebase_mapswipe/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class FbEnumProjectType(enum.Enum):
COMPARE = 3
COMPLETENESS = 4
STREET = 7
LOCATE = 9


class FbProjectReadonlyType(TypesyncModel):
Expand Down Expand Up @@ -356,6 +357,37 @@ class FbEnumOverlayTileServerType(enum.Enum):
VECTOR = "vector"


class FBEnumSubGridSize(enum.Enum):
SIZE_2X2 = "2x2"
SIZE_4X4 = "4x4"
SIZE_8X8 = "8x8"


class FbProjectLocateMappingResult(TypesyncModel):
"""Represents LOCATE mapswipe project results"""

appVersion: str
clientType: str | TypesyncUndefined | None = UNDEFINED
endTime: datetime.datetime
startTime: datetime.datetime
results: dict[str, list[int]] | TypesyncUndefined | None = UNDEFINED
usergroups: dict[str, bool] | TypesyncUndefined | None = UNDEFINED

class Config:
use_enum_values = False
extra = "forbid"

@typing.override
def __setattr__(self, name: str, value: typing.Any) -> None:
if name == "clientType" and value is None:
raise ValueError("'clientType' field cannot be set to None")
if name == "results" and value is None:
raise ValueError("'results' field cannot be set to None")
if name == "usergroups" and value is None:
raise ValueError("'usergroups' field cannot be set to None")
super().__setattr__(name, value)


class FbProjectStreetCreateOnlyInput(TypesyncModel):
"""Represents STREET project fields that are valid while creating a project"""

Expand Down Expand Up @@ -589,6 +621,27 @@ def __setattr__(self, name: str, value: typing.Any) -> None:
super().__setattr__(name, value)


class FbProjectLocateCreateOnlyInput(TypesyncModel):
"""Represents LOCATE project fields that are valid while creating a project"""

zoomLevel: int
tileServer: FbObjRasterTileServer
subGridSize: FBEnumSubGridSize
customOptions: list[FbObjCustomOption] | TypesyncUndefined | None = UNDEFINED
exportMetaKey: str
exportMetaValue: str

class Config:
use_enum_values = False
extra = "forbid"

@typing.override
def __setattr__(self, name: str, value: typing.Any) -> None:
if name == "customOptions" and value is None:
raise ValueError("'customOptions' field cannot be set to None")
super().__setattr__(name, value)


class FbProjectValidateCreateOnlyInput(TypesyncModel):
"""Represents VALIDATE project fields that are valid while creating a project"""

Expand Down Expand Up @@ -940,6 +993,33 @@ def __setattr__(self, name: str, value: typing.Any) -> None:
super().__setattr__(name, value)


class FbLocateTutorial(TypesyncModel):
projectType: typing.Literal[9]
tileServer: FbObjRasterTileServer
subGridSize: FBEnumSubGridSize
zoomLevel: int

class Config:
use_enum_values = False
extra = "forbid"

@typing.override
def __setattr__(self, name: str, value: typing.Any) -> None:
super().__setattr__(name, value)


class FbLocateTutorialTask(TypesyncModel):
url: str

class Config:
use_enum_values = False
extra = "forbid"

@typing.override
def __setattr__(self, name: str, value: typing.Any) -> None:
super().__setattr__(name, value)


class FbStreetTutorial(TypesyncModel):
projectType: typing.Literal[7]
customOptions: list[FbObjCustomOption] | TypesyncUndefined | None = UNDEFINED
Expand Down Expand Up @@ -992,6 +1072,7 @@ class FbTileMapServiceTutorialTask(TypesyncModel):
groupId: int
projectId: str
referenceAnswer: int
taskPartitionIndex: int | TypesyncUndefined | None = UNDEFINED
screen: int
taskId: str
taskId_real: str
Expand All @@ -1004,6 +1085,8 @@ class Config:

@typing.override
def __setattr__(self, name: str, value: typing.Any) -> None:
if name == "taskPartitionIndex" and value is None:
raise ValueError("'taskPartitionIndex' field cannot be set to None")
super().__setattr__(name, value)


Expand Down
Loading