mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2026-01-16 19:42:26 +01:00
feat: introduce feed management for individual and professor modules across frontend and backend services.
This commit is contained in:
@@ -0,0 +1,791 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
)
|
||||
|
||||
func init() {
|
||||
m.Register(func(app core.App) error {
|
||||
jsonData := `[
|
||||
{
|
||||
"createRule": null,
|
||||
"deleteRule": null,
|
||||
"fields": [
|
||||
{
|
||||
"autogeneratePattern": "[a-z0-9]{15}",
|
||||
"hidden": false,
|
||||
"id": "text3208210256",
|
||||
"max": 15,
|
||||
"min": 15,
|
||||
"name": "id",
|
||||
"pattern": "^[a-z0-9]+$",
|
||||
"presentable": false,
|
||||
"primaryKey": true,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text455797646",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "collectionRef",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text127846527",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "recordRef",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text1582905952",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "method",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate2990389176",
|
||||
"name": "created",
|
||||
"onCreate": true,
|
||||
"onUpdate": false,
|
||||
"presentable": false,
|
||||
"system": true,
|
||||
"type": "autodate"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate3332085495",
|
||||
"name": "updated",
|
||||
"onCreate": true,
|
||||
"onUpdate": true,
|
||||
"presentable": false,
|
||||
"system": true,
|
||||
"type": "autodate"
|
||||
}
|
||||
],
|
||||
"id": "pbc_2279338944",
|
||||
"indexes": [
|
||||
"CREATE INDEX ` + "`" + `idx_mfas_collectionRef_recordRef` + "`" + ` ON ` + "`" + `_mfas` + "`" + ` (collectionRef,recordRef)"
|
||||
],
|
||||
"listRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId",
|
||||
"name": "_mfas",
|
||||
"system": true,
|
||||
"type": "base",
|
||||
"updateRule": null,
|
||||
"viewRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId"
|
||||
},
|
||||
{
|
||||
"createRule": null,
|
||||
"deleteRule": null,
|
||||
"fields": [
|
||||
{
|
||||
"autogeneratePattern": "[a-z0-9]{15}",
|
||||
"hidden": false,
|
||||
"id": "text3208210256",
|
||||
"max": 15,
|
||||
"min": 15,
|
||||
"name": "id",
|
||||
"pattern": "^[a-z0-9]+$",
|
||||
"presentable": false,
|
||||
"primaryKey": true,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text455797646",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "collectionRef",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text127846527",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "recordRef",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"cost": 8,
|
||||
"hidden": true,
|
||||
"id": "password901924565",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "password",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "password"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": true,
|
||||
"id": "text3866985172",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "sentTo",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate2990389176",
|
||||
"name": "created",
|
||||
"onCreate": true,
|
||||
"onUpdate": false,
|
||||
"presentable": false,
|
||||
"system": true,
|
||||
"type": "autodate"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate3332085495",
|
||||
"name": "updated",
|
||||
"onCreate": true,
|
||||
"onUpdate": true,
|
||||
"presentable": false,
|
||||
"system": true,
|
||||
"type": "autodate"
|
||||
}
|
||||
],
|
||||
"id": "pbc_1638494021",
|
||||
"indexes": [
|
||||
"CREATE INDEX ` + "`" + `idx_otps_collectionRef_recordRef` + "`" + ` ON ` + "`" + `_otps` + "`" + ` (collectionRef, recordRef)"
|
||||
],
|
||||
"listRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId",
|
||||
"name": "_otps",
|
||||
"system": true,
|
||||
"type": "base",
|
||||
"updateRule": null,
|
||||
"viewRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId"
|
||||
},
|
||||
{
|
||||
"createRule": null,
|
||||
"deleteRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId",
|
||||
"fields": [
|
||||
{
|
||||
"autogeneratePattern": "[a-z0-9]{15}",
|
||||
"hidden": false,
|
||||
"id": "text3208210256",
|
||||
"max": 15,
|
||||
"min": 15,
|
||||
"name": "id",
|
||||
"pattern": "^[a-z0-9]+$",
|
||||
"presentable": false,
|
||||
"primaryKey": true,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text455797646",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "collectionRef",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text127846527",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "recordRef",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text2462348188",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "provider",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text1044722854",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "providerId",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate2990389176",
|
||||
"name": "created",
|
||||
"onCreate": true,
|
||||
"onUpdate": false,
|
||||
"presentable": false,
|
||||
"system": true,
|
||||
"type": "autodate"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate3332085495",
|
||||
"name": "updated",
|
||||
"onCreate": true,
|
||||
"onUpdate": true,
|
||||
"presentable": false,
|
||||
"system": true,
|
||||
"type": "autodate"
|
||||
}
|
||||
],
|
||||
"id": "pbc_2281828961",
|
||||
"indexes": [
|
||||
"CREATE UNIQUE INDEX ` + "`" + `idx_externalAuths_record_provider` + "`" + ` ON ` + "`" + `_externalAuths` + "`" + ` (collectionRef, recordRef, provider)",
|
||||
"CREATE UNIQUE INDEX ` + "`" + `idx_externalAuths_collection_provider` + "`" + ` ON ` + "`" + `_externalAuths` + "`" + ` (collectionRef, provider, providerId)"
|
||||
],
|
||||
"listRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId",
|
||||
"name": "_externalAuths",
|
||||
"system": true,
|
||||
"type": "base",
|
||||
"updateRule": null,
|
||||
"viewRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId"
|
||||
},
|
||||
{
|
||||
"createRule": null,
|
||||
"deleteRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId",
|
||||
"fields": [
|
||||
{
|
||||
"autogeneratePattern": "[a-z0-9]{15}",
|
||||
"hidden": false,
|
||||
"id": "text3208210256",
|
||||
"max": 15,
|
||||
"min": 15,
|
||||
"name": "id",
|
||||
"pattern": "^[a-z0-9]+$",
|
||||
"presentable": false,
|
||||
"primaryKey": true,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text455797646",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "collectionRef",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text127846527",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "recordRef",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text4228609354",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "fingerprint",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate2990389176",
|
||||
"name": "created",
|
||||
"onCreate": true,
|
||||
"onUpdate": false,
|
||||
"presentable": false,
|
||||
"system": true,
|
||||
"type": "autodate"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate3332085495",
|
||||
"name": "updated",
|
||||
"onCreate": true,
|
||||
"onUpdate": true,
|
||||
"presentable": false,
|
||||
"system": true,
|
||||
"type": "autodate"
|
||||
}
|
||||
],
|
||||
"id": "pbc_4275539003",
|
||||
"indexes": [
|
||||
"CREATE UNIQUE INDEX ` + "`" + `idx_authOrigins_unique_pairs` + "`" + ` ON ` + "`" + `_authOrigins` + "`" + ` (collectionRef, recordRef, fingerprint)"
|
||||
],
|
||||
"listRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId",
|
||||
"name": "_authOrigins",
|
||||
"system": true,
|
||||
"type": "base",
|
||||
"updateRule": null,
|
||||
"viewRule": "@request.auth.id != '' && recordRef = @request.auth.id && collectionRef = @request.auth.collectionId"
|
||||
},
|
||||
{
|
||||
"authAlert": {
|
||||
"emailTemplate": {
|
||||
"body": "<p>Hello,</p>\n<p>We noticed a login to your {APP_NAME} account from a new location.</p>\n<p>If this was you, you may disregard this email.</p>\n<p><strong>If this wasn't you, you should immediately change your {APP_NAME} account password to revoke access from all other locations.</strong></p>\n<p>\n Thanks,<br/>\n {APP_NAME} team\n</p>",
|
||||
"subject": "Login from a new location"
|
||||
},
|
||||
"enabled": true
|
||||
},
|
||||
"authRule": "",
|
||||
"authToken": {
|
||||
"duration": 86400
|
||||
},
|
||||
"confirmEmailChangeTemplate": {
|
||||
"body": "<p>Hello,</p>\n<p>Click on the button below to confirm your new email address.</p>\n<p>\n <a class=\"btn\" href=\"{APP_URL}/_/#/auth/confirm-email-change/{TOKEN}\" target=\"_blank\" rel=\"noopener\">Confirm new email</a>\n</p>\n<p><i>If you didn't ask to change your email address, you can ignore this email.</i></p>\n<p>\n Thanks,<br/>\n {APP_NAME} team\n</p>",
|
||||
"subject": "Confirm your {APP_NAME} new email address"
|
||||
},
|
||||
"createRule": null,
|
||||
"deleteRule": null,
|
||||
"emailChangeToken": {
|
||||
"duration": 1800
|
||||
},
|
||||
"fields": [
|
||||
{
|
||||
"autogeneratePattern": "[a-z0-9]{15}",
|
||||
"hidden": false,
|
||||
"id": "text3208210256",
|
||||
"max": 15,
|
||||
"min": 15,
|
||||
"name": "id",
|
||||
"pattern": "^[a-z0-9]+$",
|
||||
"presentable": false,
|
||||
"primaryKey": true,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"cost": 0,
|
||||
"hidden": true,
|
||||
"id": "password901924565",
|
||||
"max": 0,
|
||||
"min": 8,
|
||||
"name": "password",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "password"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "[a-zA-Z0-9]{50}",
|
||||
"hidden": true,
|
||||
"id": "text2504183744",
|
||||
"max": 60,
|
||||
"min": 30,
|
||||
"name": "tokenKey",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"exceptDomains": null,
|
||||
"hidden": false,
|
||||
"id": "email3885137012",
|
||||
"name": "email",
|
||||
"onlyDomains": null,
|
||||
"presentable": false,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "email"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "bool1547992806",
|
||||
"name": "emailVisibility",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": true,
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "bool256245529",
|
||||
"name": "verified",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": true,
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate2990389176",
|
||||
"name": "created",
|
||||
"onCreate": true,
|
||||
"onUpdate": false,
|
||||
"presentable": false,
|
||||
"system": true,
|
||||
"type": "autodate"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate3332085495",
|
||||
"name": "updated",
|
||||
"onCreate": true,
|
||||
"onUpdate": true,
|
||||
"presentable": false,
|
||||
"system": true,
|
||||
"type": "autodate"
|
||||
}
|
||||
],
|
||||
"fileToken": {
|
||||
"duration": 180
|
||||
},
|
||||
"id": "pbc_3142635823",
|
||||
"indexes": [
|
||||
"CREATE UNIQUE INDEX ` + "`" + `idx_tokenKey_pbc_3142635823` + "`" + ` ON ` + "`" + `_superusers` + "`" + ` (` + "`" + `tokenKey` + "`" + `)",
|
||||
"CREATE UNIQUE INDEX ` + "`" + `idx_email_pbc_3142635823` + "`" + ` ON ` + "`" + `_superusers` + "`" + ` (` + "`" + `email` + "`" + `) WHERE ` + "`" + `email` + "`" + ` != ''"
|
||||
],
|
||||
"listRule": null,
|
||||
"manageRule": null,
|
||||
"mfa": {
|
||||
"duration": 1800,
|
||||
"enabled": false,
|
||||
"rule": ""
|
||||
},
|
||||
"name": "_superusers",
|
||||
"oauth2": {
|
||||
"enabled": false,
|
||||
"mappedFields": {
|
||||
"avatarURL": "",
|
||||
"id": "",
|
||||
"name": "",
|
||||
"username": ""
|
||||
}
|
||||
},
|
||||
"otp": {
|
||||
"duration": 180,
|
||||
"emailTemplate": {
|
||||
"body": "<p>Hello,</p>\n<p>Your one-time password is: <strong>{OTP}</strong></p>\n<p><i>If you didn't ask for the one-time password, you can ignore this email.</i></p>\n<p>\n Thanks,<br/>\n {APP_NAME} team\n</p>",
|
||||
"subject": "OTP for {APP_NAME}"
|
||||
},
|
||||
"enabled": false,
|
||||
"length": 8
|
||||
},
|
||||
"passwordAuth": {
|
||||
"enabled": true,
|
||||
"identityFields": [
|
||||
"email"
|
||||
]
|
||||
},
|
||||
"passwordResetToken": {
|
||||
"duration": 1800
|
||||
},
|
||||
"resetPasswordTemplate": {
|
||||
"body": "<p>Hello,</p>\n<p>Click on the button below to reset your password.</p>\n<p>\n <a class=\"btn\" href=\"{APP_URL}/_/#/auth/confirm-password-reset/{TOKEN}\" target=\"_blank\" rel=\"noopener\">Reset password</a>\n</p>\n<p><i>If you didn't ask to reset your password, you can ignore this email.</i></p>\n<p>\n Thanks,<br/>\n {APP_NAME} team\n</p>",
|
||||
"subject": "Reset your {APP_NAME} password"
|
||||
},
|
||||
"system": true,
|
||||
"type": "auth",
|
||||
"updateRule": null,
|
||||
"verificationTemplate": {
|
||||
"body": "<p>Hello,</p>\n<p>Thank you for joining us at {APP_NAME}.</p>\n<p>Click on the button below to verify your email address.</p>\n<p>\n <a class=\"btn\" href=\"{APP_URL}/_/#/auth/confirm-verification/{TOKEN}\" target=\"_blank\" rel=\"noopener\">Verify</a>\n</p>\n<p>\n Thanks,<br/>\n {APP_NAME} team\n</p>",
|
||||
"subject": "Verify your {APP_NAME} email"
|
||||
},
|
||||
"verificationToken": {
|
||||
"duration": 259200
|
||||
},
|
||||
"viewRule": null
|
||||
},
|
||||
{
|
||||
"authAlert": {
|
||||
"emailTemplate": {
|
||||
"body": "<p>Hello,</p>\n<p>We noticed a login to your {APP_NAME} account from a new location.</p>\n<p>If this was you, you may disregard this email.</p>\n<p><strong>If this wasn't you, you should immediately change your {APP_NAME} account password to revoke access from all other locations.</strong></p>\n<p>\n Thanks,<br/>\n {APP_NAME} team\n</p>",
|
||||
"subject": "Login from a new location"
|
||||
},
|
||||
"enabled": true
|
||||
},
|
||||
"authRule": "",
|
||||
"authToken": {
|
||||
"duration": 604800
|
||||
},
|
||||
"confirmEmailChangeTemplate": {
|
||||
"body": "<p>Hello,</p>\n<p>Click on the button below to confirm your new email address.</p>\n<p>\n <a class=\"btn\" href=\"{APP_URL}/_/#/auth/confirm-email-change/{TOKEN}\" target=\"_blank\" rel=\"noopener\">Confirm new email</a>\n</p>\n<p><i>If you didn't ask to change your email address, you can ignore this email.</i></p>\n<p>\n Thanks,<br/>\n {APP_NAME} team\n</p>",
|
||||
"subject": "Confirm your {APP_NAME} new email address"
|
||||
},
|
||||
"createRule": "",
|
||||
"deleteRule": "id = @request.auth.id",
|
||||
"emailChangeToken": {
|
||||
"duration": 1800
|
||||
},
|
||||
"fields": [
|
||||
{
|
||||
"autogeneratePattern": "[a-z0-9]{15}",
|
||||
"hidden": false,
|
||||
"id": "text3208210256",
|
||||
"max": 15,
|
||||
"min": 15,
|
||||
"name": "id",
|
||||
"pattern": "^[a-z0-9]+$",
|
||||
"presentable": false,
|
||||
"primaryKey": true,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"cost": 0,
|
||||
"hidden": true,
|
||||
"id": "password901924565",
|
||||
"max": 0,
|
||||
"min": 8,
|
||||
"name": "password",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "password"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "[a-zA-Z0-9]{50}",
|
||||
"hidden": true,
|
||||
"id": "text2504183744",
|
||||
"max": 60,
|
||||
"min": 30,
|
||||
"name": "tokenKey",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"exceptDomains": null,
|
||||
"hidden": false,
|
||||
"id": "email3885137012",
|
||||
"name": "email",
|
||||
"onlyDomains": null,
|
||||
"presentable": false,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "email"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "bool1547992806",
|
||||
"name": "emailVisibility",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": true,
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "bool256245529",
|
||||
"name": "verified",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": true,
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text1579384326",
|
||||
"max": 255,
|
||||
"min": 0,
|
||||
"name": "name",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "file376926767",
|
||||
"maxSelect": 1,
|
||||
"maxSize": 0,
|
||||
"mimeTypes": [
|
||||
"image/jpeg",
|
||||
"image/png",
|
||||
"image/svg+xml",
|
||||
"image/gif",
|
||||
"image/webp"
|
||||
],
|
||||
"name": "avatar",
|
||||
"presentable": false,
|
||||
"protected": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"thumbs": null,
|
||||
"type": "file"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate2990389176",
|
||||
"name": "created",
|
||||
"onCreate": true,
|
||||
"onUpdate": false,
|
||||
"presentable": false,
|
||||
"system": false,
|
||||
"type": "autodate"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate3332085495",
|
||||
"name": "updated",
|
||||
"onCreate": true,
|
||||
"onUpdate": true,
|
||||
"presentable": false,
|
||||
"system": false,
|
||||
"type": "autodate"
|
||||
}
|
||||
],
|
||||
"fileToken": {
|
||||
"duration": 180
|
||||
},
|
||||
"id": "_pb_users_auth_",
|
||||
"indexes": [
|
||||
"CREATE UNIQUE INDEX ` + "`" + `idx_tokenKey__pb_users_auth_` + "`" + ` ON ` + "`" + `users` + "`" + ` (` + "`" + `tokenKey` + "`" + `)",
|
||||
"CREATE UNIQUE INDEX ` + "`" + `idx_email__pb_users_auth_` + "`" + ` ON ` + "`" + `users` + "`" + ` (` + "`" + `email` + "`" + `) WHERE ` + "`" + `email` + "`" + ` != ''"
|
||||
],
|
||||
"listRule": "id = @request.auth.id",
|
||||
"manageRule": null,
|
||||
"mfa": {
|
||||
"duration": 1800,
|
||||
"enabled": false,
|
||||
"rule": ""
|
||||
},
|
||||
"name": "users",
|
||||
"oauth2": {
|
||||
"enabled": false,
|
||||
"mappedFields": {
|
||||
"avatarURL": "avatar",
|
||||
"id": "",
|
||||
"name": "name",
|
||||
"username": ""
|
||||
}
|
||||
},
|
||||
"otp": {
|
||||
"duration": 180,
|
||||
"emailTemplate": {
|
||||
"body": "<p>Hello,</p>\n<p>Your one-time password is: <strong>{OTP}</strong></p>\n<p><i>If you didn't ask for the one-time password, you can ignore this email.</i></p>\n<p>\n Thanks,<br/>\n {APP_NAME} team\n</p>",
|
||||
"subject": "OTP for {APP_NAME}"
|
||||
},
|
||||
"enabled": false,
|
||||
"length": 8
|
||||
},
|
||||
"passwordAuth": {
|
||||
"enabled": true,
|
||||
"identityFields": [
|
||||
"email"
|
||||
]
|
||||
},
|
||||
"passwordResetToken": {
|
||||
"duration": 1800
|
||||
},
|
||||
"resetPasswordTemplate": {
|
||||
"body": "<p>Hello,</p>\n<p>Click on the button below to reset your password.</p>\n<p>\n <a class=\"btn\" href=\"{APP_URL}/_/#/auth/confirm-password-reset/{TOKEN}\" target=\"_blank\" rel=\"noopener\">Reset password</a>\n</p>\n<p><i>If you didn't ask to reset your password, you can ignore this email.</i></p>\n<p>\n Thanks,<br/>\n {APP_NAME} team\n</p>",
|
||||
"subject": "Reset your {APP_NAME} password"
|
||||
},
|
||||
"system": false,
|
||||
"type": "auth",
|
||||
"updateRule": "id = @request.auth.id",
|
||||
"verificationTemplate": {
|
||||
"body": "<p>Hello,</p>\n<p>Thank you for joining us at {APP_NAME}.</p>\n<p>Click on the button below to verify your email address.</p>\n<p>\n <a class=\"btn\" href=\"{APP_URL}/_/#/auth/confirm-verification/{TOKEN}\" target=\"_blank\" rel=\"noopener\">Verify</a>\n</p>\n<p>\n Thanks,<br/>\n {APP_NAME} team\n</p>",
|
||||
"subject": "Verify your {APP_NAME} email"
|
||||
},
|
||||
"verificationToken": {
|
||||
"duration": 259200
|
||||
},
|
||||
"viewRule": "id = @request.auth.id"
|
||||
}
|
||||
]`
|
||||
|
||||
return app.ImportCollectionsByMarshaledJSON([]byte(jsonData), false)
|
||||
}, func(app core.App) error {
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -27,6 +27,8 @@ type Feed struct {
|
||||
Created types.DateTime `db:"created" json:"created"`
|
||||
Updated types.DateTime `db:"updated" json:"updated"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Type string `db:"type" json:"type"` // "prof" or "student"
|
||||
User string `db:"user" json:"user"` // Relation to users table
|
||||
core.BaseModel
|
||||
}
|
||||
|
||||
|
||||
@@ -18,12 +18,13 @@ package db
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"htwkalender/data-manager/model"
|
||||
"time"
|
||||
|
||||
"github.com/pocketbase/dbx"
|
||||
"github.com/pocketbase/pocketbase"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/tools/types"
|
||||
"htwkalender/data-manager/model"
|
||||
"time"
|
||||
)
|
||||
|
||||
var _ core.RecordProxy = (*Feed)(nil)
|
||||
@@ -80,6 +81,22 @@ func (f *Feed) GetUpdated() types.DateTime {
|
||||
return f.GetDateTime("updated")
|
||||
}
|
||||
|
||||
func (f *Feed) GetType() string {
|
||||
return f.GetString("type")
|
||||
}
|
||||
|
||||
func (f *Feed) SetType(feedType string) {
|
||||
f.Set("type", feedType)
|
||||
}
|
||||
|
||||
func (f *Feed) GetUser() string {
|
||||
return f.GetString("user")
|
||||
}
|
||||
|
||||
func (f *Feed) SetUser(user string) {
|
||||
f.Set("user", user)
|
||||
}
|
||||
|
||||
func newFeed(record *core.Record) *Feed {
|
||||
return &Feed{
|
||||
BaseRecordProxy: core.BaseRecordProxy{Record: record},
|
||||
@@ -99,6 +116,13 @@ func NewFeed(collection *core.Collection, feed model.Feed) (*Feed, error) {
|
||||
dbFeed.SetModules(feed.Modules)
|
||||
dbFeed.SetRetrieved(feed.Retrieved)
|
||||
dbFeed.SetDeleted(feed.Deleted)
|
||||
// Set type to "student" as default if not specified
|
||||
if feed.Type == "" {
|
||||
dbFeed.SetType("student")
|
||||
} else {
|
||||
dbFeed.SetType(feed.Type)
|
||||
}
|
||||
dbFeed.SetUser(feed.User)
|
||||
|
||||
return dbFeed, nil
|
||||
}
|
||||
@@ -110,6 +134,8 @@ func (f *Feed) ToModel() model.Feed {
|
||||
Created: f.GetCreated(),
|
||||
Updated: f.GetUpdated(),
|
||||
Deleted: f.GetDeleted(),
|
||||
Type: f.GetType(),
|
||||
User: f.GetUser(),
|
||||
BaseModel: core.BaseModel{
|
||||
Id: f.GetId(),
|
||||
},
|
||||
@@ -143,6 +169,8 @@ func FindFeedByToken(app *pocketbase.PocketBase, token string) (*model.Feed, err
|
||||
feed.Modules = record.GetString("modules")
|
||||
feed.Retrieved = record.GetDateTime("retrieved")
|
||||
feed.Deleted = record.GetBool("deleted")
|
||||
feed.Type = record.GetString("type")
|
||||
feed.User = record.GetString("user")
|
||||
|
||||
//update retrieved time if the is not marked as deleted
|
||||
if !record.GetBool("deleted") {
|
||||
|
||||
@@ -2,9 +2,10 @@ package grpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/pocketbase/pocketbase"
|
||||
pb "htwkalender/common/genproto/modules"
|
||||
"htwkalender/data-manager/service/db"
|
||||
|
||||
"github.com/pocketbase/pocketbase"
|
||||
)
|
||||
|
||||
type FeedServiceHandler struct {
|
||||
@@ -25,9 +26,17 @@ func (s *FeedServiceHandler) GetFeed(ctx context.Context, in *pb.GetFeedRequest)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Implement your logic here to fetch feed data based on the UUID
|
||||
// Example response
|
||||
pbFeed := feedToProto(feed)
|
||||
|
||||
// If feed has a user linked, fetch the user's email
|
||||
if feed.User != "" {
|
||||
user, err := s.app.FindRecordById("users", feed.User)
|
||||
if err == nil && user != nil {
|
||||
pbFeed.UserEmail = user.Email()
|
||||
}
|
||||
}
|
||||
|
||||
return &pb.GetFeedResponse{
|
||||
Feed: feedToProto(feed),
|
||||
Feed: pbFeed,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -40,5 +40,7 @@ func feedToProto(feed *model.Feed) *pb.Feed {
|
||||
Retrieved: feed.Retrieved.String(),
|
||||
Modules: feed.Modules,
|
||||
Deleted: feed.Deleted,
|
||||
Type: feed.Type,
|
||||
User: feed.User,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,17 +18,33 @@ package ical
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/pocketbase/pocketbase"
|
||||
"github.com/pocketbase/pocketbase/apis"
|
||||
"htwkalender/data-manager/model"
|
||||
"htwkalender/data-manager/service/db"
|
||||
|
||||
"github.com/pocketbase/pocketbase"
|
||||
"github.com/pocketbase/pocketbase/apis"
|
||||
)
|
||||
|
||||
func CreateIndividualFeed(modules []model.FeedCollection, pb *pocketbase.PocketBase) (string, error) {
|
||||
return CreateIndividualFeedWithType(modules, "", "", pb)
|
||||
}
|
||||
|
||||
// CreateIndividualFeedWithType creates a feed with specified type and user
|
||||
func CreateIndividualFeedWithType(modules []model.FeedCollection, feedType string, userId string, pb *pocketbase.PocketBase) (string, error) {
|
||||
var icalFeed model.Feed
|
||||
jsonModules, _ := json.Marshal(modules)
|
||||
icalFeed.Modules = string(jsonModules)
|
||||
|
||||
// Set feed type (defaults to "student" in SaveFeed if not provided)
|
||||
if feedType != "" {
|
||||
icalFeed.Type = feedType
|
||||
}
|
||||
|
||||
// Set user relation for professor feeds
|
||||
if userId != "" {
|
||||
icalFeed.User = userId
|
||||
}
|
||||
|
||||
collection, dbError := pb.FindCollectionByNameOrId("feeds")
|
||||
if dbError != nil {
|
||||
return "", apis.NewNotFoundError("Collection could not be found", dbError)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package professor
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"htwkalender/data-manager/model"
|
||||
"log/slog"
|
||||
"strings"
|
||||
|
||||
commonProf "htwkalender/common/professor"
|
||||
|
||||
"github.com/pocketbase/dbx"
|
||||
"github.com/pocketbase/pocketbase"
|
||||
@@ -20,30 +20,12 @@ func NewProfessorService(app *pocketbase.PocketBase) *ProfessorService {
|
||||
|
||||
func (s *ProfessorService) GetModulesForProfessor(email string) ([]model.ModuleDTO, error) {
|
||||
// Extract name from email
|
||||
// Format: firstname.lastname@htwk-leipzig.de
|
||||
parts := strings.Split(email, "@")
|
||||
if len(parts) != 2 {
|
||||
return nil, fmt.Errorf("invalid email format")
|
||||
}
|
||||
|
||||
nameParts := strings.Split(parts[0], ".")
|
||||
if len(nameParts) < 2 {
|
||||
slog.Warn("Email does not contain dot separator", "email", email)
|
||||
firstName, lastName, err := commonProf.ExtractNameFromEmail(email)
|
||||
if err != nil {
|
||||
slog.Warn("Failed to extract name from email", "email", email, "error", err)
|
||||
return []model.ModuleDTO{}, nil
|
||||
}
|
||||
|
||||
// Extract first and last name
|
||||
firstName := nameParts[0]
|
||||
lastName := nameParts[len(nameParts)-1]
|
||||
|
||||
// Capitalize first letter
|
||||
if len(firstName) > 0 {
|
||||
firstName = strings.ToUpper(firstName[:1]) + firstName[1:]
|
||||
}
|
||||
if len(lastName) > 0 {
|
||||
lastName = strings.ToUpper(lastName[:1]) + lastName[1:]
|
||||
}
|
||||
|
||||
slog.Info("Searching for modules for professor", "firstName", firstName, "lastName", lastName, "email", email)
|
||||
|
||||
// First, get all distinct modules with their professors
|
||||
@@ -57,7 +39,7 @@ func (s *ProfessorService) GetModulesForProfessor(email string) ([]model.ModuleD
|
||||
}
|
||||
|
||||
var allEvents []EventProf
|
||||
err := s.app.DB().
|
||||
err = s.app.DB().
|
||||
Select("Name", "EventType", "Prof", "course", "semester", "uuid").
|
||||
From("events").
|
||||
Where(dbx.NewExp("Prof != ''")).
|
||||
@@ -74,7 +56,7 @@ func (s *ProfessorService) GetModulesForProfessor(email string) ([]model.ModuleD
|
||||
seenModules := make(map[string]bool) // key: Name+Course to avoid duplicates
|
||||
|
||||
for _, event := range allEvents {
|
||||
score := calculateConfidenceScore(event.Prof, firstName, lastName)
|
||||
score := commonProf.CalculateConfidenceScore(event.Prof, firstName, lastName)
|
||||
if score > 0 { // Include all modules with any match
|
||||
key := event.Name + "|" + event.Course
|
||||
if !seenModules[key] {
|
||||
@@ -95,190 +77,3 @@ func (s *ProfessorService) GetModulesForProfessor(email string) ([]model.ModuleD
|
||||
slog.Info("Found modules for professor", "count", len(modules), "lastName", lastName)
|
||||
return modules, nil
|
||||
}
|
||||
|
||||
// calculateConfidenceScore returns a score from 0.0 to 1.0 indicating how confident we are
|
||||
// that this professor string matches the given first and last name
|
||||
// 1.0 = perfect match (both first and last name exact)
|
||||
// 0.7-0.9 = good match (last name exact, first name fuzzy or present)
|
||||
// 0.4-0.6 = possible match (last name fuzzy or partial)
|
||||
// 0.1-0.3 = weak match (last name substring)
|
||||
// 0.0 = no match
|
||||
func calculateConfidenceScore(profString, firstName, lastName string) float64 {
|
||||
// Normalize the professor string: remove common titles and split into words
|
||||
profString = strings.ToLower(profString)
|
||||
|
||||
// Remove common titles
|
||||
titles := []string{"prof.", "dr.", "arch.", "ing.", "dipl.", "m.sc.", "b.sc.", "ph.d."}
|
||||
for _, title := range titles {
|
||||
profString = strings.ReplaceAll(profString, title, "")
|
||||
}
|
||||
|
||||
// Split by spaces, hyphens, and other separators
|
||||
words := strings.FieldsFunc(profString, func(r rune) bool {
|
||||
return r == ' ' || r == '-' || r == ',' || r == '.'
|
||||
})
|
||||
|
||||
// Normalize firstName and lastName
|
||||
firstNameLower := strings.ToLower(firstName)
|
||||
lastNameLower := strings.ToLower(lastName)
|
||||
|
||||
lastNameExact := false
|
||||
lastNameFuzzy := false
|
||||
lastNameSubstring := false
|
||||
firstNameExact := false
|
||||
firstNameFuzzy := false
|
||||
|
||||
for _, word := range words {
|
||||
word = strings.TrimSpace(word)
|
||||
if word == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
// Check last name
|
||||
if word == lastNameLower {
|
||||
lastNameExact = true
|
||||
} else if levenshteinDistance(word, lastNameLower) <= 1 && len(lastNameLower) > 3 {
|
||||
lastNameFuzzy = true
|
||||
} else if strings.Contains(word, lastNameLower) || strings.Contains(lastNameLower, word) {
|
||||
lastNameSubstring = true
|
||||
}
|
||||
|
||||
// Check first name
|
||||
if word == firstNameLower {
|
||||
firstNameExact = true
|
||||
} else if levenshteinDistance(word, firstNameLower) <= 1 && len(firstNameLower) > 3 {
|
||||
firstNameFuzzy = true
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate confidence score based on matches
|
||||
score := 0.0
|
||||
|
||||
if lastNameExact {
|
||||
if firstNameExact {
|
||||
score = 1.0 // Perfect match
|
||||
} else if firstNameFuzzy {
|
||||
score = 0.9 // Excellent match
|
||||
} else {
|
||||
score = 0.8 // Good match (last name exact, no first name match)
|
||||
}
|
||||
} else if lastNameFuzzy {
|
||||
if firstNameExact || firstNameFuzzy {
|
||||
score = 0.6 // Decent match (fuzzy last name but first name matches)
|
||||
} else {
|
||||
score = 0.5 // Medium match (fuzzy last name, no first name)
|
||||
}
|
||||
} else if lastNameSubstring {
|
||||
score = 0.2 // Weak match (substring only)
|
||||
}
|
||||
|
||||
return score
|
||||
}
|
||||
|
||||
// matchesProfessor is deprecated, use calculateConfidenceScore instead
|
||||
func matchesProfessor(profString, firstName, lastName string) bool {
|
||||
// Normalize the professor string: remove common titles and split into words
|
||||
profString = strings.ToLower(profString)
|
||||
|
||||
// Remove common titles
|
||||
titles := []string{"prof.", "dr.", "arch.", "ing.", "dipl.", "m.sc.", "b.sc.", "ph.d."}
|
||||
for _, title := range titles {
|
||||
profString = strings.ReplaceAll(profString, title, "")
|
||||
}
|
||||
|
||||
// Split by spaces, hyphens, and other separators
|
||||
words := strings.FieldsFunc(profString, func(r rune) bool {
|
||||
return r == ' ' || r == '-' || r == ',' || r == '.'
|
||||
})
|
||||
|
||||
// Normalize firstName and lastName
|
||||
firstNameLower := strings.ToLower(firstName)
|
||||
lastNameLower := strings.ToLower(lastName)
|
||||
|
||||
lastNameFound := false
|
||||
firstNameFound := false
|
||||
|
||||
for _, word := range words {
|
||||
word = strings.TrimSpace(word)
|
||||
if word == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
// Exact match for last name
|
||||
if word == lastNameLower {
|
||||
lastNameFound = true
|
||||
}
|
||||
|
||||
// Exact match for first name (optional, but increases confidence)
|
||||
if word == firstNameLower {
|
||||
firstNameFound = true
|
||||
}
|
||||
|
||||
// Also check Levenshtein distance for typos
|
||||
if !lastNameFound && levenshteinDistance(word, lastNameLower) <= 1 {
|
||||
lastNameFound = true
|
||||
}
|
||||
if !firstNameFound && levenshteinDistance(word, firstNameLower) <= 1 {
|
||||
firstNameFound = true
|
||||
}
|
||||
}
|
||||
|
||||
// Match if last name is found (first name is optional for additional confidence)
|
||||
// We require at least the last name to match
|
||||
return lastNameFound
|
||||
}
|
||||
|
||||
// levenshteinDistance calculates the Levenshtein distance between two strings
|
||||
func levenshteinDistance(s1, s2 string) int {
|
||||
if len(s1) == 0 {
|
||||
return len(s2)
|
||||
}
|
||||
if len(s2) == 0 {
|
||||
return len(s1)
|
||||
}
|
||||
|
||||
// Create a 2D array for dynamic programming
|
||||
d := make([][]int, len(s1)+1)
|
||||
for i := range d {
|
||||
d[i] = make([]int, len(s2)+1)
|
||||
}
|
||||
|
||||
// Initialize first column and row
|
||||
for i := 0; i <= len(s1); i++ {
|
||||
d[i][0] = i
|
||||
}
|
||||
for j := 0; j <= len(s2); j++ {
|
||||
d[0][j] = j
|
||||
}
|
||||
|
||||
// Fill the matrix
|
||||
for i := 1; i <= len(s1); i++ {
|
||||
for j := 1; j <= len(s2); j++ {
|
||||
cost := 0
|
||||
if s1[i-1] != s2[j-1] {
|
||||
cost = 1
|
||||
}
|
||||
|
||||
d[i][j] = min(
|
||||
d[i-1][j]+1, // deletion
|
||||
d[i][j-1]+1, // insertion
|
||||
d[i-1][j-1]+cost, // substitution
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return d[len(s1)][len(s2)]
|
||||
}
|
||||
|
||||
func min(a, b, c int) int {
|
||||
if a < b {
|
||||
if a < c {
|
||||
return a
|
||||
}
|
||||
return c
|
||||
}
|
||||
if b < c {
|
||||
return b
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package professor
|
||||
|
||||
import (
|
||||
"htwkalender/data-manager/model"
|
||||
"htwkalender/data-manager/service/ical"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
|
||||
"github.com/pocketbase/pocketbase/apis"
|
||||
@@ -26,4 +29,35 @@ func RegisterRoutes(se *core.ServeEvent, service *ProfessorService) {
|
||||
|
||||
return e.JSON(http.StatusOK, modules)
|
||||
}).Bind(apis.RequireAuth())
|
||||
|
||||
// POST /api/professor/feed - Create a professor-specific feed
|
||||
se.Router.POST("/api/professor/feed", func(e *core.RequestEvent) error {
|
||||
record := e.Auth
|
||||
if record == nil {
|
||||
return apis.NewForbiddenError("Only authenticated users can access this endpoint", nil)
|
||||
}
|
||||
|
||||
userId := record.Id
|
||||
if userId == "" {
|
||||
return apis.NewBadRequestError("User ID not found", nil)
|
||||
}
|
||||
|
||||
// Bind the feed collection from request body
|
||||
var feedCollection []model.FeedCollection
|
||||
err := e.BindBody(&feedCollection)
|
||||
if err != nil {
|
||||
slog.Error("Failed to bind request body", "error", err)
|
||||
return apis.NewBadRequestError("Invalid request body", err)
|
||||
}
|
||||
|
||||
// Create feed with type="prof" and link to authenticated user
|
||||
token, err := ical.CreateIndividualFeedWithType(feedCollection, "prof", userId, service.app)
|
||||
if err != nil {
|
||||
slog.Error("Failed to create professor feed", "error", err, "userId", userId)
|
||||
return apis.NewInternalServerError("Failed to create professor feed", err)
|
||||
}
|
||||
|
||||
slog.Info("Created professor feed", "userId", userId, "token", token)
|
||||
return e.JSON(http.StatusOK, token)
|
||||
}).Bind(apis.RequireAuth())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user