* wip

* wip

* wip

* wip

* wip

* Update define.ts

* Update update.ts

* Update user.ts

* wip

* wip

* Update request.ts

* URL

* wip

* wip

* wip

* wip

* Update invite.ts

* Update create.ts
This commit is contained in:
syuilo 2021-03-24 11:05:37 +09:00 committed by GitHub
parent 62cc14c93b
commit ce340aba7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
109 changed files with 252 additions and 201 deletions

View file

@ -31,12 +31,12 @@ export const meta = {
};
export default define(meta, async (ps, user) => {
const userGroup = await UserGroups.save({
const userGroup = await UserGroups.insert({
id: genId(),
createdAt: new Date(),
userId: user.id,
name: ps.name,
} as UserGroup);
} as UserGroup).then(x => UserGroups.findOneOrFail(x.identifiers[0]));
// Push the owner
await UserGroupJoinings.insert({

View file

@ -96,12 +96,12 @@ export default define(meta, async (ps, me) => {
throw new ApiError(meta.errors.alreadyInvited);
}
const invitation = await UserGroupInvitations.save({
const invitation = await UserGroupInvitations.insert({
id: genId(),
createdAt: new Date(),
userId: user.id,
userGroupId: userGroup.id
} as UserGroupInvitation);
} as UserGroupInvitation).then(x => UserGroupInvitations.findOneOrFail(x.identifiers[0]));
// 通知を作成
createNotification(user.id, 'groupInvited', {

View file

@ -30,12 +30,12 @@ export const meta = {
};
export default define(meta, async (ps, user) => {
const userList = await UserLists.save({
const userList = await UserLists.insert({
id: genId(),
createdAt: new Date(),
userId: user.id,
name: ps.name,
} as UserList);
} as UserList).then(x => UserLists.findOneOrFail(x.identifiers[0]));
return await UserLists.pack(userList);
});

View file

@ -6,6 +6,7 @@ import { ApiError } from '../../error';
import { ID } from '@/misc/cafy-id';
import { Users } from '../../../../models';
import { In } from 'typeorm';
import { User } from '@/models/entities/user';
export const meta = {
desc: {
@ -81,9 +82,9 @@ export default define(meta, async (ps, me) => {
});
// リクエストされた通りに並べ替え
const _users = [];
const _users: User[] = [];
for (const id of ps.userIds) {
_users.push(users.find(x => x.id === id));
_users.push(users.find(x => x.id === id)!);
}
return await Promise.all(_users.map(u => Users.pack(u, me, {