refactor: migrate to typeorm 3.0 (#8443)
* wip * wip * wip * Update following.ts * wip * wip * wip * Update resolve-user.ts * maxQueryExecutionTime * wip * wip
This commit is contained in:
@ -33,7 +33,7 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||
createdAt: new Date(),
|
||||
userId: user.id,
|
||||
name: ps.name,
|
||||
} as UserGroup).then(x => UserGroups.findOneOrFail(x.identifiers[0]));
|
||||
} as UserGroup).then(x => UserGroups.findOneByOrFail(x.identifiers[0]));
|
||||
|
||||
// Push the owner
|
||||
await UserGroupJoinings.insert({
|
||||
|
@ -28,7 +28,7 @@ export const paramDef = {
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, user) => {
|
||||
const userGroup = await UserGroups.findOne({
|
||||
const userGroup = await UserGroups.findOneBy({
|
||||
id: ps.groupId,
|
||||
userId: user.id,
|
||||
});
|
||||
|
@ -31,7 +31,7 @@ export const paramDef = {
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, user) => {
|
||||
// Fetch the invitation
|
||||
const invitation = await UserGroupInvitations.findOne({
|
||||
const invitation = await UserGroupInvitations.findOneBy({
|
||||
id: ps.invitationId,
|
||||
});
|
||||
|
||||
|
@ -29,7 +29,7 @@ export const paramDef = {
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, user) => {
|
||||
// Fetch the invitation
|
||||
const invitation = await UserGroupInvitations.findOne({
|
||||
const invitation = await UserGroupInvitations.findOneBy({
|
||||
id: ps.invitationId,
|
||||
});
|
||||
|
||||
|
@ -52,7 +52,7 @@ export const paramDef = {
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, me) => {
|
||||
// Fetch the group
|
||||
const userGroup = await UserGroups.findOne({
|
||||
const userGroup = await UserGroups.findOneBy({
|
||||
id: ps.groupId,
|
||||
userId: me.id,
|
||||
});
|
||||
@ -67,7 +67,7 @@ export default define(meta, paramDef, async (ps, me) => {
|
||||
throw e;
|
||||
});
|
||||
|
||||
const joining = await UserGroupJoinings.findOne({
|
||||
const joining = await UserGroupJoinings.findOneBy({
|
||||
userGroupId: userGroup.id,
|
||||
userId: user.id,
|
||||
});
|
||||
@ -76,7 +76,7 @@ export default define(meta, paramDef, async (ps, me) => {
|
||||
throw new ApiError(meta.errors.alreadyAdded);
|
||||
}
|
||||
|
||||
const existInvitation = await UserGroupInvitations.findOne({
|
||||
const existInvitation = await UserGroupInvitations.findOneBy({
|
||||
userGroupId: userGroup.id,
|
||||
userId: user.id,
|
||||
});
|
||||
@ -90,7 +90,7 @@ export default define(meta, paramDef, async (ps, me) => {
|
||||
createdAt: new Date(),
|
||||
userId: user.id,
|
||||
userGroupId: userGroup.id,
|
||||
} as UserGroupInvitation).then(x => UserGroupInvitations.findOneOrFail(x.identifiers[0]));
|
||||
} as UserGroupInvitation).then(x => UserGroupInvitations.findOneByOrFail(x.identifiers[0]));
|
||||
|
||||
// 通知を作成
|
||||
createNotification(user.id, 'groupInvited', {
|
||||
|
@ -28,11 +28,11 @@ export const paramDef = {
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, me) => {
|
||||
const ownedGroups = await UserGroups.find({
|
||||
const ownedGroups = await UserGroups.findBy({
|
||||
userId: me.id,
|
||||
});
|
||||
|
||||
const joinings = await UserGroupJoinings.find({
|
||||
const joinings = await UserGroupJoinings.findBy({
|
||||
userId: me.id,
|
||||
...(ownedGroups.length > 0 ? {
|
||||
userGroupId: Not(In(ownedGroups.map(x => x.id))),
|
||||
|
@ -35,7 +35,7 @@ export const paramDef = {
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, me) => {
|
||||
// Fetch the group
|
||||
const userGroup = await UserGroups.findOne({
|
||||
const userGroup = await UserGroups.findOneBy({
|
||||
id: ps.groupId,
|
||||
});
|
||||
|
||||
|
@ -27,7 +27,7 @@ export const paramDef = {
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, me) => {
|
||||
const userGroups = await UserGroups.find({
|
||||
const userGroups = await UserGroups.findBy({
|
||||
userId: me.id,
|
||||
});
|
||||
|
||||
|
@ -43,7 +43,7 @@ export const paramDef = {
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, me) => {
|
||||
// Fetch the group
|
||||
const userGroup = await UserGroups.findOne({
|
||||
const userGroup = await UserGroups.findOneBy({
|
||||
id: ps.groupId,
|
||||
userId: me.id,
|
||||
});
|
||||
|
@ -35,7 +35,7 @@ export const paramDef = {
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, me) => {
|
||||
// Fetch the group
|
||||
const userGroup = await UserGroups.findOne({
|
||||
const userGroup = await UserGroups.findOneBy({
|
||||
id: ps.groupId,
|
||||
});
|
||||
|
||||
@ -43,7 +43,7 @@ export default define(meta, paramDef, async (ps, me) => {
|
||||
throw new ApiError(meta.errors.noSuchGroup);
|
||||
}
|
||||
|
||||
const joining = await UserGroupJoinings.findOne({
|
||||
const joining = await UserGroupJoinings.findOneBy({
|
||||
userId: me.id,
|
||||
userGroupId: userGroup.id,
|
||||
});
|
||||
|
@ -49,7 +49,7 @@ export const paramDef = {
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, me) => {
|
||||
// Fetch the group
|
||||
const userGroup = await UserGroups.findOne({
|
||||
const userGroup = await UserGroups.findOneBy({
|
||||
id: ps.groupId,
|
||||
userId: me.id,
|
||||
});
|
||||
@ -64,7 +64,7 @@ export default define(meta, paramDef, async (ps, me) => {
|
||||
throw e;
|
||||
});
|
||||
|
||||
const joining = await UserGroupJoinings.findOne({
|
||||
const joining = await UserGroupJoinings.findOneBy({
|
||||
userGroupId: userGroup.id,
|
||||
userId: user.id,
|
||||
});
|
||||
|
@ -36,7 +36,7 @@ export const paramDef = {
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, me) => {
|
||||
// Fetch the group
|
||||
const userGroup = await UserGroups.findOne({
|
||||
const userGroup = await UserGroups.findOneBy({
|
||||
id: ps.groupId,
|
||||
userId: me.id,
|
||||
});
|
||||
|
Reference in New Issue
Block a user