Nevernight — Vk
-- Reactions (one row per user‑post‑emoji) CREATE TABLE reactions ( post_id BIGINT REFERENCES posts(id), user_id BIGINT REFERENCES users(vk_id), emoji TEXT CHECK (emoji IN ('heart','moon','sound','fireworks')), PRIMARY KEY (post_id, user_id, emoji) );
All endpoints validate inputs with express-validator and return with ok: true, data: … or ok:false, error: … . 8. Sample Code Snippets 8.1. Vue Component – Live Pulse Wall <template> <section class="pulse-wall" :style="backgroundImage:`url($currentTheme.banner)`"> <audio v-if="currentTheme.music" :src="currentTheme.music" autoplay loop></audio> nevernight vk
const posts = ref([]); const currentTheme = ref({}); const showSubmit = ref(false); const socket = io(import.meta.env.VITE_WS_URL); -- Reactions (one row per user‑post‑emoji) CREATE TABLE
<button v-if="isMember" class="submit-btn" @click="showSubmit = true"> + Night Moment </button> | | POST | /api/posts/:id/react | required | Payload: emoji
-- Posts CREATE TABLE posts ( id BIGSERIAL PRIMARY KEY, user_id BIGINT REFERENCES users(vk_id), type TEXT CHECK (type IN ('photo','video','text')), media_url TEXT, text_body TEXT, created_at TIMESTAMP DEFAULT now(), theme_id BIGINT REFERENCES themes(id) );
<script setup> import ref, onMounted from 'vue'; import io from 'socket.io-client'; import PostCard from '@/components/PostCard.vue'; import SubmitModal from '@/components/SubmitModal.vue'; import fetchCurrentTheme, fetchFeed from '@/api';
-- Themes CREATE TABLE themes ( id BIGSERIAL PRIMARY KEY, name TEXT, banner_url TEXT, music_url TEXT, start_time TIMESTAMP, end_time TIMESTAMP ); | Method | Path | Auth | Description | |--------|------|------|-------------| | GET | /api/feed?limit=20&offset=0 | optional | Returns ordered list of posts for the live wall. | | POST | /api/posts | required | Payload: type, media, text, theme_id . Returns post ID. | | POST | /api/posts/:id/react | required | Payload: emoji . Returns updated counters. | | POST | /api/posts/:id/vote | required | No body. Returns success/failure. | | GET | /api/themes/current | none | Returns the active theme (banner, music). | | GET | /api/leaderboard?period=day | none | Top 10 users by night‑score. | | GET | /api/admin/pending | admin only | List of flagged posts for manual review. | | POST | /api/admin/themes | admin only | Create or update a night‑theme schedule. | | POST | /api/admin/pin/:postId | admin only | Pin a post as Night‑Master (24 h). |