mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
create stream info if not exists
This commit is contained in:
parent
db50c6ec5a
commit
12ae6862bf
@ -161,15 +161,26 @@ export default class StreamingController extends Controller {
|
||||
user_id,
|
||||
})
|
||||
|
||||
if (!info) {
|
||||
info = new StreamingInfo({
|
||||
user_id,
|
||||
})
|
||||
|
||||
await info.save()
|
||||
}
|
||||
|
||||
const category = await StreamingCategory.findOne({
|
||||
key: info.category
|
||||
})
|
||||
}).catch((err) => {
|
||||
console.error(err)
|
||||
return {}
|
||||
}) ?? {}
|
||||
|
||||
return res.json({
|
||||
...info.toObject(),
|
||||
["category"]: {
|
||||
key: category.key,
|
||||
label: category.label,
|
||||
key: category?.key ?? "unknown",
|
||||
label: category?.label ?? "Unknown",
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user