Fix: チャンネルとコミュニティが作成できない問題 / Chg: 左側メニューの選択中の線もアニメーションするように
This commit is contained in:
@@ -13,10 +13,7 @@ export default async function ChannelCreate(fastify: FastifyInstance) {
|
||||
if ("error" in req.token)
|
||||
return res.code(400).send(req.token);
|
||||
|
||||
const result = ChannelRepository.schema.safeParse({
|
||||
...req.body as any,
|
||||
userid: req.token.user.userid,
|
||||
});
|
||||
const result = ChannelRepository.schema.omit({ userid: true }).safeParse(req.body);
|
||||
|
||||
if (!result.success) {
|
||||
return res.code(400).send(InputError(result.error.issues));
|
||||
@@ -25,7 +22,10 @@ export default async function ChannelCreate(fastify: FastifyInstance) {
|
||||
try {
|
||||
const channelRepo = fastify.orm.em.getRepository(ChannelEntity);
|
||||
|
||||
const id = await channelRepo.createChannel(result.data);
|
||||
const id = await channelRepo.createChannel({
|
||||
...result.data,
|
||||
userid: req.token.user.id,
|
||||
});
|
||||
|
||||
return res.send({
|
||||
success: true,
|
||||
|
||||
@@ -13,10 +13,7 @@ export default async function CommunityCreate(fastify: FastifyInstance) {
|
||||
if ("error" in req.token)
|
||||
return res.code(400).send(req.token);
|
||||
|
||||
const result = CommunityRepository.schema.omit({ icon: true }).safeParse({
|
||||
...req.body as any,
|
||||
userid: req.token.user.userid,
|
||||
});
|
||||
const result = CommunityRepository.schema.omit({ userid: true, icon: true }).safeParse(req.body);
|
||||
|
||||
if (!result.success) {
|
||||
return res.code(400).send(InputError(result.error.issues));
|
||||
@@ -25,7 +22,10 @@ export default async function CommunityCreate(fastify: FastifyInstance) {
|
||||
try {
|
||||
const communityRepo = fastify.orm.em.getRepository(CommunityEntity);
|
||||
|
||||
const id = await communityRepo.createCommunity(result.data);
|
||||
const id = await communityRepo.createCommunity({
|
||||
...result.data,
|
||||
userid: req.token.user.id,
|
||||
});
|
||||
|
||||
return res.send({
|
||||
success: true,
|
||||
|
||||
Reference in New Issue
Block a user