Convert backend to use jsonb fields.

This commit is contained in:
SergeantPanda 2025-09-02 09:48:54 -05:00
parent 6f6c28ca7c
commit 246b00e2bf
4 changed files with 8 additions and 17 deletions

View file

@ -761,10 +761,6 @@ export default class API {
}
static async addPlaylist(values) {
if (values.custom_properties) {
values.custom_properties = JSON.stringify(values.custom_properties);
}
try {
let body = null;
if (values.file) {

View file

@ -38,8 +38,7 @@ const M3UFilter = ({ filter = null, m3u, isOpen, onClose }) => {
filter_type: filter.filter_type,
regex_pattern: filter.regex_pattern,
exclude: filter.exclude,
case_sensitive:
JSON.parse(filter.custom_properties || '{}').case_sensitive ?? true,
case_sensitive: (filter.custom_properties || {}).case_sensitive ?? true,
});
} else {
form.reset();

View file

@ -101,22 +101,18 @@ const M3UGroupFilter = ({ playlist = null, isOpen, onClose }) => {
const submit = async () => {
setIsLoading(true);
try {
// Prepare groupStates for API: custom_properties must be stringified
// Prepare groupStates for API
// Send ALL group states like the original code did, don't filter by enabled changes
const groupSettings = groupStates.map((state) => ({
...state,
custom_properties: state.custom_properties
? JSON.stringify(state.custom_properties)
: undefined,
custom_properties: state.custom_properties || undefined,
}));
const categorySettings = movieCategoryStates
.concat(seriesCategoryStates)
.map((state) => ({
...state,
custom_properties: state.custom_properties
? JSON.stringify(state.custom_properties)
: undefined,
custom_properties: state.custom_properties || undefined,
}))
.filter((state) => state.enabled !== state.original_enabled);

View file

@ -288,9 +288,9 @@ export default function TVChannelGuide({ startDate, endDate }) {
channel: `${channel.id}`,
start_time: program.start_time,
end_time: program.end_time,
custom_properties: JSON.stringify({
custom_properties: {
program,
}),
},
});
notifications.show({ title: 'Recording scheduled' });
};
@ -353,7 +353,7 @@ export default function TVChannelGuide({ startDate, endDate }) {
// Check if this program has a recording
const programRecording = recordings.find((recording) => {
if (recording.custom_properties) {
const customProps = JSON.parse(recording.custom_properties);
const customProps = recording.custom_properties || {};
if (customProps.program && customProps.program.id == program.id) {
return true;
}
@ -513,7 +513,7 @@ export default function TVChannelGuide({ startDate, endDate }) {
// Check if we have a recording for this program
const recording = recordings.find((recording) => {
if (recording.custom_properties) {
const customProps = JSON.parse(recording.custom_properties);
const customProps = recording.custom_properties || {};
if (customProps.program && customProps.program.id == program.id) {
return recording;
}