add new fields to logs and goals.
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-01-17 19:01:13 +01:00
parent 3085b8c025
commit eeba5bc9c8
20 changed files with 342 additions and 67 deletions
+20
View File
@@ -85,6 +85,16 @@ func Goal(g *gin.RouterGroup, db database.Database) {
}
goal.GroupID = group.ID
if goal.ItemID != nil {
item, err := l.FindItem(c.Request.Context(), *goal.ItemID)
if err != nil {
return nil, slerrors.BadRequest("Item could not be found.")
}
if item.GroupID != goal.GroupID {
return nil, slerrors.BadRequest("Item is not in group.")
}
}
err = db.Goals().Insert(c.Request.Context(), goal)
if err != nil {
return nil, err
@@ -117,6 +127,16 @@ func Goal(g *gin.RouterGroup, db database.Database) {
return nil, slerrors.BadRequest("Start time must be before end time.")
}
if goal.ItemID != nil && update.ItemID != nil {
item, err := l.FindItem(c.Request.Context(), *goal.ItemID)
if err != nil {
return nil, slerrors.BadRequest("Item could not be found.")
}
if item.GroupID != goal.GroupID {
return nil, slerrors.BadRequest("Item is not in group.")
}
}
err = db.Goals().Update(c.Request.Context(), goal.Goal)
if err != nil {
return nil, err
+27
View File
@@ -66,6 +66,19 @@ func Log(g *gin.RouterGroup, db database.Database) {
} else {
log.LoggedTime = log.LoggedTime.UTC()
}
if log.ItemAmount < 0 {
return nil, slerrors.BadRequest("Invalid item amount (min: 0).")
}
if log.SecondaryItemAmount < 0 {
return nil, slerrors.BadRequest("Invalid secondary item amount (min: 0).")
}
if log.SecondaryItemID != nil {
_, err := l.FindItem(c.Request.Context(), *log.SecondaryItemID)
if err != nil {
return nil, slerrors.BadRequest("Item could not be found.")
}
}
err = db.Logs().Insert(c.Request.Context(), log)
if err != nil {
@@ -91,6 +104,20 @@ func Log(g *gin.RouterGroup, db database.Database) {
}
log.Update(update)
if log.SecondaryItemID != nil && update.SecondaryItemID != nil {
_, err := l.FindItem(c.Request.Context(), *log.SecondaryItemID)
if err != nil {
return nil, slerrors.BadRequest("Item could not be found.")
}
}
if log.ItemAmount < 0 {
return nil, slerrors.BadRequest("Invalid item amount (min: 0).")
}
if log.SecondaryItemAmount < 0 {
return nil, slerrors.BadRequest("Invalid secondary item amount (min: 0).")
}
err = db.Logs().Update(c.Request.Context(), log.Log)
if err != nil {
return nil, err
+1
View File
@@ -36,6 +36,7 @@ func main() {
server := gin.New()
if useDummyUuid == "yes" {
log.Println("Using dummy UUID")
server.Use(auth.DummyMiddleware(dummyUuid))
} else {
server.Use(auth.TrustingJwtParserMiddleware())
+8 -3
View File
@@ -73,9 +73,11 @@ func (r *goalRepository) List(ctx context.Context, filter models.GoalFilter) ([]
func (r *goalRepository) Insert(ctx context.Context, goal models.Goal) error {
_, err := r.db.NamedExecContext(ctx, `
INSERT INTO goal (
goal_id, user_id, group_id, amount, start_time, end_time, name, description
goal_id, user_id, group_id, amount, start_time, end_time, name, description,
composition_mode, unweighted, item_id
) VALUES (
:goal_id, :user_id, :group_id, :amount, :start_time, :end_time, :name, :description
:goal_id, :user_id, :group_id, :amount, :start_time, :end_time, :name, :description,
:composition_mode, :unweighted, :item_id
)
`, &goal)
if err != nil {
@@ -92,7 +94,10 @@ func (r *goalRepository) Update(ctx context.Context, goal models.Goal) error {
start_time=:start_time,
end_time=:end_time,
name=:name,
description=:description
description=:description,
composition_mode=:composition_mode,
unweighted=:unweighted,
item_id=:item_id
WHERE goal_id=:goal_id
`, &goal)
if err != nil {
+10 -4
View File
@@ -34,7 +34,10 @@ func (r *logRepository) List(ctx context.Context, filter models.LogFilter) ([]*m
sq = sq.Where(squirrel.Eq{"task_id": filter.TaskIDs})
}
if len(filter.ItemIDs) > 0 {
sq = sq.Where(squirrel.Eq{"item_id": filter.ItemIDs})
sq = sq.Where(squirrel.Or{
squirrel.Eq{"item_id": filter.ItemIDs},
squirrel.Eq{"secondary_item_id": filter.ItemIDs},
})
}
if filter.MinTime != nil {
sq = sq.Where(squirrel.GtOrEq{
@@ -69,9 +72,9 @@ func (r *logRepository) List(ctx context.Context, filter models.LogFilter) ([]*m
func (r *logRepository) Insert(ctx context.Context, log models.Log) error {
_, err := r.db.NamedExecContext(ctx, `
INSERT INTO log (
log_id, user_id, task_id, item_id, logged_time, description
log_id, user_id, task_id, item_id, logged_time, description, item_amount, secondary_item_id, secondary_item_amount
) VALUES (
:log_id, :user_id, :task_id, :item_id, :logged_time, :description
:log_id, :user_id, :task_id, :item_id, :logged_time, :description, :item_amount, :secondary_item_id, :secondary_item_amount
)
`, &log)
if err != nil {
@@ -85,7 +88,10 @@ func (r *logRepository) Update(ctx context.Context, log models.Log) error {
_, err := r.db.NamedExecContext(ctx, `
UPDATE log SET
logged_time=:logged_time,
description=:description
description=:description,
item_amount=:item_amount,
secondary_item_id=:secondary_item_id,
secondary_item_amount=:secondary_item_amount
WHERE log_id=:log_id
`, &log)
if err != nil {
@@ -0,0 +1,15 @@
-- +goose Up
-- +goose StatementBegin
ALTER TABLE goal
ADD COLUMN composition_mode TEXT NOT NULL DEFAULT 'item',
ADD COLUMN unweighted BOOL NOT NULL DEFAULT false,
ADD COLUMN item_id CHAR(16) DEFAULT NULL;
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
ALTER TABLE goal
DROP COLUMN composition_mode,
DROP COLUMN unweighted,
DROP COLUMN item_id;
-- +goose StatementEnd
@@ -0,0 +1,15 @@
-- +goose Up
-- +goose StatementBegin
ALTER TABLE log
ADD COLUMN item_amount INT NOT NULL DEFAULT 1,
ADD COLUMN secondary_item_id CHAR(16) DEFAULT NULL,
ADD COLUMN secondary_item_amount INT NOT NULL DEFAULT 0;
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
ALTER TABLE log
DROP COLUMN item_amount,
DROP COLUMN secondary_item_id,
DROP COLUMN secondary_item_amount;
-- +goose StatementEnd
+32 -13
View File
@@ -6,14 +6,17 @@ import (
)
type Goal struct {
ID string `json:"id" db:"goal_id"`
UserID string `json:"-" db:"user_id"`
GroupID string `json:"groupId" db:"group_id"`
StartTime time.Time `json:"startTime" db:"start_time"`
EndTime time.Time `json:"endTime" db:"end_time"`
Amount int `json:"amount" db:"amount"`
Name string `json:"name" db:"name"`
Description string `json:"description" db:"description"`
ID string `json:"id" db:"goal_id"`
UserID string `json:"-" db:"user_id"`
GroupID string `json:"groupId" db:"group_id"`
ItemID *string `json:"itemId" db:"item_id"`
StartTime time.Time `json:"startTime" db:"start_time"`
EndTime time.Time `json:"endTime" db:"end_time"`
Amount int `json:"amount" db:"amount"`
Unweighted bool `json:"unweighted" db:"unweighted"`
Name string `json:"name" db:"name"`
Description string `json:"description" db:"description"`
CompositionMode string `json:"compositionMode" db:"composition_mode"`
}
func (goal *Goal) Update(update GoalUpdate) {
@@ -32,14 +35,30 @@ func (goal *Goal) Update(update GoalUpdate) {
if update.Description != nil {
goal.Description = *update.Description
}
if update.Unweighted != nil {
goal.Unweighted = *update.Unweighted
}
if update.CompositionMode != nil {
goal.CompositionMode = *update.CompositionMode
}
if update.ItemID != nil {
goal.ItemID = update.ItemID
}
if update.ClearItemID {
goal.ItemID = nil
}
}
type GoalUpdate struct {
StartTime *time.Time `json:"startTime"`
EndTime *time.Time `json:"endTime"`
Amount *int `json:"amount"`
Name *string `json:"name"`
Description *string `json:"description"`
StartTime *time.Time `json:"startTime"`
EndTime *time.Time `json:"endTime"`
Amount *int `json:"amount"`
Name *string `json:"name"`
Description *string `json:"description"`
ItemID *string `json:"itemId"`
Unweighted *bool `json:"unweighted"`
CompositionMode *string `json:"compositionMode"`
ClearItemID bool `json:"clearItemID"`
}
type GoalResult struct {
+43 -10
View File
@@ -6,12 +6,28 @@ import (
)
type Log struct {
ID string `json:"id" db:"log_id"`
UserID string `json:"-" db:"user_id"`
TaskID string `json:"taskId" db:"task_id"`
ItemID string `json:"itemId" db:"item_id"`
LoggedTime time.Time `json:"loggedTime" db:"logged_time"`
Description string `json:"description" db:"description"`
ID string `json:"id" db:"log_id"`
UserID string `json:"-" db:"user_id"`
TaskID string `json:"taskId" db:"task_id"`
ItemID string `json:"itemId" db:"item_id"`
ItemAmount int `json:"itemAmount" db:"item_amount"`
SecondaryItemID *string `json:"secondaryItemId" db:"secondary_item_id"`
SecondaryItemAmount int `json:"secondaryItemAmount" db:"secondary_item_amount"`
LoggedTime time.Time `json:"loggedTime" db:"logged_time"`
Description string `json:"description" db:"description"`
}
func (log *Log) Amount(itemID string) int {
result := 0
if log.ItemID == itemID {
result += log.ItemAmount
}
if log.SecondaryItemID != nil && *log.SecondaryItemID == itemID {
result += log.SecondaryItemAmount
}
return result
}
func (log *Log) Update(update LogUpdate) {
@@ -21,17 +37,34 @@ func (log *Log) Update(update LogUpdate) {
if update.Description != nil {
log.Description = *update.Description
}
if update.ItemAmount != nil {
log.ItemAmount = *update.ItemAmount
}
if update.SecondaryItemID != nil {
log.SecondaryItemID = update.SecondaryItemID
}
if update.ClearSecondaryItem {
log.SecondaryItemID = nil
}
if update.SecondaryItemAmount != nil {
log.SecondaryItemAmount = *update.SecondaryItemAmount
}
}
type LogUpdate struct {
LoggedTime *time.Time `json:"loggedTime"`
Description *string `json:"description"`
LoggedTime *time.Time `json:"loggedTime"`
Description *string `json:"description"`
ItemAmount *int `json:"itemAmount"`
SecondaryItemID *string `json:"secondaryItemId"`
SecondaryItemAmount *int `json:"secondaryItemAmount"`
ClearSecondaryItem bool `json:"clearSecondaryItem"`
}
type LogResult struct {
Log
Task *Task `json:"task"`
Item *Item `json:"item"`
Task *Task `json:"task"`
Item *Item `json:"item"`
SecondaryItem *Item `json:"secondaryItem"`
}
type LogFilter struct {
+43 -15
View File
@@ -128,6 +128,9 @@ func (l *Loader) FindLog(ctx context.Context, id string) (*models.LogResult, err
result.Task, _ = l.DB.Tasks().Find(ctx, id)
result.Item, _ = l.DB.Items().Find(ctx, log.ItemID)
if log.SecondaryItemID != nil {
result.SecondaryItem, _ = l.DB.Items().Find(ctx, *log.SecondaryItemID)
}
return result, nil
}
@@ -144,6 +147,9 @@ func (l *Loader) ListLogs(ctx context.Context, filter models.LogFilter) ([]*mode
for _, log := range logs {
taskIDs.Add(log.TaskID)
itemIDs.Add(log.ItemID)
if log.SecondaryItemID != nil {
itemIDs.Add(*log.SecondaryItemID)
}
}
tasks, err := l.DB.Tasks().List(ctx, models.TaskFilter{
UserID: auth.UserID(ctx),
@@ -177,7 +183,9 @@ func (l *Loader) ListLogs(ctx context.Context, filter models.LogFilter) ([]*mode
for _, item := range items {
if item.ID == log.ItemID {
results[i].Item = item
break
}
if log.SecondaryItemID != nil && item.ID == *log.SecondaryItemID {
results[i].SecondaryItem = item
}
}
}
@@ -502,16 +510,22 @@ func (l *Loader) populateGoals(ctx context.Context, goal *models.Goal) (*models.
MinTime: &goal.StartTime,
MaxTime: &goal.EndTime,
})
if err != nil {
return nil, err
}
// Get tasks
taskIDs := make([]string, 0, len(result.Logs))
taskIDs := stringset.New()
for _, log := range logs {
taskIDs = append(taskIDs, log.TaskID)
taskIDs.Add(log.TaskID)
}
tasks, err := l.DB.Tasks().List(ctx, models.TaskFilter{
UserID: userID,
IDs: taskIDs,
IDs: taskIDs.Strings(),
})
if err != nil {
return nil, err
}
// Apply logs
result.Logs = make([]*models.LogResult, 0, len(logs))
@@ -523,20 +537,34 @@ func (l *Loader) populateGoals(ctx context.Context, goal *models.Goal) (*models.
for _, task := range tasks {
if task.ID == log.TaskID {
resultLog.Task = task
for _, item := range result.Items {
if task.ItemID == item.ID {
item.CompletedAmount += 1
result.CompletedAmount += item.GroupWeight
break
}
resultLog.Item = &item.Item
}
break
}
}
for _, item := range result.Items {
amount := log.Amount(item.ID)
if amount > 0 && (goal.ItemID == nil || *goal.ItemID == item.ID) {
item.CompletedAmount += amount
if goal.Unweighted {
result.CompletedAmount += amount
} else {
result.CompletedAmount += amount * item.GroupWeight
}
}
if item.ID == log.ItemID {
resultLog.Item = &item.Item
if log.SecondaryItemID == nil {
break
}
}
if log.SecondaryItemID != nil && item.ID == *log.SecondaryItemID {
resultLog.SecondaryItem = &item.Item
}
}
result.Logs = append(result.Logs, resultLog)
}
}
@@ -0,0 +1,31 @@
<script lang="ts">
import type { GroupResult } from "../models/group";
export let value = "";
export let name = "";
export let disabled = false;
export let optional = false;
export let optionalLabel = "None";
export let group: GroupResult = null;
$: {
if (group != null && !group.items.find(t => t.id === value)) {
if (optional) {
value = "";
} else {
value = group.items[0]?.id || "";
}
}
}
</script>
<select name={name} bind:value={value} disabled={disabled || group == null || group.items.length === 0}>
{#if optional}
<option value={""} selected={"" === value}>{optionalLabel}</option>
{/if}
{#if group != null}
{#each group.items as item (item.id)}
<option value={item.id} selected={item.id === value}>{item.name} ({item.groupWeight})</option>
{/each}
{/if}
</select>
+17 -4
View File
@@ -3,9 +3,14 @@
import Icon from "./Icon.svelte";
export let item: Item = null;
export let amount: number = null;
export let noPadding: boolean = false;
</script>
<div class="item">
<div class="item" class:noPadding>
{#if amount != null}
<div class="item-amount">{amount}x</div>
{/if}
<div class="item-icon">
<Icon name={item.icon} />
</div>
@@ -22,13 +27,21 @@
margin-bottom: 0em;
font-size: 0.75em;
}
div.item a {
a {
color: inherit;
}
div.item div.item-icon {
div.item-icon {
padding: 0.25em 0.5ch 0.25em 0;
}
div.item div.item-name {
div.item-name {
padding: 0.125em;
}
div.item-amount {
padding: 0.125em;
padding-right: 1ch;
}
div.item.noPadding {
margin-top: 0em;
}
</style>
+5 -1
View File
@@ -4,6 +4,7 @@
export let value = "";
export let name = "";
export let disabled = false;
export let optional = false;
$: {
if ($groupStore.stale && !$groupStore.loading) {
@@ -12,7 +13,7 @@
}
$: {
if ($groupStore.groups.length > 0 && value === "") {
if ($groupStore.groups.length > 0 && value === "" && !optional) {
const nonEmpty = $groupStore.groups.find(g => g.items.length > 0);
if (nonEmpty != null) {
value = nonEmpty.items[0].id;
@@ -22,6 +23,9 @@
</script>
<select name={name} bind:value={value} disabled={disabled || $groupStore.loading}>
{#if optional}
<option value={""} selected={"" === value}>None</option>
{/if}
{#each $groupStore.groups as group (group.id)}
<optgroup label={group.name}>
{#each group.items as item (item.id)}
+4 -1
View File
@@ -21,7 +21,10 @@
</script>
<ChildEntry entry={log}>
<ItemLink item={log.item} />
<ItemLink amount={log.itemAmount} item={log.item} />
{#if log.secondaryItem != null}
<ItemLink noPadding amount={log.secondaryItemAmount} item={log.secondaryItem} />
{/if}
<OptionRow>
<Option open={mdLogEdit}>Edit Log</Option>
<Option open={mdLogDelete}>Delete Log</Option>
-3
View File
@@ -186,9 +186,6 @@ div.modal :global(textarea:disabled) {
color: #aaa;
}
div.modal :global(input:last-of-type) {
margin-bottom: 1em;
}
div.modal :global(input.nolast) {
margin-bottom: 0.5em;
}
+2 -8
View File
@@ -5,6 +5,7 @@
import ChildEntry from "./ChildEntry.svelte";
import DateSpan from "./DateSpan.svelte";
import Icon from "./Icon.svelte";
import ItemLink from "./ItemLink.svelte";
import Option from "./Option.svelte";
import OptionRow from "./OptionRow.svelte";
@@ -37,14 +38,7 @@
{task.completedAmount}&nbsp;/&nbsp;{task.itemAmount}
{/if}
</div>
<div class="item">
<div class="item-icon">
<Icon name={task.item.icon} />
</div>
<div class="item-name">
<a href="/items#{task.item.groupId}">{task.item.name} ({task.item.groupWeight})</a>
</div>
</div>
<ItemLink item={task.item} />
<OptionRow>
{#if task.logs.length > 0}
<Option on:click={toggleShowLogs}>{showLogs ? "Hide Logs" : "Show Logs"}</Option>
+26 -2
View File
@@ -6,6 +6,10 @@
import { formatFormTime, nextMonth } from "../utils/time";
import GroupSelect from "../components/GroupSelect.svelte";
import markStale from "../stores/markStale";
import Checkbox from "../components/Checkbox.svelte";
import GroupItemSelect from "../components/GroupItemSelect.svelte";
import groupStore from "../stores/group";
import type { GroupResult } from "../models/group";
export let deletion = false;
export let creation = false;
@@ -21,6 +25,9 @@
name: "",
description: "",
completedAmount: 0,
unweighted: false,
compositionMode: "item",
itemId: null,
group: {id: "", name: "", icon: "question", description: ""},
items: [],
logs: [],
@@ -37,11 +44,15 @@
let description = goal.description;
let groupId = goal.groupId;
let amount = goal.amount;
let unweighted = goal.unweighted;
let itemId = goal.itemId || "";
let compositionMode = goal.compositionMode;
let startTime = formatFormTime(goal.startTime);
let endTime = formatFormTime(goal.endTime);
let error = null;
let loading = false;
let selectedGroup: GroupResult = null;
function onSubmit() {
loading = true;
@@ -50,7 +61,8 @@
stuffLogClient.createGoal({
startTime: new Date(startTime),
endTime: new Date(endTime),
groupId, name, description, amount,
itemId: itemId || null,
groupId, name, description, amount, unweighted, compositionMode
}).then(() => {
markStale("goal");
modalStore.close();
@@ -72,7 +84,9 @@
stuffLogClient.updateGoal(goal.id, {
startTime: new Date(startTime),
endTime: new Date(endTime),
name, description, amount,
itemId: itemId || null,
clearItemId: itemId === "",
name, description, amount, compositionMode, unweighted,
}).then(() => {
markStale("goal");
modalStore.close();
@@ -89,6 +103,8 @@
function onClose() {
modalStore.close();
}
$: selectedGroup = $groupStore.groups.find(g => g.id === groupId);
</script>
<Modal show title="{verb} Goal" error={error} closable on:close={onClose}>
@@ -99,12 +115,20 @@
<textarea disabled={deletion} name="description" bind:value={description} />
<label for="groupId">Group</label>
<GroupSelect disabled={!creation} name="groupId" bind:value={groupId}/>
<label for="groupId">Specific Item</label>
<GroupItemSelect disabled={deletion} optional optionalLabel="Whole Group" group={selectedGroup} name="itemId" bind:value={itemId}/>
<label for="amount">Amount</label>
<input disabled={deletion} name="amount" type="number" bind:value={amount} />
<label for="compositionMode">Composition Mode (does nothing right now)</label>
<select name="compositionMode" bind:value={compositionMode} disabled={deletion}>
<option value="item" selected={"item" === compositionMode}>Item</option>
<option value="task" selected={"task" === compositionMode}>Task</option>
</select>
<label for="startTime">Start Time</label>
<input disabled={deletion} name="startTime" type="datetime-local" bind:value={startTime} />
<label for="endTime">End Time</label>
<input disabled={deletion} name="endTime" type="datetime-local" bind:value={endTime} />
<Checkbox bind:checked={unweighted} label="Unweighted (All items count as 1)" />
<hr />
+22 -2
View File
@@ -1,6 +1,7 @@
<script lang="ts">
import stuffLogClient from "../clients/stufflog";
import Checkbox from "../components/Checkbox.svelte";
import ItemSelect from "../components/ItemSelect.svelte";
import Modal from "../components/Modal.svelte";
import type { LogResult } from "../models/log";
import markStale from "../stores/markStale";
@@ -17,8 +18,12 @@
itemId: "",
loggedTime: new Date().toISOString(),
description: "",
itemAmount: 1,
secondaryItemAmount: 0,
secondaryItemId: null,
task: null,
item: null,
secondaryItem: null,
}
let defaultMarkInactive = false;
let verb = "Add";
@@ -34,6 +39,9 @@
let loggedTime = formatFormTime(log.loggedTime);
let description = log.description;
let itemAmount = log.itemAmount;
let secondaryItemId = log.secondaryItemId || "";
let secondaryItemAmount = log.secondaryItemAmount;
let markInactive = defaultMarkInactive;
let error = null;
let loading = false;
@@ -46,7 +54,8 @@
stuffLogClient.createLog({
taskId: log.task.id,
loggedTime: new Date(loggedTime).toISOString(),
description,
secondaryItemId: secondaryItemId || null,
description, itemAmount, secondaryItemAmount,
}).then(() => {
markStale("project", "task", "goal", "log");
@@ -74,7 +83,9 @@
} else {
stuffLogClient.updateLog(log.id, {
loggedTime: new Date(loggedTime).toISOString(),
description,
secondaryItemId: secondaryItemId || null,
clearSecondaryItemId: secondaryItemId == "",
description, itemAmount, secondaryItemAmount
}).then(() => {
markStale("project", "task", "goal", "log");
modalStore.close();
@@ -97,8 +108,17 @@
<input disabled name="taskName" type="text" value={log.task.name} />
<label for="loggedTime">Logged Time</label>
<input disabled={deletion} name="loggedTime" type="datetime-local" bind:value={loggedTime} />
<label for="itemAmount">Item Amount</label>
<input disabled={deletion} name="itemAmount" type="number" bind:value={itemAmount} />
<label for="description">Description</label>
<textarea disabled={deletion} name="description" bind:value={description} />
<label for="secondaryItemId">Secondary Item</label>
<ItemSelect name="secondaryItemId" disabled={deletion} optional bind:value={secondaryItemId} />
{#if secondaryItemId != ""}
<label for="secondaryItemAmount">Secondary Item Amount</label>
<input disabled={deletion} name="secondaryItemAmount" type="number" bind:value={secondaryItemAmount} />
{/if}
<Checkbox disabled={deletion} bind:checked={markInactive} label="Mark task inactive/completed." />
<hr />
+10
View File
@@ -5,11 +5,14 @@ import type { LogResult } from "./log";
export default interface Goal {
id: string
groupId: string
itemId?: string
startTime: string
endTime: string
amount: number
name: string
description: string
unweighted: boolean
compositionMode: string
}
export interface GoalFilter {
@@ -31,17 +34,24 @@ interface GoalResultItem extends Item {
export interface GoalInput {
groupId: string
itemId: string
startTime: string | Date
endTime: string | Date
amount: number
name: string
description: string
unweighted: boolean
compositionMode: string
}
export interface GoalUpdate {
itemId?: string
startTime?: string | Date
endTime?: string | Date
amount?: number
name?: string
description?: string
unweighted?: boolean
compositionMode?: string
clearItemId?: boolean
}
+11 -1
View File
@@ -5,11 +5,13 @@ export default interface Log {
id: string
taskId: string
itemId: string
itemAmount: number
secondaryItemId?: string
secondaryItemAmount: number
loggedTime: string
description: string
}
export interface LogFilter {
minTime?: Date
maxTime?: Date
@@ -18,15 +20,23 @@ export interface LogFilter {
export interface LogResult extends Log {
task: Task
item: Item
secondaryItem?: Item
}
export interface LogInput {
taskId: string
loggedTime?: string
description: string
itemAmount: number
secondaryItemId?: string
secondaryItemAmount?: number
}
export interface LogUpdate {
loggedTime?: string
description?: string
itemAmount?: number
secondaryItemId?: string
secondaryItemAmount?: number
clearSecondaryItemId?: boolean
}