rename DayPartModel -> DayStrModel
This commit is contained in:
parent
3ccd3da28a
commit
5694438c96
4 changed files with 17 additions and 30 deletions
|
@ -85,20 +85,21 @@ async def get_config_model(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class DayPartModel(BaseModel):
|
class DayStrModel(BaseModel):
|
||||||
day: int
|
day: int
|
||||||
part: str
|
value: str
|
||||||
|
|
||||||
|
|
||||||
@router.get("/day_parts")
|
@router.get("/day_parts")
|
||||||
async def get_day_parts(
|
async def get_day_parts(
|
||||||
_: None = Depends(require_admin),
|
_: None = Depends(require_admin),
|
||||||
parts: dict[int, str] = Depends(get_parts),
|
parts: dict[int, str] = Depends(get_parts),
|
||||||
) -> list[DayPartModel]:
|
) -> list[DayStrModel]:
|
||||||
return [
|
"""
|
||||||
DayPartModel.model_validate({"day": day, "part": part})
|
Zuordnung der Lösungsteile zu den Tagen
|
||||||
for day, part in sorted(parts.items())
|
"""
|
||||||
]
|
|
||||||
|
return [DayStrModel(day=day, value=part) for day, part in sorted(parts.items())]
|
||||||
|
|
||||||
|
|
||||||
@router.get("/doors")
|
@router.get("/doors")
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
:key="`part-${index}`"
|
:key="`part-${index}`"
|
||||||
class="tag is-info"
|
class="tag is-info"
|
||||||
>
|
>
|
||||||
{{ day_part.day }}: {{ day_part.part.split("").join(", ") }}
|
{{ day_part.day }}: {{ day_part.value.split("").join(", ") }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { DayPartModel } from "@/lib/api";
|
import { DayStrModel } from "@/lib/api";
|
||||||
import { Options, Vue } from "vue-class-component";
|
import { Options, Vue } from "vue-class-component";
|
||||||
|
|
||||||
import BulmaButton from "./bulma/Button.vue";
|
import BulmaButton from "./bulma/Button.vue";
|
||||||
|
@ -66,7 +66,7 @@ import MultiModal from "./calendar/MultiModal.vue";
|
||||||
})
|
})
|
||||||
export default class extends Vue {
|
export default class extends Vue {
|
||||||
public is_loaded = true;
|
public is_loaded = true;
|
||||||
public day_parts: DayPartModel[] = [];
|
public day_parts: DayStrModel[] = [];
|
||||||
|
|
||||||
declare $refs: {
|
declare $refs: {
|
||||||
multi_modal: MultiModal;
|
multi_modal: MultiModal;
|
||||||
|
@ -75,7 +75,7 @@ export default class extends Vue {
|
||||||
public on_open(): void {
|
public on_open(): void {
|
||||||
this.is_loaded = false;
|
this.is_loaded = false;
|
||||||
|
|
||||||
Promise.all([this.$advent22.api_get<DayPartModel[]>("admin/day_parts")])
|
Promise.all([this.$advent22.api_get<DayStrModel[]>("admin/day_parts")])
|
||||||
.then(([day_parts]) => {
|
.then(([day_parts]) => {
|
||||||
this.day_parts = day_parts;
|
this.day_parts = day_parts;
|
||||||
this.is_loaded = true;
|
this.is_loaded = true;
|
||||||
|
|
|
@ -18,20 +18,6 @@
|
||||||
<dt>Lösung</dt>
|
<dt>Lösung</dt>
|
||||||
<dd>{{ config_model.puzzle.solution }}</dd>
|
<dd>{{ config_model.puzzle.solution }}</dd>
|
||||||
|
|
||||||
<dt>Reihenfolge</dt>
|
|
||||||
<dd>
|
|
||||||
<template
|
|
||||||
v-for="(day_part, index) in day_parts"
|
|
||||||
:key="`part-${index}`"
|
|
||||||
>
|
|
||||||
<span>
|
|
||||||
<template v-if="index > 0"> – </template>
|
|
||||||
{{ day_part.day }}:
|
|
||||||
</span>
|
|
||||||
<span class="is-family-monospace">{{ day_part.part }}</span>
|
|
||||||
</template>
|
|
||||||
</dd>
|
|
||||||
|
|
||||||
<dt>Offene Türchen</dt>
|
<dt>Offene Türchen</dt>
|
||||||
<!-- TODO -->
|
<!-- TODO -->
|
||||||
<dd>10</dd>
|
<dd>10</dd>
|
||||||
|
@ -137,7 +123,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { ConfigModel, DayPartModel } from "@/lib/api";
|
import { ConfigModel, DayStrModel } from "@/lib/api";
|
||||||
import { Options, Vue } from "vue-class-component";
|
import { Options, Vue } from "vue-class-component";
|
||||||
|
|
||||||
import BulmaDrawer from "./bulma/Drawer.vue";
|
import BulmaDrawer from "./bulma/Drawer.vue";
|
||||||
|
@ -172,14 +158,14 @@ export default class extends Vue {
|
||||||
config_file: "config.toml",
|
config_file: "config.toml",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
public day_parts: DayPartModel[] = [];
|
public day_parts: DayStrModel[] = [];
|
||||||
|
|
||||||
public on_open(): void {
|
public on_open(): void {
|
||||||
this.is_loaded = false;
|
this.is_loaded = false;
|
||||||
|
|
||||||
Promise.all([
|
Promise.all([
|
||||||
this.$advent22.api_get<ConfigModel>("admin/config_model"),
|
this.$advent22.api_get<ConfigModel>("admin/config_model"),
|
||||||
this.$advent22.api_get<DayPartModel[]>("admin/day_parts"),
|
this.$advent22.api_get<DayStrModel[]>("admin/day_parts"),
|
||||||
])
|
])
|
||||||
.then(([config_model, day_parts]) => {
|
.then(([config_model, day_parts]) => {
|
||||||
this.config_model = config_model;
|
this.config_model = config_model;
|
||||||
|
|
|
@ -22,9 +22,9 @@ export interface ConfigModel {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DayPartModel {
|
export interface DayStrModel {
|
||||||
day: number;
|
day: number;
|
||||||
part: string;
|
value: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DoorSaved {
|
export interface DoorSaved {
|
||||||
|
|
Loading…
Reference in a new issue