mirror of
https://github.com/misskey-dev/misskey.git
synced 2025-12-28 06:54:10 +00:00
feat(backend): AvatarDecorationにcategoryを追加し、関連APIのプロパティ・戻り値にも反映
This commit is contained in:
parent
a33b003282
commit
54f2d7b4f7
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
export class AddCategoryToAvatarDecorations1766652173085 {
|
||||
name = 'AddCategoryToAvatarDecorations1766652173085';
|
||||
|
||||
/**
|
||||
* @param {QueryRunner} queryRunner
|
||||
*/
|
||||
async up(queryRunner) {
|
||||
await queryRunner.query('ALTER TABLE "avatar_decoration" ADD "category" character varying(128)');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {QueryRunner} queryRunner
|
||||
*/
|
||||
async down(queryRunner) {
|
||||
await queryRunner.query('ALTER TABLE "avatar_decoration" DROP COLUMN "category"');
|
||||
}
|
||||
};
|
||||
@ -36,4 +36,9 @@ export class MiAvatarDecoration {
|
||||
array: true, length: 128, default: '{}',
|
||||
})
|
||||
public roleIdsThatCanBeUsedThisDecoration: string[];
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
})
|
||||
public category: string | null;
|
||||
}
|
||||
|
||||
@ -55,6 +55,10 @@ export const meta = {
|
||||
format: 'id',
|
||||
},
|
||||
},
|
||||
category: {
|
||||
type: 'string',
|
||||
optional: false, nullable: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
@ -68,6 +72,7 @@ export const paramDef = {
|
||||
roleIdsThatCanBeUsedThisDecoration: { type: 'array', items: {
|
||||
type: 'string',
|
||||
} },
|
||||
category: { type: 'string', nullable: true },
|
||||
},
|
||||
required: ['name', 'description', 'url'],
|
||||
} as const;
|
||||
@ -84,6 +89,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
description: ps.description,
|
||||
url: ps.url,
|
||||
roleIdsThatCanBeUsedThisDecoration: ps.roleIdsThatCanBeUsedThisDecoration,
|
||||
category: ps.category,
|
||||
}, me);
|
||||
|
||||
return {
|
||||
@ -94,6 +100,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
description: created.description,
|
||||
url: created.url,
|
||||
roleIdsThatCanBeUsedThisDecoration: created.roleIdsThatCanBeUsedThisDecoration,
|
||||
category: created.category,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@ -60,6 +60,10 @@ export const meta = {
|
||||
format: 'id',
|
||||
},
|
||||
},
|
||||
category: {
|
||||
type: 'string',
|
||||
optional: true, nullable: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -95,6 +99,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
description: avatarDecoration.description,
|
||||
url: avatarDecoration.url,
|
||||
roleIdsThatCanBeUsedThisDecoration: avatarDecoration.roleIdsThatCanBeUsedThisDecoration,
|
||||
category: avatarDecoration.category,
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@ export const paramDef = {
|
||||
roleIdsThatCanBeUsedThisDecoration: { type: 'array', items: {
|
||||
type: 'string',
|
||||
} },
|
||||
category: { type: 'string', nullable: true },
|
||||
},
|
||||
required: ['id'],
|
||||
} as const;
|
||||
@ -45,6 +46,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
description: ps.description,
|
||||
url: ps.url,
|
||||
roleIdsThatCanBeUsedThisDecoration: ps.roleIdsThatCanBeUsedThisDecoration,
|
||||
category: ps.category,
|
||||
}, me);
|
||||
});
|
||||
}
|
||||
|
||||
@ -49,6 +49,10 @@ export const meta = {
|
||||
format: 'id',
|
||||
},
|
||||
},
|
||||
category: {
|
||||
type: 'string',
|
||||
optional: true, nullable: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -76,6 +80,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
description: decoration.description,
|
||||
url: decoration.url,
|
||||
roleIdsThatCanBeUsedThisDecoration: decoration.roleIdsThatCanBeUsedThisDecoration.filter(roleId => allRoles.some(role => role.id === roleId)),
|
||||
category: decoration.category,
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
@ -6918,6 +6918,7 @@ export interface operations {
|
||||
description: string;
|
||||
url: string;
|
||||
roleIdsThatCanBeUsedThisDecoration?: string[];
|
||||
category?: string | null;
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -6939,6 +6940,7 @@ export interface operations {
|
||||
description: string;
|
||||
url: string;
|
||||
roleIdsThatCanBeUsedThisDecoration: string[];
|
||||
category: string | null;
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -7090,6 +7092,7 @@ export interface operations {
|
||||
description: string;
|
||||
url: string;
|
||||
roleIdsThatCanBeUsedThisDecoration: string[];
|
||||
category?: string | null;
|
||||
}[];
|
||||
};
|
||||
};
|
||||
@ -7150,6 +7153,7 @@ export interface operations {
|
||||
description?: string;
|
||||
url?: string;
|
||||
roleIdsThatCanBeUsedThisDecoration?: string[];
|
||||
category?: string | null;
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -23600,6 +23604,7 @@ export interface operations {
|
||||
description: string;
|
||||
url: string;
|
||||
roleIdsThatCanBeUsedThisDecoration: string[];
|
||||
category?: string | null;
|
||||
}[];
|
||||
};
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user