Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/issue 53 #65

Merged
merged 22 commits into from
Jul 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
70b624a
.
JUDONGHYEOK Jun 28, 2021
3c02b19
cra client폴더로 생성/util 폴더에 css 요소 지정/app.js에서 routing
SingTheCode Jun 29, 2021
9612448
Merge branch 'develop' into feature/Issue-20
SingTheCode Jun 29, 2021
a2179af
사용하지 않는 파일 정리
SingTheCode Jul 1, 2021
1e268c2
import 에러 해결 & NavBar, Main 컴포넌트 틀 구현
SingTheCode Jul 1, 2021
acb67d6
Merge pull request #21 from JNU-econovation/feature/Issue-20
SingTheCode Jul 2, 2021
d08912c
nav_bar image 대신 이모지입력 & 글씨체 설정
SingTheCode Jul 4, 2021
e0aa6b4
Merge pull request #24 from JNU-econovation/feature/Issue-20
SingTheCode Jul 4, 2021
f9c5773
로그인,회원가입,게시글구현
Daae-Kim Jul 24, 2021
7721250
로그인, 회원가입 구현
Daae-Kim Jul 25, 2021
e247d23
Delete user.js
Daae-Kim Jul 25, 2021
86bea62
Sequelize 완성
Daae-Kim Jul 28, 2021
1908969
requestProjects api 구현
Daae-Kim Jul 28, 2021
e6ea23d
요청작 생성api 및 멀터 완성
Daae-Kim Jul 29, 2021
5bd8bdc
s3연결
Daae-Kim Jul 29, 2021
5ef50f4
Update .env
Daae-Kim Jul 29, 2021
565fc17
Update config.json
Daae-Kim Jul 29, 2021
cd7c2ac
mainAPI구현
Daae-Kim Jul 29, 2021
a2f4b0f
메인, 요청작 생성, 요청작 상세(진행중)
Daae-Kim Jul 29, 2021
51ebdf6
Merge branch 'feature/Issue-53' of https://github.com/JNU-econovation…
Daae-Kim Jul 29, 2021
337179a
메인, 요청작생성, 기여작 생성, 요청작 상세페이지(진행중)
Daae-Kim Jul 29, 2021
b7687ac
API-메인, 요청작생성, 요청작 상세, 기여작생성
Daae-Kim Jul 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
package-lock.json
node_modules/**/package.json
package.json
project/
node_modules/
node_modules/**/*.json
*.json
body-parser/
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
*/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# COLLUSIC

#### 온라인 프로듀싱 협업 프로젝트
#### 온라인 프로듀싱 협업 프로젝트!

프로듀싱하는데 협업을 하고 싶다?

Expand All @@ -10,8 +10,6 @@

"작곡가"들을 위한 온라인 프로듀싱 협업 서비스🎤🎶🎸🎹



#### 프로젝트 규칙

Collusic 프로젝트를 처음 접하시는 같이 개발하는 개발자에게 전합니다. 이 규칙은 서로의 코드를 더 잘 이해할 수 있게 정해진 규칙입니다. 때문에 언제든지 모든 개발자가 동의한다면 변경이 가능합니다. 규칙을 준수하여 서로의 발전을 도와줍시다.
Expand All @@ -28,8 +26,6 @@ Collusic 프로젝트를 처음 접하시는 같이 개발하는 개발자에게
8. 컴포넌트를 제외한 함수의 이름은 동작의 의미가 담겨 있어야 합니다.
9. 컴포넌트 코드가 들어간 파일의 확장자는 jsx를 사용합니다.



##### 코딩컨벤션

else 사용을 최대한 자제합니다.
Expand All @@ -48,8 +44,6 @@ else 사용을 최대한 자제합니다.

게터/세터 속성 사용을 금지합니다.



규칙1, 2, 3, 5, 6, 9

https://developerfarm.wordpress.com/2012/02/03/object_calisthenics_summary/
Expand Down
5 changes: 5 additions & 0 deletions backend/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
COOKIE_SECRET=cookiesecret
NODE_ENV=test
S3_ACCESS_KEY=AKIAQWGLZ6TSBFMZV4XC
S3_SECRET_KEY=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
S3_REGION=ap-northeast-2
74 changes: 74 additions & 0 deletions backend/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
const express = require("express");
const cookieParser = require("cookie-parser");
const morgan = require("morgan");
const path = require("path");
const session = require("express-session");
const nunjucks = require("nunjucks");
const dotenv = require("dotenv");
const passport = require("passport");
dotenv.config();
const pageRouter = require("./routes/page");
const authRouter = require("./routes/auth");
const postRouter = require("./routes/post");
const { sequelize } = require("./models");
const passportConfig = require("./passport");
const cors = require("cors");

const app = express();
passportConfig();
app.set("port", process.env.PORT || 8001);
app.set("view engine", "html");
nunjucks.configure("views", {
express: app,
watch: true,
});
sequelize
.sync({ force: false }) //sequelize가 초기화 될 때 DB에 필요한 테이블 생성
.then(() => {
console.log("데이터베이스 연결 성공");
})
.catch((err) => {
console.error(err);
});

app.use(morgan("dev"));
app.use(express.static(path.join(__dirname, "public")));
app.use("/img", express.static(path.join(__dirname, "uploads")));
app.use(cors());

app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(cookieParser(process.env.COOKIE_SECRET));
app.use(
session({
resave: false,
saveUninitialized: false,
secret: process.env.COOKIE_SECRET,
cookie: {
httpOnly: true,
secure: false,
},
})
);
app.use(passport.initialize());
app.use(passport.session());
app.use("/", pageRouter);
app.use("/auth", authRouter);
app.use("/post", postRouter);

app.use((req, res, next) => {
const error = new Error(`${req.method} ${req.url} 라우터가 없습니다.`);
error.status = 404;
next(error);
});

app.use((err, req, res, next) => {
res.locals.message = err.message;
res.locals.error = process.env.NODE_ENV !== "production" ? err : {};
res.status(err.status || 500);
res.render("error");
});

app.listen(app.get("port"), () => {
console.log(app.get("port"), "번 포트에서 대기중");
});
23 changes: 23 additions & 0 deletions backend/config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"development": {
"username": "root",
"password": "daaeda",
"database": "collusic",
"host": "127.0.0.1",
"dialect": "mysql"
},
"test": {
"username": "collusic",
"password": "collusic3717",
"database": "collusic",
"host": "54.180.156.26",
"dialect": "mysql"
},
"production": {
"username": "root",
"password": null,
"database": "database_production",
"host": "127.0.0.1",
"dialect": "mysql"
}
}
33 changes: 33 additions & 0 deletions backend/controllers/contributeProjects/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const router = require("express");
const {
isLoggedIn,
isNotLoggedIn,
upload_commit,
} = require("../../routes/middlewares");
const { Post, User, Comment } = require("../../models");
//field값

const createContriProjectAPI = async (req, res) => {
let id = req.params.id;
const commentpost = await Comment.create({
c_description: req.body.description,
c_audioFile: req.file.filename,
c_lyrics_text: req.body.lyrics_text,
pid: id,
selected_status: false,
});
if (!commentpost) {
res.status(400).json({
success: false,
});
} else {
res.status(200).json({
success: true,
commentpost: commentpost,
});
}
};

module.exports = {
createContriProjectAPI: createContriProjectAPI,
};
36 changes: 36 additions & 0 deletions backend/controllers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// const express = require("express");
// const router = express.Router();

// const userInformationAPI = (req, res) => {
// try {
// const myinfo = await User.findOne({
// attributes: ["email", "introduce"],
// where: {
// email: req.user.email,
// },
// });
// res.status(200).json({
// email: myinfo,
// });
// } catch (err) {
// res.status(400).json({
// error: err,
// });
// }
// };

const createContributeProjectAPI = (req, res) => {};
const readRequestProjectsAPI = (req, res) => {};
const readContributeProjectsAPI = (req, res) => {
if (!id) {
res.status(400).json({ error: "you don't send requestProject Id!" });
}

res.status(200).json({ contributeProject: projects });
};
module.exports = {
userInformationAPI,
createContributeProjectAPI,
readRequestProjectsAPI,
readContributeProjectsAPI,
};
24 changes: 24 additions & 0 deletions backend/controllers/mypage/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const express = require("express");
const router = express.Router();
const { isLoggedIn, isNotLoggedIn } = require("../../routes/middlewares");
const { Post, User } = require("../../models");
//field값
const readMyPageAPI = async (req, res, next) => {
try {
const myinfo = await User.findOne({
attributes: ["email", "introduce"],
where: {
email: req.user.email,
},
});
res.status(200).json({
email: myinfo,
});
} catch (err) {
res.status(400).json({ error: err });
}
};

module.exports = {
readMyPageAPI: readMyPageAPI,
};
100 changes: 100 additions & 0 deletions backend/controllers/requestProjects/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
const router = require("express");
const {
isLoggedIn,
isNotLoggedIn,
upload,
} = require("../../routes/middlewares");
const { Post, User, Comment } = require("../../models");
//field값

const createProjectAPI = async (req, res) => {
if (req.file) {
const post = await Post.create({
title: req.body.title,
description: req.body.description,
genre: req.body.genre,
mood: req.body.mood,
lyrics_text: req.body.lyrics_text,
audioFile: req.file.location,
music_field: Boolean(req.body.music_field),
lyrics_field: Boolean(req.body.lyrics_field),
instrument_field: Boolean(req.body.instrument_field),
});
if (!post) {
res.status(400).json({
success: false,
post: post,
});
} else {
const post = await Post.create({
title: req.body.title,
description: req.body.description,
genre: req.body.genre,
mood: req.body.mood,
lyrics_text: req.body.lyrics_text,
music_field: req.body.music_field,
lyrics_field: req.body.lyrics_field,
instrument_field: req.body.instrument_field,
uid: req.user.id,
});
}
if (!post) {
res.status(400).json({
sucess: false,
});
} else {
res.status(200).json({
sucess: true,
post: post,
});
}
}
};

const mainInfoAPI = async (req, res) => {
const maininfo = await Post.findAll({
attributes: [
"email",
"pid",
"title",
"music_field",
"lyrics_field",
"instrument_field",
"genre",
"mood",
"audioFile",
"lyrics_text",
],
});
if (!maininfo) {
res.status(400).json({
success: false,
});
} else {
res.status(200).json({ maininfo: maininfo });
}
};

const commentsAPI = async (req, res, next) => {
let id = req.params.id;
try {
const comments = await Comment.findAll({
include: {
model: Post,
where: { id: id },
},
});
const project = await Post.findAll({
where: { id: id },
});
res.status(200).json({ comments, project });
} catch (err) {
next(err);
}
};

module.exports = {
createProjectAPI: createProjectAPI,
mainInfoAPI: mainInfoAPI,
commentsAPI: commentsAPI,
};
2 changes: 2 additions & 0 deletions backend/controllers/user/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// const express = require("express");
// const router = express.Router();
Loading