Skip to content

Commit

Permalink
chore(app): update gitignore and add pb_hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieuher committed Dec 15, 2024
1 parent 2430368 commit c053dc0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ Thumbs.db

# Pocketbase
backend/*
!backend/pb_migrations
!backend/pb_migrations
!backend/pb_hooks
12 changes: 12 additions & 0 deletions backend/pb_hooks/tracks.pb.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/// <reference path="../pb_data/types.d.ts" />

// Track creation
onRecordCreateRequest((e) => {
if(e.requestInfo().auth) {
// Set owner to the user who created the track
e.record.set("owner", e.requestInfo().auth.get("id").toString());
// Activating the track
e.record.set("active", true);
}
e.next()
}, 'tracks');

0 comments on commit c053dc0

Please sign in to comment.