Skip to content

Commit a3deda6

Browse files
committed
feat(typesync): comment out project specific fields for task and group
1 parent 75a2dda commit a3deda6

File tree

4 files changed

+77
-71
lines changed

4 files changed

+77
-71
lines changed

functions/definition/models.yaml

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -349,71 +349,78 @@ FbProjectValidateImageCreateOnlyInput:
349349

350350
# MAPPING
351351

352-
FbMappingGroup:
352+
FbMappingGroupReadonlyType:
353353
model: alias
354-
# model: document
355-
# path: groups/{projectId}/{groupId}
356-
docs: Represents a group in a mapswipe project
354+
docs: Represents fields that cannot be updated from backend
357355
type:
358356
type: object
359357
fields:
360358
# Initially zero
361359
finishedCount:
362360
type: int
363-
# ex: g101
364-
groupId:
365-
type: string
366-
numberOfTasks:
367-
type: int
368361
# NOTE: Initially zero
369362
progress:
370363
type: int
364+
365+
FbMappingGroupCreateOnlyInput:
366+
model: alias
367+
# model: document
368+
# path: groups/{projectId}/{groupId}
369+
docs: Represents a group in a mapswipe project
370+
type:
371+
type: object
372+
fields:
373+
# ex: g101
374+
groupId:
375+
type: string
371376
projectId:
372377
type: string
378+
numberOfTasks:
379+
type: int
373380
requiredCount:
374381
type: int
375382
# PROJECT SPECIFIC FIELDS
376-
xMax:
377-
type: int
378-
optional: true
379-
xMin:
380-
type: int
381-
optional: true
382-
yMax:
383-
type: int
384-
optional: true
385-
yMin:
386-
type: int
387-
optional: true
388-
389-
FbMappingTask:
383+
# xMax:
384+
# type: int
385+
# optional: true
386+
# xMin:
387+
# type: int
388+
# optional: true
389+
# yMax:
390+
# type: int
391+
# optional: true
392+
# yMin:
393+
# type: int
394+
# optional: true
395+
396+
FbMappingTaskCreateOnlyInput:
390397
model: alias
391398
# model: document
392399
# path: tasks/{projectId}/{groupId}/{index}
393400
docs: Repesents a task in a group in a project
394401
type:
395402
type: object
396403
fields:
397-
groupId:
398-
type: string
399404
projectId:
400405
type: string
406+
groupId:
407+
type: string
401408
taskId:
402409
type: string # NOTE: int for street
403410
# For find, completeness, compare
404-
taskX:
405-
type: int # NOTE: this was string previously
406-
optional: true
407-
taskY:
408-
type: int # NOTE: this was string previously
409-
optional: true
410-
url:
411-
type: string
412-
optional: true
413-
# For compare
414-
urlB:
415-
type: string
416-
optional: true
411+
# taskX:
412+
# type: int # NOTE: this was string previously
413+
# optional: true
414+
# taskY:
415+
# type: int # NOTE: this was string previously
416+
# optional: true
417+
# url:
418+
# type: string
419+
# optional: true
420+
# # For compare
421+
# urlB:
422+
# type: string
423+
# optional: true
417424

418425
FbMappingResult:
419426
model: alias

functions/generated/pyfirebase/pyfirebase_mapswipe/extended_models.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
import typing
1+
from pydantic import BaseModel
22

33
from . import models
44

55

6+
class FbEmptyModel(BaseModel): ...
7+
8+
69
class FbProject(
710
models.FbProjectCreateOnlyInput,
811
models.FbProjectUpdateInput,
@@ -12,3 +15,13 @@ class Config: # type: ignore[reportIncompatibleVariableOverride]
1215
use_enum_values = True
1316
frozen = True
1417
extra = "forbid"
18+
19+
20+
class FbMappingGroup(
21+
models.FbMappingGroupCreateOnlyInput,
22+
models.FbMappingGroupReadonlyType,
23+
):
24+
class Config: # type: ignore[reportIncompatibleVariableOverride]
25+
use_enum_values = True
26+
frozen = True
27+
extra = "forbid"

functions/generated/pyfirebase/pyfirebase_mapswipe/models.py

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -95,32 +95,30 @@ class FbEnumValidateInputType(enum.Enum):
9595
LINK = "link"
9696
TMID = "TMId"
9797

98-
class FbMappingGroup(TypesyncModel):
98+
class FbMappingGroupCreateOnlyInput(TypesyncModel):
9999
"""Represents a group in a mapswipe project"""
100-
finishedCount: int
101100
groupId: str
102-
numberOfTasks: int
103-
progress: int
104101
projectId: str
102+
numberOfTasks: int
105103
requiredCount: int
106-
xMax: typing.Union[TypesyncUndefined, int] = UNDEFINED
107-
xMin: typing.Union[TypesyncUndefined, int] = UNDEFINED
108-
yMax: typing.Union[TypesyncUndefined, int] = UNDEFINED
109-
yMin: typing.Union[TypesyncUndefined, int] = UNDEFINED
110104

111105
class Config:
112106
use_enum_values = True
113107
extra = 'forbid'
114108

115109
def __setattr__(self, name: str, value: typing.Any) -> None:
116-
if name == "xMax" and value is None:
117-
raise ValueError("'xMax' field cannot be set to None")
118-
if name == "xMin" and value is None:
119-
raise ValueError("'xMin' field cannot be set to None")
120-
if name == "yMax" and value is None:
121-
raise ValueError("'yMax' field cannot be set to None")
122-
if name == "yMin" and value is None:
123-
raise ValueError("'yMin' field cannot be set to None")
110+
super().__setattr__(name, value)
111+
112+
class FbMappingGroupReadonlyType(TypesyncModel):
113+
"""Represents fields that cannot be updated from backend"""
114+
finishedCount: int
115+
progress: int
116+
117+
class Config:
118+
use_enum_values = True
119+
extra = 'forbid'
120+
121+
def __setattr__(self, name: str, value: typing.Any) -> None:
124122
super().__setattr__(name, value)
125123

126124
class FbMappingResult(TypesyncModel):
@@ -143,29 +141,17 @@ def __setattr__(self, name: str, value: typing.Any) -> None:
143141
raise ValueError("'usergroups' field cannot be set to None")
144142
super().__setattr__(name, value)
145143

146-
class FbMappingTask(TypesyncModel):
144+
class FbMappingTaskCreateOnlyInput(TypesyncModel):
147145
"""Repesents a task in a group in a project"""
148-
groupId: str
149146
projectId: str
147+
groupId: str
150148
taskId: str
151-
taskX: typing.Union[TypesyncUndefined, int] = UNDEFINED
152-
taskY: typing.Union[TypesyncUndefined, int] = UNDEFINED
153-
url: typing.Union[TypesyncUndefined, str] = UNDEFINED
154-
urlB: typing.Union[TypesyncUndefined, str] = UNDEFINED
155149

156150
class Config:
157151
use_enum_values = True
158152
extra = 'forbid'
159153

160154
def __setattr__(self, name: str, value: typing.Any) -> None:
161-
if name == "taskX" and value is None:
162-
raise ValueError("'taskX' field cannot be set to None")
163-
if name == "taskY" and value is None:
164-
raise ValueError("'taskY' field cannot be set to None")
165-
if name == "url" and value is None:
166-
raise ValueError("'url' field cannot be set to None")
167-
if name == "urlB" and value is None:
168-
raise ValueError("'urlB' field cannot be set to None")
169155
super().__setattr__(name, value)
170156

171157
class FbObjCustomOption(TypesyncModel):

functions/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
"typesync-cli": "^0.13.0"
4141
},
4242
"engines": {
43-
"node": "22.16.0",
44-
"yarn": "1.22.22"
43+
"node": "22",
44+
"yarn": "1.22"
4545
},
4646
"private": true
4747
}

0 commit comments

Comments
 (0)