class EventPub(db.Model): """ 이벤트당첨자 테이블 """ __tablename__ = 'event_pub' ep_idx = db.Column(db.Integer,nullable=False, primary_key=True) #일렬번호 cp_idx = db.Column(db.Integer, db.ForeignKey('company.cp_idx'), nullable=False) #업체번호 ev_idx = db.Column(db.Integer, db.ForeignKey('event.ev_idx'), nullable=False) #이벤트번호 mb_id = db.Column(db.Integer, db.ForeignKey('member.id'), nullable=False) #회원아이디 ep_regdate = db.Column(db.String(40), nullable=False,) #날짜 company = db.relationship('Company', back_populates='event_pub') event = db.relationship('Event', back_populates='event_pub')
class Review(db.Model): """ 리뷰 테이블 """ __tablename__ = 'review' rv_idx = db.Column(db.Integer, nullable=False, primary_key=True) #일렬번호 rv_pidx = db.Column(db.Integer) #부모일렬번호 - 답변일 때 부모일렬번호가 들어감 mb_id = db.Column(db.Integer, db.ForeignKey('member.id'), nullable=False) #회원아이디 cp_idx = db.Column(db.Integer, db.ForeignKey('company.cp_idx'), nullable=False) #업체번호 rv_star = db.Column(db.Integer) #별점 rv_content = db.Column(db.Text, nullable=False) #글내용 rv_regdate = db.Column(db.String(20), nullable=False) #등록일자 rv_edtdate = db.Column(db.String(20)) #수정일자 rv_ip = db.Column(db.String(20)) #아이피
class AdPeriod(db.Model): """ 광고기한 테이블 """ __tablename__ = 'ad_period' ap_idx = db.Column(db.Integer, nullable=False, primary_key=True) cp_idx = db.Column(db.Integer, db.ForeignKey('company.cp_idx'), nullable=False) mb_id = db.Column(db.Integer, db.ForeignKey('member.id'), nullable=False) ap_type = db.Column(db.String(1), nullable=False, default='N') #광고타입 M:메인, N:일반 ap_showdate = db.Column(db.String(20), nullable=False) #노출기한 ap_regdate = db.Column(db.String(20), nullable=False) #등록일자 ap_edtdate = db.Column(db.String(20)) #수정일자
class Favorite(db.Model): """ 찜 테이블 """ __tablename__ = 'favorite' fv_idx = db.Column(db.Integer, nullable=False, primary_key=True) #일렬번호 mb_id = db.Column(db.Integer, db.ForeignKey('member.id'), nullable=False) #회원아이디 cp_idx = db.Column(db.Integer, db.ForeignKey('company.cp_idx'), nullable=False) #업체번호 fv_regdate = db.Column( db.String(20), nullable=False, ) #등록일자 fv_ip = db.Column(db.String(20)) #아이피
class AreaSub(db.Model): """ 지역 테이블 """ __tablename__ = 'area_sub' as_idx = db.Column(db.Integer, nullable=False, primary_key=True) am_idx = db.Column(db.Integer, db.ForeignKey('area_main.am_idx'), nullable=False) as_area = db.Column(db.String(20), nullable=False) # 강남/역삼/서초 as_step = db.Column(db.Integer) #노출순서 as_regdate = db.Column(db.String(20), nullable=False) #등록일자 as_edtdate = db.Column(db.String(20)) #수정일자 as_ip = db.Column(db.String(20)) #아이피 company = db.relationship('Company', backref='area_sub', lazy=True) def get_area_sub_object(self, company_object=False): area_sub = { 'as_idx': self.as_idx, 'am_idx': self.am_idx, 'as_area': self.as_area, 'as_step': self.as_step, 'as_regdate': self.as_regdate, 'as_edtdate': self.as_edtdate, 'as_ip': self.as_ip } if company_object: area_sub['company'] = [] for companys in self.company: area_sub['company'].append(companys.get_company_object()) return area_sub
class Event(db.Model): """ 이벤트 테이블 """ __tablename__ = 'event' ev_idx = db.Column(db.Integer, nullable=False, primary_key=True) #일렬번호 ev_type = db.Column(db.String(1), nullable=False) #이벤트타입 C:쿠폰, E:이벤트 cp_idx = db.Column(db.Integer, db.ForeignKey('company.cp_idx'), nullable=False) #업체번호 ev_title = db.Column(db.String(255), nullable=False) #이벤트제목 ev_sdate = db.Column( db.String(20), nullable=False, ) #시작일자 ev_edate = db.Column( db.String(20), nullable=False, ) #마감일자 ev_pubdate = db.Column( db.String(20), nullable=False, ) #당첨자발표날짜 ev_summary = db.Column( db.Text, nullable=False, ) #이벤트설명 ev_regdate = db.Column(db.String(20), nullable=False) #등록일자 ev_edtdate = db.Column(db.String(20)) #수정일자 ev_ip = db.Column(db.String(20)) #아이피 event_pub = db.relationship('EventPub', back_populates='event')
class Coupon(db.Model): """ 쿠폰 테이블 """ __tablename__ = 'coupon' cu_idx = db.Column(db.Integer, nullable=False, primary_key=True) mb_id = db.Column(db.Integer, db.ForeignKey('member.id'), nullable=False) cu_num = db.Column(db.String(20)) #쿠폰번호 cu_used = db.Column(db.String(1), nullable=False, default='0') #사용여부 0:미사용, 1:사용 cu_edate = db.Column(db.String(20), nullable=False) #사용만기날짜 cu_usedate = db.Column(db.String(20)) #사용날짜
class Viewlog(db.Model): """ 업체열람로그 테이블 """ __tablename__ = 'viewlog' vl_idx = db.Column(db.Integer, nullable=False, primary_key=True) vl_num = db.Column(db.Integer) #역인덱스용 최초 -1부터 추가시 감산한다. cp_idx = db.Column(db.Integer, db.ForeignKey('company.cp_idx'), nullable=False) #업체번호 mb_id = db.Column(db.String(40), nullable=False) #회원아이디 vl_regdate = db.Column(db.String(20), nullable=False) #등록일자 vl_ip = db.Column(db.String(20)) #아이피
class Files(db.Model): """ 파일 테이블 """ __tablename__ = 'files' fi_idx = db.Column(db.Integer, nullable=False, primary_key=True) mb_id = db.Column(db.Integer, db.ForeignKey('member.id')) #회원아이디 fi_gubun1 = db.Column(db.String(20)) #구분1 fi_gubun2 = db.Column(db.String(20)) #구분2 fi_gubun3 = db.Column(db.String(20)) #구분3 fi_rname = db.Column(db.String(255), nullable=False) #실제파일이름 fi_vname = db.Column(db.String(255), nullable=False) #가상파일이름 fi_is_img = db.Column(db.String(1), nullable=False) #이미지인지 아닌지 fi_mime_type = db.Column(db.String(20), nullable=False) #마임타입(파일종류) fi_size = db.Column(db.String(20)) #파일사이즈 fi_width = db.Column(db.String(6)) #이미지가로사이즈 fi_height = db.Column(db.String(6)) #이미지세로사이즈 fi_regdate = db.Column(db.String(20)) #아이피