[모바일 청첩장 사이트 만들기] 시리즈는, 모바일 청첩장을 사용자가 직접 수정 및 발행을 할 수 있는 서비스를 만드는 과정이다.
개발자 본인이 실제로 결혼을 하면서 무료 모바일청첩장 사이트들의 한계가 있음을 느끼고 (예를 들어, 사진 개수의 제한, 코로나 안내문구 넣을 공간이 없음, 투박한 디자인 등), 본인이 필요한것을 다 넣어서 직접 만들어버렸는데, 이것을 다른 예비신혼부부들에게 제공하면 좋겠다는 생각이 들어 백엔드 개발까지 결심하게되었다.
현재는 주문자가 필요한 사진들과 문구들을 보내면 2일이내에 모바일청첩장을 발행하는 서비스를 크몽에서 제공하고 있다.
크몽 서비스: kmong.com/gig/303997
샘플 화면: http://kyespace.com/wedding/sample
DB 설계부터 Java Spring 백엔드 개발, 프론트 개발, 배포까지 하나의 서비스를 개발하는데에 필요한 모든 부분을 다룰 예정이다.
서비스 개발을 하는 다른 개발자들에게 참고하면 좋은 글이 되길 희망한다.
DB 설계
서비스 기획을 마쳤다면 다음으로 할 일은 바로 DB 설계다.
어떤 데이터를 저장할지, 데이터 타입은 무엇일지, 서로의 관계성을 정하고, DDL*까지 완성하는 것이 목표다.DDL이란?
DDL이란?
DB의 데이터 구조를 정의하는데에 사용되는 명령어다.
지금의 경우 전부 CREATE 문들을 만들면 된다.
2021.03.09 - [Mysql] - SQL의 DDL, DML, DCL 뜻
DB 설계에 있어서 중요한 부분은 확장성이다.
기획에 맞춰 테이블 구조를 정해야하지만, 서비스가 확장되는 것을 고려해야한다.
예를 들면, 현재 1가지의 청첩장 템플릿을 고려하고있지만, 다양한 디자인을 제공하도록 템플릿이 추가될 수 있고,
꼭 모바일청첩장이 아니라 돌잔치 초대장을 제공할 수도 있다.
따라서 DB설계를 할 때 테이블명은 포괄적이게, 테이블을 논리적으로 분리해 설계하는 것이 좋다.
테이블
서비스 제공을 위해 필요한 테이블들은 다음과 같을 것이다.
테이블 | 내용 |
TB_USER | 유저 정보를 저장 |
TB_TEMPLATE | 초대장 템플릿의 정보 |
TB_TEMPLATE_PLAN, TB_TEMPLATE_FEATURE, TB_TEMPLATE_CONTENT_ITEM |
가격정책에 따라 템플릿에서 제공/제한할 기능 |
TB_USER_WORK | 유저의 작업물을 저장할 공간 |
TB_USER_QNA | 유저의 1:1 Q&A 를 저장할 공간 |
TB_NOTICE | 오픈소스 고지문, 개인정보보호, 이용약관 등 정보성 내용을 저장할 공간 |
DDL를 정의하기 전에 VSCode의 plantuml 플러그인을 이용해 테이블 구조 계획을 먼저 세울 것이다.
1. TB_USER
entity TB_USER {
*login_type: text(24) not null (ex. kakao)
*id: text(64) not null
--
password: varchar(128)
name: varchar(64)
email: varchar(64)
profile: text, json (ex, nickname, profile_image, thumbnail_image_url, email, address, phone, etc. in json format)
status: varchar(24) (ex, created/activated/deactivated/blocked/withdrawn)
last_signin_at: timestamp
last_password_changed_at: timestamp
registered_at: timestamp not null default now()
modified_at: timestamp not null default now()
}
login_type은 어떤 소셜로그인을 사용했는지, 아니면 직접 아이디 패스워드로 가입했는지 구분하기 위한 컬럼이다.
기획상 카카오로그인밖에 없지만 확장성을 위해 컬럼명을 포괄적이게 작명했다.
2. TB_TEMPLATE
템플릿의 종류와 상세 설명을 저장할 곳이기 때문에 WYSIWYG 에디터를 이용해 상세설명을 저장하고 보여줘야한다.
WYSIWYG* 에디터 중 강력하면서도 가벼운 Quill(github.com/quilljs/quill/)을 사용할 예정이고, DB에는 통째로 BLOB 형태로 저장할 예정이다. (참고할 사이트: dkfkslsksh.tistory.com/37 )
WYSIWYG (What You See is What You Get)
글꼴, 폰트 등이 적용된 텍스트. 주로 블로그 본문과 같은 텍스트 형태를 말한다.
entity TB_TEMPLATE {
*id: varchar(64) uuid, not null
--
name: varchar(64)
description: varchar(256)
url: text, json (ex. thumbnail_image, sample, sample_thankyou)
content: longblob
registered_at: timestamp not null default now()
modified_at: timestamp not null default now()
}
entity TB_TEMPLATE_FEATURE {
*template_id: varchar(64) not null <<FK>>
*feature: varchar(64) (ex. calendar, gallary_picture_count)
--
sort: int (0,1,...)
registered_at: timestamp not null default now()
modified_at: timestamp not null default now()
}
entity TB_TEMPLATE_PLAN {
*template_id: varchar(64) not null <<FK>>
*plan: varchar(64) (ex. standard, deluxe, premium)
--
description: varchar(256)
price: int
registered_at: timestamp not null default now()
modified_at: timestamp not null default now()
}
entity TB_TEMPLATE_PLAN_FEATURE {
*template_id: varchar(64) not null <<FK>>
*plan: varchar(64) (ex. standard, deluxe, premium)
*feature: varchar(64) (ex. calendar, gallary_picture_count)
--
value: varchar(128) (ex. yes, 21 )
comment: varchar(256)
registered_at: timestamp not null default now()
modified_at: timestamp not null default now()
}
entity TB_TEMPLATE_CONTENT_CATEGORY {
*template_id: varchar(64) not null <<FK>>
*category: varchar(64) (ex. host, content, etc)
--
name: varchar(64)
description: varchar(256)
sort: int (0,1,...)
registered_at: timestamp not null default now()
modified_at: timestamp not null default now()
}
entity TB_TEMPLATE_CONTENT_ITEM {
*id: varchar(64) uuid, not null
--
template_id: varchar(64) not null <<FK>>
category: varchar(64) (ex. )
item: varchar(64) (ex. date, gallary_pictures)
sort: int (0,1,...)
example_value: longtext, json
required: int(1) (true false)
registered_at: timestamp not null default now()
modified_at: timestamp not null default now()
}
BLOB 종류 | maximum length |
TINYBLOB | maximum length of 255 bytes |
BLOB | maximum length of 65,535 bytes |
MEDIUMBLOB | maximum length of 16,777,215 bytes |
LONGBLOB | maximum length of 4,294,967,295 bytes |
TB_USER_WORK
entity TB_USER_WORK {
*id: varchar(64) uuid, not null
--
user_id: varchar(64) not null <<FK>>
template_id: varchar(64) not null <<FK>>
plan: varchar(64) (ex. standard, deluxe, premium)
status: varchar(64) (ex. editing, published )
registered_at: timestamp not null default now()
modified_at: timestamp not null default now()
}
entity TB_USER_WORK_ITEM {
*user_work_id: varchar(64) <<FK>>
*template_content_id: varchar(64) <<FK>>
--
value: longtext, json
registered_at: timestamp not null default now()
modified_at: timestamp not null default now()
}
2021.04.12: 작성중.. 테이블 추가 및 업데이트될 예정
작성 Log :
2021.04.12: TB_TEMPLATE_FEATURE, TB_USER_WORK 등 테이블 추가
2021.04.09: Init
'서비스개발' 카테고리의 다른 글
Jenkins 재구동시 기존 데이터 연결 (0) | 2022.08.08 |
---|---|
소프트웨어 엔트로피란? (0) | 2022.02.07 |
[VSCode] 터미널 폰트 설정 (0) | 2022.01.17 |
콘솔에서 html 단순 파싱하기 (0) | 2022.01.10 |
[모바일 청첩장 사이트 만들기 #1] 준비 (0) | 2021.04.08 |