backend/source/types.ts

153 lines
2.3 KiB
TypeScript
Raw Normal View History

2025-09-25 17:18:16 +02:00
/*
This file is part of »zeitbild«.
Copyright 2025 'kcf' <fenris@folksprak.org>
»zeitbild« is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
»zeitbild« is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with »zeitbild«. If not, see <http://www.gnu.org/licenses/>.
*/
2024-09-12 00:03:29 +02:00
/**
*/
2024-09-21 11:05:24 +02:00
namespace _zeitbild
2024-09-12 00:03:29 +02:00
{
/**
*/
2024-09-21 10:56:00 +02:00
export enum enum_access_level {
none,
view,
edit,
admin
}
2024-09-12 00:03:29 +02:00
/**
*/
2024-09-21 11:05:24 +02:00
export type type_user_id = int;
2024-09-12 00:03:29 +02:00
/**
*/
2024-09-21 11:05:24 +02:00
export type type_user_object = {
2024-09-12 00:03:29 +02:00
name : string;
2024-09-13 17:49:32 +02:00
email_address : (
null
|
string
);
dav_token : (
null
|
string
);
2024-09-12 00:03:29 +02:00
};
/**
*/
2024-09-21 11:05:24 +02:00
export type type_event_object = {
/**
* @todo rename to "title"
*/
2024-09-12 00:03:29 +02:00
name : string;
2024-09-26 16:47:38 +02:00
begin : lib_plankton.pit.type_datetime;
2024-09-12 00:03:29 +02:00
end : (
null
|
2024-09-26 16:47:38 +02:00
lib_plankton.pit.type_datetime
2024-09-12 00:03:29 +02:00
);
location : (
null
|
string
);
link : (
null
|
string
);
2024-09-12 00:03:29 +02:00
description : (
null
|
string
);
};
/**
*/
export type type_local_resource_event_id = int;
2024-09-12 00:03:29 +02:00
/**
*/
2024-09-21 11:05:24 +02:00
export type type_resource_id = int;
2024-09-12 00:03:29 +02:00
/**
*/
2024-09-21 11:05:24 +02:00
export type type_resource_object = (
2024-09-12 00:03:29 +02:00
{
2024-09-12 16:35:57 +02:00
kind : "local";
data : {
event_ids : Array<
type_local_resource_event_id
>;
2024-09-12 16:35:57 +02:00
};
2024-09-12 00:03:29 +02:00
}
2024-09-12 16:35:57 +02:00
|
{
kind : "ics_feed";
2024-09-12 16:35:57 +02:00
data : {
url : string;
from_fucked_up_wordpress : boolean;
2024-09-12 16:35:57 +02:00
};
}
);
/**
*/
2024-09-21 11:05:24 +02:00
export type type_calendar_id = int;
2024-09-12 16:35:57 +02:00
/**
*/
2024-09-21 11:05:24 +02:00
export type type_calendar_object = {
2024-09-12 16:35:57 +02:00
name : string;
2024-09-21 10:56:00 +02:00
access : {
2024-10-10 23:00:29 +02:00
public : boolean;
2024-09-21 10:56:00 +02:00
default_level : enum_access_level;
attributed : lib_plankton.map.type_map<
2024-09-21 11:05:24 +02:00
type_user_id,
2024-09-21 10:56:00 +02:00
enum_access_level
>;
};
2024-09-21 11:05:24 +02:00
resource_id : type_resource_id;
2024-09-12 16:35:57 +02:00
};
/**
*/
export type type_event_extended = {
calendar_id : type_calendar_id;
calendar_name : string;
access_level : enum_access_level;
event_id : (null | type_local_resource_event_id);
event_object : type_event_object;
};
2024-09-12 16:35:57 +02:00
2024-09-12 00:03:29 +02:00
}