Commit 7176f8e0 authored by Choi Ga Young's avatar Choi Ga Young
Browse files

user, todo model, controller 작성

parent 3f4275dd
import { Todo } from '../db/index.js';
const AddTodo = async(req, res)=>{
}
export default{
AddTodo,
}
\ No newline at end of file
...@@ -14,7 +14,8 @@ const signup = async (req, res) => { ...@@ -14,7 +14,8 @@ const signup = async (req, res) => {
userID: userId, userID: userId,
password: password, password: password,
userName: userName, userName: userName,
studNum: userStudNum studNum: userStudNum,
role:"user"
}); });
res.status(201).json("success") res.status(201).json("success")
} catch (error) { } catch (error) {
......
import Sequelize from "sequelize";
const { DataTypes } = Sequelize;
const TodoModel = (sequelize) => {
const Todo = sequelize.define(
"todo",
{
id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
primaryKey: true
},
title: {
type: DataTypes.STRING
},
date: {
type: DataTypes.STRING
},
done: {
type: DataTypes.BOOLEAN,
defaultValue: false
}
},
{
timestamps: true,
freezeTableName: true,
tableName: "todos",
}
);
return Todo
};
export default TodoModel;
\ No newline at end of file
...@@ -7,6 +7,11 @@ const UserModel = (sequelize) => { ...@@ -7,6 +7,11 @@ const UserModel = (sequelize) => {
const User = sequelize.define( const User = sequelize.define(
"user", "user",
{ {
id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
primaryKey: true
},
userID: { userID: {
type: DataTypes.STRING type: DataTypes.STRING
}, },
...@@ -18,6 +23,9 @@ const UserModel = (sequelize) => { ...@@ -18,6 +23,9 @@ const UserModel = (sequelize) => {
}, },
studNum: { studNum: {
type: DataTypes.STRING type: DataTypes.STRING
},
role: {
type: DataTypes.STRING
} }
}, },
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment