f99c44f716
- Add bulletin_posts and bulletin_reads PocketBase collections with migrations - Add BulletinPost/BulletinRead types and priority levels (low/normal/high/urgent) - Add bulletin API (CRUD, read tracking, realtime subscription) - Add bulletin Pinia store with pinned/normal sections and expiration filtering - Add BulletinPinned header component for pinned announcements - Add BulletinBoard tab component with sectioned list layout - Add BulletinPostCard with priority tags, unread dots, and hover actions - Add CreateBulletinDialog with title, content, priority, pinned, expiresAt - Integrate bulletin tab into GroupView with Bell icon and real-time updates Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
123 lines
3.1 KiB
JavaScript
123 lines
3.1 KiB
JavaScript
/// <reference path="../pb_data/types.d.ts" />
|
|
migrate((db) => {
|
|
const collection = new Collection({
|
|
"id": "bulletin_posts",
|
|
"created": "2026-04-21 00:00:00.000Z",
|
|
"updated": "2026-04-21 00:00:00.000Z",
|
|
"name": "bulletin_posts",
|
|
"type": "base",
|
|
"system": false,
|
|
"schema": [
|
|
{
|
|
"system": false,
|
|
"id": "bp_group",
|
|
"name": "group",
|
|
"type": "relation",
|
|
"required": true,
|
|
"presentable": false,
|
|
"unique": false,
|
|
"options": {
|
|
"collectionId": "es63bkyiblpnxdf",
|
|
"cascadeDelete": true,
|
|
"minSelect": null,
|
|
"maxSelect": 1,
|
|
"displayFields": null
|
|
}
|
|
},
|
|
{
|
|
"system": false,
|
|
"id": "bp_creator",
|
|
"name": "creator",
|
|
"type": "relation",
|
|
"required": true,
|
|
"presentable": false,
|
|
"unique": false,
|
|
"options": {
|
|
"collectionId": "_pb_users_auth_",
|
|
"cascadeDelete": true,
|
|
"minSelect": null,
|
|
"maxSelect": 1,
|
|
"displayFields": null
|
|
}
|
|
},
|
|
{
|
|
"system": false,
|
|
"id": "bp_title",
|
|
"name": "title",
|
|
"type": "text",
|
|
"required": true,
|
|
"presentable": false,
|
|
"unique": false,
|
|
"options": {
|
|
"min": 1,
|
|
"max": 200,
|
|
"pattern": ""
|
|
}
|
|
},
|
|
{
|
|
"system": false,
|
|
"id": "bp_content",
|
|
"name": "content",
|
|
"type": "text",
|
|
"required": true,
|
|
"presentable": false,
|
|
"unique": false,
|
|
"options": {
|
|
"min": 1,
|
|
"max": 5000,
|
|
"pattern": ""
|
|
}
|
|
},
|
|
{
|
|
"system": false,
|
|
"id": "bp_priority",
|
|
"name": "priority",
|
|
"type": "select",
|
|
"required": true,
|
|
"presentable": false,
|
|
"unique": false,
|
|
"options": {
|
|
"maxSelect": 1,
|
|
"values": ["low", "normal", "high", "urgent"]
|
|
}
|
|
},
|
|
{
|
|
"system": false,
|
|
"id": "bp_pinned",
|
|
"name": "pinned",
|
|
"type": "bool",
|
|
"required": false,
|
|
"presentable": false,
|
|
"unique": false,
|
|
"options": {}
|
|
},
|
|
{
|
|
"system": false,
|
|
"id": "bp_expires_at",
|
|
"name": "expiresAt",
|
|
"type": "date",
|
|
"required": false,
|
|
"presentable": false,
|
|
"unique": false,
|
|
"options": {
|
|
"min": "",
|
|
"max": ""
|
|
}
|
|
}
|
|
],
|
|
"indexes": [],
|
|
"listRule": "@request.auth.id != \"\" && group.members ~ @request.auth.id",
|
|
"viewRule": "@request.auth.id != \"\" && group.members ~ @request.auth.id",
|
|
"createRule": "@request.auth.id != \"\" && group.members ~ @request.auth.id",
|
|
"updateRule": "creator = @request.auth.id || group.owner = @request.auth.id",
|
|
"deleteRule": "creator = @request.auth.id || group.owner = @request.auth.id",
|
|
"options": {}
|
|
});
|
|
|
|
return Dao(db).saveCollection(collection);
|
|
}, (db) => {
|
|
const dao = new Dao(db);
|
|
const collection = dao.findCollectionByNameOrId("bulletin_posts");
|
|
return dao.deleteCollection(collection);
|
|
})
|