mirror of
https://github.com/koreanbots/core.git
synced 2025-12-15 22:10:24 +00:00
chore: removed perm column
This commit is contained in:
parent
73d92a6d5a
commit
e73cc4861c
21
pages/api/v2/users/[id].ts
Normal file
21
pages/api/v2/users/[id].ts
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import { get } from '@utils/Query'
|
||||||
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
|
import nc from 'next-connect'
|
||||||
|
|
||||||
|
import ResponseWrapper from '@utils/ResponseWrapper'
|
||||||
|
|
||||||
|
const Users = nc<ApiRequest, NextApiResponse>()
|
||||||
|
.get(async(req, res) => {
|
||||||
|
console.log(req.query)
|
||||||
|
const user = await get.user.load(req.query?.id)
|
||||||
|
if(!user) return ResponseWrapper(res, { code: 404, message: '존재하지 않는 유저 입니다.' })
|
||||||
|
else return ResponseWrapper(res, { code: 200, data: user })
|
||||||
|
})
|
||||||
|
|
||||||
|
interface ApiRequest extends NextApiRequest {
|
||||||
|
query: {
|
||||||
|
id: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Users
|
||||||
@ -70,7 +70,7 @@ async function getBot(id: string, owners=true):Promise<Bot> {
|
|||||||
|
|
||||||
async function getUser(id: string, bots = true):Promise<User> {
|
async function getUser(id: string, bots = true):Promise<User> {
|
||||||
const res = await knex('users')
|
const res = await knex('users')
|
||||||
.select(['id', 'flags', 'perm', 'github'])
|
.select(['id', 'flags', 'github'])
|
||||||
.where({ id })
|
.where({ id })
|
||||||
if (res[0]) {
|
if (res[0]) {
|
||||||
const owned = await knex('bots')
|
const owned = await knex('bots')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user