lnsp / tum.events

Talk aggregator for TUM CS talks.

Home Page:https://tum.events

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TUM Events Go Reference

This is the source repository for the TUM Events service available at tum.events.

Public sources

Architecture

TUM Events uses Valar KV to store all talk data. Talks are stored in the format of {prefix}_talks_{talkid}. The talk structure uses a minimal JSON format where a single character identifies a field. It is defined using the following Go structure.

Talks

type Talk struct {
	ID       int64     `json:"i,omitempty"`
	Rank     int64     `json:"-"`
	User     string    `json:"u"`
	Title    string    `json:"t"`
	Category string    `json:"c"`
	Date     time.Time `json:"d"`
	Link     string    `json:"l,omitempty"`
	Body     string    `json:"b,omitempty"`
}

Thus, the following JSON block is a valid Talk doc.

{
    "i": 1,
    "u": "go42tum",
    "t": "title",
    "c": "databases",
    "d": "2022-05-18T10:00:00+02:00",
    "l": "https://google.com"
}

Talks are synchronized if and only if the talk cache is empty OR the talk doc list changes.

Login

type Login struct {
	Expiration time.Time `json:"e"`
	User       string    `json:"u"`
	Key        string    `json:"k"`
	Code       string    `json:"c"`
	Attempt    int       `json:"a"`
}

Sessions

A session represents an authenticated user.

type Session struct {
	Expiration time.Time `json:"e"`
	User       string    `json:"u"`
	Key        string    `json:"k"`
}

Verification

type Verification struct {
	Expiration time.Time `json:"e"`
	Talk       *Talk     `json:"t"`
}

Workflow

When developing locally, you most likely want to edit templates & run a local service instance.

# To continously render the tailwind.min.css styles, run the following command.
npx tailwindcss -i tailwind.css -m -w -o tailwind.min.css 
# In a second terminal, run & restart the web service as you see fit.
DEBUG=true go run main.go

About

Talk aggregator for TUM CS talks.

https://tum.events

License:Apache License 2.0


Languages

Language:Go 78.9%Language:HTML 20.3%Language:JavaScript 0.4%Language:CSS 0.4%