init
This commit is contained in:
18
app/controllers/vtubers_controller.js
Normal file
18
app/controllers/vtubers_controller.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import Profile from '#models/profile';
|
||||
import Tag from '#models/tag';
|
||||
export default class VtubersController {
|
||||
async show({}) {
|
||||
const profile = await Profile.firstOrFail();
|
||||
const tags = await Tag.all();
|
||||
return { ...profile.serialize(), tags: tags.map((t) => t.name) };
|
||||
}
|
||||
async update({ request }) {
|
||||
const profile = await Profile.firstOrFail();
|
||||
const data = request.only(['name', 'avatarUrl', 'backgroundImageUrl', 'title', 'description', 'aboutText']);
|
||||
profile.merge(data);
|
||||
await profile.save();
|
||||
const tags = await Tag.all();
|
||||
return { ...profile.serialize(), tags: tags.map((t) => t.name) };
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=vtubers_controller.js.map
|
||||
Reference in New Issue
Block a user