---
# System prepended metadata

title: Blog application documentation

---


# Blog application documentation
# TODO add collaboration option
# TODO change media to 3 pages each containing diff media types
# TODO better wiki planification
## Introduction
This application is designed for use by a single person or a small team of writers. It\`s functionalities are detailed below.

## A. Basic site structure and data organisation
**Note** *User subscription should apear as an option under every story and also on the footer.*
### Site structure
```markmap
# home (navigation and polls)

## Media
- (Music)
- (Photo/Video) 
- (Software)

## Archive
### Stories
- (Stories)
### Wiki
- (Articles)

## About
- (Owner public data)


## Contact
- (Means of contact)
```
The site will be structured similarly to a file system, with the home page at the root. All of the categories (subfolders of home) will appear in the navigation bar. The administrator will have the right to add and remove extra links from the navigation bar (but cannot modify the links to the subfolders).

All pages containing data (stories, wiki articles, media) should have a search utility with two-way sorting and filtering functionality.
***Homepage***
The homepage should contain the latest posts, polls, media uploads and links to all the other resources. 
***Media***
A page containing media relevant to the site. 
***Archive***
A page containing links to Stories and Wiki. 
***About***
A page containing public information.
***Contact***
A page containing a contact form and social media links.
***Wiki***
A wikipedia-style page containing similarly styled articles for important story entities and objects (such as characters, factions, places, events).
***Stories***
A generic blog page containing stories. 

### Data Organization
*By object in this context we mean a composition of named primary data types and functions for manipulating the data inside the instances of these compositions (e.g. classes, records + record manipulation functions, etc.).*

The data of the site will be organized as entities/objects: 
1. Stories (blog posts)
2. Wiki articles
3. Media 
4. Polls 

```plantuml
@startuml 
class Likeable{
    likes
}

class Post{
    id 
    date
    image
    title
    description
    tags
}

class Story{
    text
    comments 
}

class Article {
    referenced_object_name
}

class Media{}

class Poll{
    date
    options
    --
    votes 
}

Likeable <-- Story
Likeable <-- Media 

Post <-- Story
Post <-- Media
Post <-- Poll

@enduml
```
\
Each page will be a separate data type consisting of a composition of the aforementioned entities.


## B. User interaction and application functionalities
```plantuml
@startuml 
ima
package "No Authorization"{
    (Download media) as DM
    (Read data) as RD
}

package "Basic Authorization"{
    (Like/ Unlike post) as LP
    (Comment) as C 
    (Vote/ Unvote) as V 
    (Subscribe/ Unsubscribe) as S
    (Delete own comment) as DOC
}

package "Admin Authorization"{
    (Add data) as AD
    (Delete data) as DD 
    (Update data) as UD
    (Delete comment) as DC
    (Ban user) as BU
    (Unban user) as UBU
    
    (Post now) as ADN
    (Schedule post) as SCHAD
    
}
AD <.. SCHAD : extend 
AD <.. ADN : extend 
UD <.. SCHAD : extend 
UD <.. ADN : extend 

DC <.. BU :: extend

:user:
:guest:
skinparam actorStyle awesome
:admin:

guest - RD
guest - DM

user -- RD 
user -- DM 
user -- LP
user -- C
user -- V
user -- S
user -- DOC

admin - AD 
admin - DD
admin - UD
admin - DC
admin - BU
admin - RD
admin --- DM
admin - UBU

@enduml
``` 
\
There will be three types of users: administrator, user, guest.

***Administrator***
An administrator must log in via a built-in route, authorized by the server. The administrator has elevated rights: he can modify the content of the site, but cannot interfere with the structure of the site, *except by adding links to the navigation bar*.
The administrator has the following rights:
1. CRUD operations for all data entities
2. User interaction moderation: 
    - The ability to ban certain users from commenting 
    - The ability to delete comments from posts

***User***
We define the user as an entity whose identity is verified via a credible external source (e.g. logged-in with a google account ).
Users have the right to interact with the site.


The users will have the following rights:
1. Read all entities and download media
2. Interact with site
    - Like posts 
    - Comment on posts
    - Vote on polls
    - Subscribe to newsletter

***Guest***
Guests are entities without any credibility or authorization. They can only read the site\`s content and download media.

## C. Backend functionalities
Besides the normal functionalities of filtered/sorted data fetching, the backend should also provide for the following utilities:

1. **Tracking and website traffic statistics**
Traffic statistics should be displayed using graphs for all of the following requests:
    1. Views, comments and likes by:
        - Month 
        - Country
        - Story
    2. Downloads by:
        - Month 
        - Country
        - Media file
    3. Votes by
        - Month 
        - Country 
        - Poll 
    
2. **Autolink wiki pages to story words**
    Whenever a new article or story is published, the backend daemon must correctly identify all the words that are referenced by an article and make them link to that article.
\
\
\
\
\
\
\
\
Libraries and framework suggestions:
\

3. **Automatic image generation for posts using AI**

haskell: yesod, servant
elm: elm-spa