csc-cia-stne 0.0.88__py3-none-any.whl → 0.0.90__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,215 @@
1
+ from pydantic import BaseModel, field_validator, model_validator
2
+
3
+ class InitParamsValidator(BaseModel):
4
+
5
+ headers: dict
6
+ url: str
7
+
8
+ @field_validator('headers')
9
+ def check_input_dict(cls, value, info):
10
+ if not isinstance(value, dict):
11
+ raise ValueError(f"O parametro 'headers' deve ser um dicionário e não um {type(value)}")
12
+ return value
13
+
14
+ @field_validator('url')
15
+ def check_str_input(cls, value, info):
16
+ if not isinstance(value, str) or not value.strip():
17
+ raise ValueError(f"O parametro 'url' deve ser uma string e não um {type(value)} e não vazio")
18
+ return value
19
+
20
+ class CreateUserValidator(BaseModel):
21
+
22
+ cpf: str
23
+ name: str
24
+ email: str
25
+ empresa: str
26
+ rg: str
27
+
28
+ @field_validator('cpf','name','email','empresa')
29
+ def check_str_input(cls, value, info):
30
+ if not isinstance(value, str) or not value.strip():
31
+ raise ValueError(f"O parametro '{info.field_name}' deve ser uma string e não um {type(value)} e não vazio")
32
+ return value
33
+
34
+ @field_validator('rg')
35
+ def check_rg_input(cls, value, info):
36
+ if not isinstance(value, str) or value is not None:
37
+ raise ValueError(f"O parametro 'rg' deve ser uma string e não um {type(value)}")
38
+ return value
39
+
40
+ class ValidateExistenceValidator(BaseModel):
41
+
42
+ cpf: str
43
+
44
+ @field_validator('cpf')
45
+ def check_str_input(cls, value, info):
46
+ if not isinstance(value, str) or not value.strip():
47
+ raise ValueError(f"O parametro 'cpf' deve ser uma string e não um {type(value)} e não vazio")
48
+ return value
49
+
50
+ class CreateWaccessValidator(BaseModel):
51
+
52
+ name:str
53
+ cpf:str
54
+ empresa:str
55
+ email:str
56
+ rg:str
57
+
58
+ @field_validator('cpf','name','email')
59
+ def check_str_input(cls, value, info):
60
+ if not isinstance(value, str) or not value.strip():
61
+ raise ValueError(f"O parametro '{info.field_name}' deve ser uma string e não um {type(value)} e não vazio")
62
+ return value
63
+
64
+ @field_validator('empresa', 'rg')
65
+ def check_rg_input(cls, value, info):
66
+ if not isinstance(value, str) or value is not None:
67
+ raise ValueError(f"O parametro '{info.field_name}' deve ser uma string e não um {type(value)}")
68
+ return value
69
+
70
+ class UpdateWaccessValidator(BaseModel):
71
+
72
+ name:str
73
+ cpf:str
74
+ empresa:str
75
+ email:str
76
+ rg:str
77
+ foto:str
78
+ status:int
79
+
80
+ @field_validator('cpf','name','email')
81
+ def check_str_input(cls, value, info):
82
+ if not isinstance(value, str) or not value.strip():
83
+ raise ValueError(f"O parametro '{info.field_name}' deve ser uma string e não um {type(value)} e não vazio")
84
+ return value
85
+
86
+ @field_validator('status')
87
+ def check_status_input(cls, value, info):
88
+ if not isinstance(value, int) or value not in [0, 1]:
89
+ raise ValueError(f"O parametro '{info.field_name}' deve ser um inteiro e não um {type(value)} e deve ser 0 ou 1")
90
+ return value
91
+
92
+ @field_validator('empresa', 'rg','foto')
93
+ def check_str_none_input(cls, value, info):
94
+ if not isinstance(value, str) or value is not None:
95
+ raise ValueError(f"O parametro '{info.field_name}' deve ser uma string e não um {type(value)}")
96
+ return value
97
+
98
+ class UpdateUserValidator(BaseModel):
99
+
100
+ name:str
101
+ cpf:str
102
+ empresa:str
103
+ email:str
104
+ rg:str
105
+ status:int
106
+
107
+ @field_validator('cpf','name','email')
108
+ def check_str_input(cls, value, info):
109
+ if not isinstance(value, str) or not value.strip():
110
+ raise ValueError(f"O parametro '{info.field_name}' deve ser uma string e não um {type(value)} e não vazio")
111
+ return value
112
+
113
+ @field_validator('status')
114
+ def check_status_input(cls, value, info):
115
+ if not isinstance(value, int) or value not in [0, 1]:
116
+ raise ValueError(f"O parametro '{info.field_name}' deve ser um inteiro e não um {type(value)} e deve ser 0 ou 1")
117
+ return value
118
+
119
+
120
+ @field_validator('empresa', 'rg')
121
+ def check_rg_input(cls, value, info):
122
+ if not isinstance(value, str) or value is not None:
123
+ raise ValueError(f"O parametro '{info.field_name}' deve ser uma string e não um {type(value)}")
124
+ return value
125
+
126
+ class AddPhotoValidator(BaseModel):
127
+
128
+ foto:str
129
+ chid:str
130
+
131
+ @field_validator('foto','chid')
132
+ def check_str_input(cls, value, info):
133
+ if not isinstance(value, str) or not value.strip():
134
+ raise ValueError(f"O parametro '{info.field_name}' deve ser uma string e não um {type(value)} e não vazio")
135
+ return value
136
+
137
+ class ChangeGroupsUserValidator(BaseModel):
138
+
139
+ groups_list: list[dict]
140
+ cpf: str
141
+
142
+ @field_validator('groups')
143
+ def check_list_input(cls, value, info):
144
+ if not isinstance(value, list):
145
+ raise ValueError(f"O parametro '{info.field_name}' deve ser uma lista de dicts e não um {type(value)}")
146
+ return value
147
+
148
+ @field_validator('cpf')
149
+ def check_str_input(cls, value, info):
150
+ if not isinstance(value, str) or not value.strip():
151
+ raise ValueError(f"O parametro '{info.field_name}' deve ser uma string e não um {type(value)} e não vazio")
152
+ return value
153
+
154
+ class AddCardUserValidator(BaseModel):
155
+
156
+ card: str
157
+ cpf: str
158
+
159
+ @field_validator('card','cpf')
160
+ def check_str_input(cls, value, info):
161
+ if not isinstance(value, str) or not value.strip():
162
+ raise ValueError(f"O parametro '{info.field_name}' deve ser uma string e não um {type(value)} e não vazio")
163
+ return value
164
+
165
+ class GetUserCardsValidator(BaseModel):
166
+
167
+ chid: str
168
+
169
+ @field_validator('chid')
170
+ def check_str_input(cls, value, info):
171
+ if not isinstance(value, str) or not value.strip():
172
+ raise ValueError(f"O parametro '{info.field_name}' deve ser uma string e não um {type(value)} e não vazio")
173
+ return value
174
+
175
+ class CreateCardValidator(BaseModel):
176
+
177
+ card: str
178
+
179
+ @field_validator('card')
180
+ def check_str_input(cls, value, info):
181
+ if not isinstance(value, str) or not value.strip():
182
+ raise ValueError(f"O parametro '{info.field_name}' deve ser uma string e não um {type(value)} e não vazio")
183
+ return value
184
+
185
+ class AssociateCardUserValidator(BaseModel):
186
+
187
+ card: str
188
+ chid: str
189
+
190
+ @field_validator('card','chid')
191
+ def check_str_input(cls, value, info):
192
+ if not isinstance(value, str) or not value.strip():
193
+ raise ValueError(f"O parametro '{info.field_name}' deve ser uma string e não um {type(value)} e não vazio")
194
+ return value
195
+
196
+ class TurnOffUserValidator(BaseModel):
197
+
198
+ cpf: str
199
+
200
+ @field_validator('cpf')
201
+ def check_str_input(cls, value, info):
202
+ if not isinstance(value, str) or not value.strip():
203
+ raise ValueError(f"O parametro '{info.field_name}' deve ser uma string e não um {type(value)} e não vazio")
204
+ return value
205
+
206
+ class RemoveGroupsValidator(BaseModel):
207
+
208
+ chid: str
209
+ cpf: str
210
+
211
+ @field_validator('cpf','chid')
212
+ def check_str_input(cls, value, info):
213
+ if not isinstance(value, str) or not value.strip():
214
+ raise ValueError(f"O parametro '{info.field_name}' deve ser uma string e não um {type(value)} e não vazio")
215
+ return value