Skip to content

Add admin link management for resource references - #169

Draft
Stcwal with Copilot wants to merge 3 commits into
devfrom
copilot/add-admin-link-for-wiki
Draft

Add admin link management for resource references#169
Stcwal with Copilot wants to merge 3 commits into
devfrom
copilot/add-admin-link-for-wiki

Conversation

Copilot AI commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

Admins can now create, edit, and delete resource links (e.g., wiki pages for camera booking procedures) visible to all users.

Changes

Database

  • Added ResourceLink model with title, url, description, createdBy, createdAt
  • Migration: 20260126163149_add_resource_link

API (tRPC)

  • New linkRouter with CRUD endpoints
  • createLink, updateLink, deleteLink require admin privileges
  • getLinks, getLink available to all members
  • URL validation restricts to HTTP/HTTPS protocols only (prevents XSS via javascript:, data: schemes)

Admin UI

  • /admin/links page with list view, create/edit dialogs, delete confirmations
  • Added "Lenker" navigation to admin sidebar
  • Toast notifications for operation feedback

Example

// Backend validation prevents malicious URLs
const safeUrlSchema = z
    .string()
    .url('Must be a valid URL')
    .refine(
        (url) => {
            const parsed = new URL(url);
            return ['http:', 'https:'].includes(parsed.protocol);
        },
        { message: 'Only HTTP and HTTPS URLs are allowed' },
    );

All mutations check resource existence before operations and return appropriate errors. UI follows existing patterns from items management.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkpoint.prisma.io
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/kontresv2/kontresv2/node_modules/.pnpm/prisma@6.16.3_typescript@5.9.2/node_modules/prisma/build/child {"product":"prisma","version":"6.16.3","cli_install_type":"local","information":"","local_timestamp":"2026-01-26T16:31:22Z","project_hash":"e34cc191","cli_path":"/home/REDACTED/work/kontresv2/kontresv2/node_modules/prisma/build/index.js","cli_path_hash":"d1 (dns block)
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/kontresv2/kontresv2/node_modules/.pnpm/prisma@6.16.3_typescript@5.9.2/node_modules/prisma/build/child {"product":"prisma","version":"6.16.3","cli_install_type":"local","information":"","local_timestamp":"2026-01-26T16:31:31Z","project_hash":"e34cc191","cli_path":"/home/REDACTED/work/kontresv2/kontresv2/node_modules/prisma/build/index.js","cli_path_hash":"d1 (dns block)
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/kontresv2/kontresv2/node_modules/.pnpm/prisma@6.16.3_typescript@5.9.2/node_modules/prisma/build/child {"product":"prisma","version":"6.16.3","cli_install_type":"local","information":"","local_timestamp":"2026-01-26T16:31:40Z","project_hash":"e34cc191","cli_path":"/home/REDACTED/work/kontresv2/kontresv2/node_modules/prisma/build/index.js","cli_path_hash":"d1 (dns block)
  • fonts.googleapis.com
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/kontresv2/kontresv2/node_modules/.pnpm/next@15.5.3_react-dom@19.1.1_react@19.1.1__react@19.1.1/node_modules/next/dist/compiled/jest-worker/processChild.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Make it possible for admin to add link</issue_title>
<issue_description>Should be a link to wiki for booking of camera to give an example</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel

vercel Bot commented Jan 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
kont-res Error Error Jan 26, 2026 4:38pm

Request Review

Co-authored-by: Stcwal <181558713+Stcwal@users.noreply.github.com>
Co-authored-by: Stcwal <181558713+Stcwal@users.noreply.github.com>
Copilot AI changed the title [WIP] Add functionality for admin to add link to wiki Add admin link management for resource references Jan 26, 2026
Copilot AI requested a review from Stcwal January 26, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make it possible for admin to add link

2 participants