Coverage for functions \ flipdare \ generated \ model \ issue \ resolution_comment_model.py: 100%
0 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-05-08 12:22 +1000
« prev ^ index » next coverage.py v7.13.0, created at 2026-05-08 12:22 +1000
1#!/usr/bin/env python
2#
3# Copyright (c) 2026 Flipdare Pty Ltd. All rights reserved.
4#
5# This file is part of Flipdare's proprietary software and contains
6# confidential and copyrighted material. Unauthorised copying,
7# modification, distribution, or use of this file is strictly
8# prohibited without prior written permission from Flipdare Pty Ltd.
9#
10# This software includes third-party components licensed under MIT,
11# BSD, and Apache 2.0 licences. See THIRD_PARTY_NOTICES for details.
12#
13# NOTE: THIS FILE IS AUTO GENERATED. DO NOT EDIT.
14#
15# Generated by codegen_models.py
16#
17# Modify 'codegen_models.py'
18# and re-run the script above to update.
19#
20# pragma: no cover
21from __future__ import annotations
22from datetime import datetime
23from google.cloud.firestore_v1.transforms import Sentinel
24from flipdare.core.firestore_field import FirestoreField
25from flipdare.util.time_util import FirestoreTime
26from typing import Any, TypedDict, cast, Unpack
27from enum import StrEnum
28from pydantic import Field, ConfigDict, TypeAdapter
29from flipdare.firestore.core.app_base_model import AppBaseModel
32class ResolutionCommentKeys(StrEnum):
33 CREATED_AT = "created_at"
34 UPDATED_AT = "updated_at"
35 UID = "uid"
36 IS_ADMIN = "is_admin"
37 MESSAGE = "message"
40# !! IMPORTANT !!
41# !!
42# !! this should only be used in the database to query.
43# !!
44class ResolutionCommentInternalKeys(StrEnum):
45 CREATED_AT = "created_at"
46 UPDATED_AT = "updated_at"
49class ResolutionCommentModel(AppBaseModel):
50 """Represents a resolution comment (stored internall, therefore no id)."""
52 model_config = ConfigDict(populate_by_name=True, arbitrary_types_allowed=True)
54 created_at: FirestoreField = Field(
55 default_factory=cast("Any", lambda: FirestoreTime.server_timestamp())
56 )
57 updated_at: FirestoreField = Field(
58 default_factory=cast("Any", lambda: FirestoreTime.server_timestamp())
59 )
60 uid: str
61 is_admin: bool
62 message: str
64 @classmethod
65 def validate_partial(cls, **data: Unpack[ResolutionCommentDict]) -> dict[str, Any]:
66 """
67 Uses Unpack to give you autocomplete and static warnings
68 if you pass an invalid key or type in your code.
70 Returns a dict with Firestore field names (aliases) for use with batch.update().
71 """
72 result: dict[str, Any] = {}
73 for k, v in data.items():
74 if k in cls.__pydantic_fields__:
75 field_info = cls.__pydantic_fields__[k]
76 validated_value = cast(
77 "Any",
78 TypeAdapter(field_info.annotation).validate_python(v),
79 )
80 # Use alias if defined, otherwise use field name
81 output_key = field_info.alias or k
82 result[output_key] = validated_value
83 return result
86RESOLUTIONCOMMENT_FIELD_NAMES: list[str] = list(ResolutionCommentModel.model_fields.keys())
89class ResolutionCommentDict(TypedDict, total=False):
90 created_at: Sentinel | datetime | str
91 updated_at: Sentinel | datetime | str
92 uid: str
93 is_admin: bool
94 message: str