[task-396]

This commit is contained in:
fenris 2025-10-13 13:19:33 +02:00
parent 439f046b1d
commit bf4f2fab6e
11 changed files with 48 additions and 5 deletions

View file

@ -55,6 +55,7 @@ namespace _zeitbild.api
};
}
);
hue : float;
},
int
>(
@ -137,7 +138,8 @@ namespace _zeitbild.api
)
),
},
"resource_id": resource_id
"resource_id": resource_id,
"hue": stuff.input.hue,
};
return (
_zeitbild.service.calendar.add(calendar_object)

View file

@ -30,6 +30,7 @@ namespace _zeitbild.api
register<
{
name : string;
hue : float;
access : {
public : boolean;
default_level : ("none" | "view" | "edit" | "admin");
@ -73,6 +74,7 @@ namespace _zeitbild.api
);
const calendar_object_new : _zeitbild.type_calendar_object = {
"name": stuff.input.name,
"hue": stuff.input.hue,
"access": {
"public": stuff.input.access.public,
"default_level": _zeitbild.value_object.access_level.from_string(stuff.input.access.default_level),
@ -93,7 +95,7 @@ namespace _zeitbild.api
)
),
},
"resource_id": calendar_object_old.resource_id
"resource_id": calendar_object_old.resource_id,
};
await _zeitbild.service.calendar.change(
calendar_id,

View file

@ -31,6 +31,7 @@ namespace _zeitbild.api
null,
{
name : string;
hue : float;
access : {
default_level : string;
attributed : Array<
@ -63,6 +64,7 @@ namespace _zeitbild.api
);
const result = {
"name": calendar_object.name,
"hue": calendar_object.hue,
"access": {
"public": calendar_object.access.public,
"default_level": _zeitbild.api.access_level_encode(calendar_object.access.default_level),

View file

@ -33,6 +33,7 @@ namespace _zeitbild.api
{
id : int;
name : string;
hue : float;
access_level : string;
}
>
@ -59,6 +60,10 @@ namespace _zeitbild.api
"type": "string",
"nullable": false,
},
"hue": {
"nullable": false,
"type": "number"
},
"access_level": {
"type": "string",
"nullable": true,
@ -68,8 +73,8 @@ namespace _zeitbild.api
"required": [
"id",
"name",
"public",
"role",
"hue",
"access_level",
],
}
}),
@ -95,6 +100,7 @@ namespace _zeitbild.api
(entry) => ({
"id": entry.id,
"name": entry.name,
"hue": entry.hue,
"access_level": _zeitbild.value_object.access_level.to_string(entry.access_level),
})
)

View file

@ -34,6 +34,7 @@ namespace _zeitbild.api
{
calendar_id : int;
calendar_name : string;
hue : float;
access_level : string;
event_id : (null | int);
event_object : _zeitbild.type_event_object;
@ -80,6 +81,10 @@ namespace _zeitbild.api
"nullable": false,
"type": "string",
},
"hue": {
"nullable": false,
"type": "number"
},
"access_level": {
"nullable": false,
"type": "string",
@ -188,6 +193,7 @@ namespace _zeitbild.api
(entry) => ({
"calendar_id": entry.calendar_id,
"calendar_name": entry.calendar_name,
"hue": entry.hue,
"access_level": _zeitbild.api.access_level_encode(entry.access_level),
"event_id": entry.event_id,
"event_object": entry.event_object,

View file

@ -24,7 +24,7 @@ namespace _zeitbild.database
/**
*/
const _compatible_revisions : Array<string> = [
"r4",
"r5",
];

View file

@ -21,6 +21,11 @@ along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
namespace _zeitbild.repository.calendar
{
/**
*/
const hue_scaling : int = 0xFFFF;
/**
*/
type type_dispersal = {
@ -164,6 +169,7 @@ namespace _zeitbild.repository.calendar
return {
"core_row": {
"name": object.name,
"hue": Math.floor(object.hue * hue_scaling),
"access_public": object.access.public,
"access_level_default": encode_access_level(object.access.default_level),
"resource_id": object.resource_id,
@ -190,6 +196,7 @@ namespace _zeitbild.repository.calendar
{
return {
"name": dispersal.core_row["name"],
"hue": (dispersal.core_row["hue"] / hue_scaling),
"access": {
"public": dispersal.core_row["access_public"],
"default_level": decode_access_level(dispersal.core_row["access_level_default"]),
@ -378,6 +385,7 @@ namespace _zeitbild.repository.calendar
type type_overview_entry = {
id : _zeitbild.type_calendar_id;
name : string;
hue : float;
access_level : _zeitbild.enum_access_level;
}
@ -421,6 +429,7 @@ namespace _zeitbild.repository.calendar
(row : Record<string, any>) => ({
"id": row["id"],
"name": row["name"],
"hue": (row["hue"] / hue_scaling),
/**
* @todo unite with _zeitbild.service.calendar.get_access_level
*/

View file

@ -5,6 +5,7 @@
SELECT
x.id AS id,
x.name AS name,
x.hue AS hue,
x.access_public AS access_public,
x.access_level_default AS access_level_default,
y.level AS access_level_attributed

View file

@ -158,11 +158,17 @@ namespace _zeitbild.sample
};
}
);
hue ?: (null | float);
}
>;
};
/**
*/
const phi : float = ((Math.sqrt(5) - 1) / 2);
/**
*/
function decode_datetime(
@ -303,6 +309,11 @@ namespace _zeitbild.sample
const calendar_object : _zeitbild.type_calendar_object =
{
"name": calendar_raw.name,
"hue": (
calendar_raw.hue
??
((calendar_raw.id * phi) % 1)
),
"access": {
"public": (calendar_raw.access.public ?? false),
"default_level": _zeitbild.value_object.access_level.from_string(calendar_raw.access.default_level),

View file

@ -109,6 +109,7 @@ namespace _zeitbild.service.calendar
id : _zeitbild.type_calendar_id;
name : string;
access_level : _zeitbild.enum_access_level;
hue : float;
}
>
>
@ -544,6 +545,7 @@ namespace _zeitbild.service.calendar
(event_entry) => ({
"calendar_id": calendar_id,
"calendar_name": calendar_object.name,
"hue": calendar_object.hue,
"access_level": access_level,
"event_id": event_entry.id,
"event_object": event_entry.object,

View file

@ -127,6 +127,7 @@ namespace _zeitbild
*/
export type type_calendar_object = {
name : string;
hue : float;
access : {
public : boolean;
default_level : enum_access_level;
@ -144,6 +145,7 @@ namespace _zeitbild
export type type_event_extended = {
calendar_id : type_calendar_id;
calendar_name : string;
hue : float;
access_level : enum_access_level;
event_id : (null | type_local_resource_event_id);
event_object : type_event_object;