zrb 1.0.0a12__py3-none-any.whl → 1.0.0a13__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.
- zrb/builtin/project/add/fastapp_template/schema/permission.py +31 -0
- zrb/builtin/todo.py +17 -2
- zrb/util/todo.py +2 -2
- {zrb-1.0.0a12.dist-info → zrb-1.0.0a13.dist-info}/METADATA +1 -1
- {zrb-1.0.0a12.dist-info → zrb-1.0.0a13.dist-info}/RECORD +7 -6
- {zrb-1.0.0a12.dist-info → zrb-1.0.0a13.dist-info}/WHEEL +0 -0
- {zrb-1.0.0a12.dist-info → zrb-1.0.0a13.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
import datetime
|
2
|
+
|
3
|
+
import ulid
|
4
|
+
from sqlmodel import Field, SQLModel
|
5
|
+
|
6
|
+
|
7
|
+
class PermissionBase(SQLModel):
|
8
|
+
name: str
|
9
|
+
|
10
|
+
|
11
|
+
class PermissionCreate(PermissionBase):
|
12
|
+
description: str
|
13
|
+
|
14
|
+
|
15
|
+
class PermissionUpdate(SQLModel):
|
16
|
+
name: str | None = None
|
17
|
+
description: str | None = None
|
18
|
+
|
19
|
+
|
20
|
+
class PermissionResponse(PermissionBase):
|
21
|
+
id: str
|
22
|
+
|
23
|
+
|
24
|
+
class Permission(SQLModel, table=True):
|
25
|
+
id: str = Field(default_factory=lambda: ulid.new().str, primary_key=True)
|
26
|
+
created_at: datetime.datetime | None
|
27
|
+
created_by: str | None
|
28
|
+
updated_at: datetime.datetime | None
|
29
|
+
updated_by: str | None
|
30
|
+
name: str
|
31
|
+
description: str
|
zrb/builtin/todo.py
CHANGED
@@ -175,10 +175,12 @@ def archive_todo(ctx: AnyContext):
|
|
175
175
|
archive_file_path = os.path.join(TODO_DIR, "archive.txt")
|
176
176
|
if not os.path.isdir(TODO_DIR):
|
177
177
|
os.make_dirs(TODO_DIR, exist_ok=True)
|
178
|
+
# Get archived todo list
|
178
179
|
archived_todo_list = []
|
179
180
|
if os.path.isfile(archive_file_path):
|
180
181
|
archived_todo_list = load_todo_list(archive_file_path)
|
181
182
|
archived_todo_list += new_archived_todo_list
|
183
|
+
# Save the new todo list and add the archived ones
|
182
184
|
save_todo_list(archive_file_path, archived_todo_list)
|
183
185
|
save_todo_list(todo_file_path, working_todo_list)
|
184
186
|
return get_visual_todo_list(todo_list, TODO_VISUAL_FILTER)
|
@@ -241,9 +243,23 @@ def log_todo(ctx: AnyContext):
|
|
241
243
|
log_work.append(
|
242
244
|
{"log": ctx.input.log, "duration": ctx.input.duration, "start": ctx.input.start}
|
243
245
|
)
|
246
|
+
# save todo with log work
|
244
247
|
with open(log_work_file_path, "w") as f:
|
245
248
|
f.write(json.dumps(log_work, indent=2))
|
246
|
-
|
249
|
+
# get log work list
|
250
|
+
task_id = todo_task.keyval.get("id", "")
|
251
|
+
log_work_path = os.path.join(TODO_DIR, "log-work", f"{task_id}.json")
|
252
|
+
log_work_list = []
|
253
|
+
if os.path.isfile(log_work_path):
|
254
|
+
with open(log_work_path, "r") as f:
|
255
|
+
log_work_list = json.loads(f.read())
|
256
|
+
return "\n".join(
|
257
|
+
[
|
258
|
+
get_visual_todo_list(todo_list, TODO_VISUAL_FILTER),
|
259
|
+
"",
|
260
|
+
get_visual_todo_card(todo_task, log_work_list),
|
261
|
+
]
|
262
|
+
)
|
247
263
|
|
248
264
|
|
249
265
|
def _get_default_start() -> str:
|
@@ -284,4 +300,3 @@ def _get_todo_txt_content() -> str:
|
|
284
300
|
return ""
|
285
301
|
with open(todo_file_path, "r") as f:
|
286
302
|
return f.read()
|
287
|
-
return f.read()
|
zrb/util/todo.py
CHANGED
@@ -315,8 +315,8 @@ def get_visual_todo_card(
|
|
315
315
|
[
|
316
316
|
" ".join(
|
317
317
|
[
|
318
|
-
log_work.get("duration", "").strip().rjust(12),
|
319
|
-
log_work.get("start", "").strip().rjust(20),
|
318
|
+
stylize_magenta(log_work.get("duration", "").strip().rjust(12)),
|
319
|
+
stylize_cyan(log_work.get("start", "").strip().rjust(20)),
|
320
320
|
log_work.get("log", "").strip(),
|
321
321
|
]
|
322
322
|
)
|
@@ -61,6 +61,7 @@ zrb/builtin/project/add/fastapp_template/module/gateway/migration_metadata.py,sh
|
|
61
61
|
zrb/builtin/project/add/fastapp_template/module/gateway/route.py,sha256=pClO2mBmiDMps3PJEk75icnbak-nrPAt6eN-1WlC9QA,1176
|
62
62
|
zrb/builtin/project/add/fastapp_template/requirements.txt,sha256=J5qXx0sBagP-u-pdXsDnkPg66Gg-0ty4Mvz0WZXLAZY,108
|
63
63
|
zrb/builtin/project/add/fastapp_template/schema/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
64
|
+
zrb/builtin/project/add/fastapp_template/schema/permission.py,sha256=9ZwJrPYHY04yrzFuNQLf3KnO3zMU8MFH3B1pMwoePzE,623
|
64
65
|
zrb/builtin/project/add/fastapp_template/schema/role.py,sha256=tbpF67NsX3K7WNsxtx-3b0ClRnOo7pkTxdNs5UEn8oo,581
|
65
66
|
zrb/builtin/project/add/fastapp_template/schema/user.py,sha256=5yiBVTuf9FcU7i_nM4sRRFztMhXCg0W1YAjnVlPgVRE,556
|
66
67
|
zrb/builtin/project/add/fastapp_template/template.env,sha256=OZeV5cn9I7Wm6yJakyQ4lq5wVqGHuShYc_t3LqQK1Xk,55
|
@@ -82,7 +83,7 @@ zrb/builtin/shell/autocomplete/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
|
|
82
83
|
zrb/builtin/shell/autocomplete/bash.py,sha256=-7YDVV7txgJH9mAYSYN0jmvUEeDIzWFvVNY-cY0myF8,1181
|
83
84
|
zrb/builtin/shell/autocomplete/subcmd.py,sha256=WZI6cGWJcn80zSyxOHG7sCMO3Ucix3mZf4xm_xyB_Y0,606
|
84
85
|
zrb/builtin/shell/autocomplete/zsh.py,sha256=9hlq0Wt3fhRz326mAQTypEd4_4lZdrbBx_3A-Ti3mvw,1022
|
85
|
-
zrb/builtin/todo.py,sha256=
|
86
|
+
zrb/builtin/todo.py,sha256=yW25OZe2ZaEqz5PvGZtrdjBr4mWL98de1ZcsL6ipt08,9993
|
86
87
|
zrb/callback/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
87
88
|
zrb/callback/any_callback.py,sha256=Yhdv5UWHAZSVzj5K2JdxcVQx8x8VX8aZJEivj3NTfZc,247
|
88
89
|
zrb/callback/callback.py,sha256=IQ7r9EnXYHHcNXKBJAk4WFqCqj7WDvflAuCyu5y-27I,849
|
@@ -198,10 +199,10 @@ zrb/util/string/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
198
199
|
zrb/util/string/conversion.py,sha256=utfzaCLS2LTWMr9YbjXt2Z0a_pgzOjq76ZEPUh2UKCc,2876
|
199
200
|
zrb/util/string/format.py,sha256=c9dUrsl_DII7jZZPJi9NBTvxKnrzZDPcQuksW6FJ_Lk,611
|
200
201
|
zrb/util/string/name.py,sha256=8picJfUBXNpdh64GNaHv3om23QHhUZux7DguFLrXHp8,1163
|
201
|
-
zrb/util/todo.py,sha256=
|
202
|
+
zrb/util/todo.py,sha256=LharTudwr1gTNmt8iDUkQ6u21bGaCqVJh54Txe0bMOk,13529
|
202
203
|
zrb/xcom/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
203
204
|
zrb/xcom/xcom.py,sha256=P4aYHdE3FRsTsNrXGyW8N44IWZjw-vG_qys1Ymn3aBg,1572
|
204
|
-
zrb-1.0.
|
205
|
-
zrb-1.0.
|
206
|
-
zrb-1.0.
|
207
|
-
zrb-1.0.
|
205
|
+
zrb-1.0.0a13.dist-info/METADATA,sha256=EGlA61aVAFOuzE0-a6bJpgQRd24PZgGdT9UB7gFW8cw,4106
|
206
|
+
zrb-1.0.0a13.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
207
|
+
zrb-1.0.0a13.dist-info/entry_points.txt,sha256=-Pg3ElWPfnaSM-XvXqCxEAa-wfVI6BEgcs386s8C8v8,46
|
208
|
+
zrb-1.0.0a13.dist-info/RECORD,,
|
File without changes
|
File without changes
|