v12 (#5712)
Co-authored-by: MeiMei <30769358+mei23@users.noreply.github.com> Co-authored-by: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com>
This commit is contained in:
parent
a5955c1123
commit
f6154dc0af
871 changed files with 26140 additions and 71950 deletions
29
src/server/api/endpoints/clips/create.ts
Normal file
29
src/server/api/endpoints/clips/create.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import $ from 'cafy';
|
||||
import define from '../../define';
|
||||
import { genId } from '../../../../misc/gen-id';
|
||||
import { Clips } from '../../../../models';
|
||||
|
||||
export const meta = {
|
||||
tags: ['clips'],
|
||||
|
||||
requireCredential: true,
|
||||
|
||||
kind: 'write:account',
|
||||
|
||||
params: {
|
||||
name: {
|
||||
validator: $.str.range(1, 100)
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
const clip = await Clips.save({
|
||||
id: genId(),
|
||||
createdAt: new Date(),
|
||||
userId: user.id,
|
||||
name: ps.name,
|
||||
});
|
||||
|
||||
return await Clips.pack(clip);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue