[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 int
>( >(
@ -137,7 +138,8 @@ namespace _zeitbild.api
) )
), ),
}, },
"resource_id": resource_id "resource_id": resource_id,
"hue": stuff.input.hue,
}; };
return ( return (
_zeitbild.service.calendar.add(calendar_object) _zeitbild.service.calendar.add(calendar_object)

View file

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

View file

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

View file

@ -33,6 +33,7 @@ namespace _zeitbild.api
{ {
id : int; id : int;
name : string; name : string;
hue : float;
access_level : string; access_level : string;
} }
> >
@ -59,6 +60,10 @@ namespace _zeitbild.api
"type": "string", "type": "string",
"nullable": false, "nullable": false,
}, },
"hue": {
"nullable": false,
"type": "number"
},
"access_level": { "access_level": {
"type": "string", "type": "string",
"nullable": true, "nullable": true,
@ -68,8 +73,8 @@ namespace _zeitbild.api
"required": [ "required": [
"id", "id",
"name", "name",
"public", "hue",
"role", "access_level",
], ],
} }
}), }),
@ -95,6 +100,7 @@ namespace _zeitbild.api
(entry) => ({ (entry) => ({
"id": entry.id, "id": entry.id,
"name": entry.name, "name": entry.name,
"hue": entry.hue,
"access_level": _zeitbild.value_object.access_level.to_string(entry.access_level), "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_id : int;
calendar_name : string; calendar_name : string;
hue : float;
access_level : string; access_level : string;
event_id : (null | int); event_id : (null | int);
event_object : _zeitbild.type_event_object; event_object : _zeitbild.type_event_object;
@ -80,6 +81,10 @@ namespace _zeitbild.api
"nullable": false, "nullable": false,
"type": "string", "type": "string",
}, },
"hue": {
"nullable": false,
"type": "number"
},
"access_level": { "access_level": {
"nullable": false, "nullable": false,
"type": "string", "type": "string",
@ -188,6 +193,7 @@ namespace _zeitbild.api
(entry) => ({ (entry) => ({
"calendar_id": entry.calendar_id, "calendar_id": entry.calendar_id,
"calendar_name": entry.calendar_name, "calendar_name": entry.calendar_name,
"hue": entry.hue,
"access_level": _zeitbild.api.access_level_encode(entry.access_level), "access_level": _zeitbild.api.access_level_encode(entry.access_level),
"event_id": entry.event_id, "event_id": entry.event_id,
"event_object": entry.event_object, "event_object": entry.event_object,

View file

@ -24,7 +24,7 @@ namespace _zeitbild.database
/** /**
*/ */
const _compatible_revisions : Array<string> = [ 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 namespace _zeitbild.repository.calendar
{ {
/**
*/
const hue_scaling : int = 0xFFFF;
/** /**
*/ */
type type_dispersal = { type type_dispersal = {
@ -164,6 +169,7 @@ namespace _zeitbild.repository.calendar
return { return {
"core_row": { "core_row": {
"name": object.name, "name": object.name,
"hue": Math.floor(object.hue * hue_scaling),
"access_public": object.access.public, "access_public": object.access.public,
"access_level_default": encode_access_level(object.access.default_level), "access_level_default": encode_access_level(object.access.default_level),
"resource_id": object.resource_id, "resource_id": object.resource_id,
@ -190,6 +196,7 @@ namespace _zeitbild.repository.calendar
{ {
return { return {
"name": dispersal.core_row["name"], "name": dispersal.core_row["name"],
"hue": (dispersal.core_row["hue"] / hue_scaling),
"access": { "access": {
"public": dispersal.core_row["access_public"], "public": dispersal.core_row["access_public"],
"default_level": decode_access_level(dispersal.core_row["access_level_default"]), "default_level": decode_access_level(dispersal.core_row["access_level_default"]),
@ -378,6 +385,7 @@ namespace _zeitbild.repository.calendar
type type_overview_entry = { type type_overview_entry = {
id : _zeitbild.type_calendar_id; id : _zeitbild.type_calendar_id;
name : string; name : string;
hue : float;
access_level : _zeitbild.enum_access_level; access_level : _zeitbild.enum_access_level;
} }
@ -421,6 +429,7 @@ namespace _zeitbild.repository.calendar
(row : Record<string, any>) => ({ (row : Record<string, any>) => ({
"id": row["id"], "id": row["id"],
"name": row["name"], "name": row["name"],
"hue": (row["hue"] / hue_scaling),
/** /**
* @todo unite with _zeitbild.service.calendar.get_access_level * @todo unite with _zeitbild.service.calendar.get_access_level
*/ */

View file

@ -5,6 +5,7 @@
SELECT SELECT
x.id AS id, x.id AS id,
x.name AS name, x.name AS name,
x.hue AS hue,
x.access_public AS access_public, x.access_public AS access_public,
x.access_level_default AS access_level_default, x.access_level_default AS access_level_default,
y.level AS access_level_attributed 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( function decode_datetime(
@ -303,6 +309,11 @@ namespace _zeitbild.sample
const calendar_object : _zeitbild.type_calendar_object = const calendar_object : _zeitbild.type_calendar_object =
{ {
"name": calendar_raw.name, "name": calendar_raw.name,
"hue": (
calendar_raw.hue
??
((calendar_raw.id * phi) % 1)
),
"access": { "access": {
"public": (calendar_raw.access.public ?? false), "public": (calendar_raw.access.public ?? false),
"default_level": _zeitbild.value_object.access_level.from_string(calendar_raw.access.default_level), "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; id : _zeitbild.type_calendar_id;
name : string; name : string;
access_level : _zeitbild.enum_access_level; access_level : _zeitbild.enum_access_level;
hue : float;
} }
> >
> >
@ -544,6 +545,7 @@ namespace _zeitbild.service.calendar
(event_entry) => ({ (event_entry) => ({
"calendar_id": calendar_id, "calendar_id": calendar_id,
"calendar_name": calendar_object.name, "calendar_name": calendar_object.name,
"hue": calendar_object.hue,
"access_level": access_level, "access_level": access_level,
"event_id": event_entry.id, "event_id": event_entry.id,
"event_object": event_entry.object, "event_object": event_entry.object,

View file

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