feat: 매출/매입 관리 API 구현
- 매출(Sale) 및 매입(Purchase) CRUD API 구현
- 문서번호 자동 생성 (SL/PU + YYYYMMDD + 시퀀스)
- 상태 관리 (draft → confirmed → invoiced)
- 확정(confirm) 및 요약(summary) 기능 추가
- BelongsToTenant, SoftDeletes 적용
- Swagger API 문서 작성 완료
추가된 파일:
- 마이그레이션: sales, purchases 테이블
- 모델: Sale, Purchase
- 서비스: SaleService, PurchaseService
- 컨트롤러: SaleController, PurchaseController
- FormRequest: Store/Update 4개
- Swagger: SaleApi.php, PurchaseApi.php
API 엔드포인트 (14개):
- GET/POST /v1/sales, /v1/purchases
- GET/PUT/DELETE /v1/{sales,purchases}/{id}
- POST /v1/{sales,purchases}/{id}/confirm
- GET /v1/{sales,purchases}/summary
2025-12-17 22:14:48 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Swagger\v1;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Tag(name="Sales", description="매출 관리")
|
|
|
|
|
*
|
|
|
|
|
* @OA\Schema(
|
|
|
|
|
* schema="Sale",
|
|
|
|
|
* type="object",
|
|
|
|
|
* description="매출 정보",
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(property="id", type="integer", example=1, description="매출 ID"),
|
|
|
|
|
* @OA\Property(property="tenant_id", type="integer", example=1, description="테넌트 ID"),
|
|
|
|
|
* @OA\Property(property="sale_number", type="string", example="SL202501150001", description="매출번호"),
|
|
|
|
|
* @OA\Property(property="sale_date", type="string", format="date", example="2025-01-15", description="매출일"),
|
|
|
|
|
* @OA\Property(property="client_id", type="integer", example=1, description="거래처 ID"),
|
|
|
|
|
* @OA\Property(property="supply_amount", type="number", format="float", example=1000000, description="공급가액"),
|
|
|
|
|
* @OA\Property(property="tax_amount", type="number", format="float", example=100000, description="세액"),
|
|
|
|
|
* @OA\Property(property="total_amount", type="number", format="float", example=1100000, description="합계"),
|
|
|
|
|
* @OA\Property(property="description", type="string", example="1월 매출", nullable=true, description="적요"),
|
|
|
|
|
* @OA\Property(property="status", type="string", enum={"draft","confirmed","invoiced"}, example="draft", description="상태"),
|
|
|
|
|
* @OA\Property(property="tax_invoice_id", type="integer", example=1, nullable=true, description="세금계산서 ID"),
|
|
|
|
|
* @OA\Property(property="deposit_id", type="integer", example=1, nullable=true, description="입금 연결 ID"),
|
|
|
|
|
* @OA\Property(property="client", type="object", nullable=true,
|
|
|
|
|
* @OA\Property(property="id", type="integer", example=1),
|
|
|
|
|
* @OA\Property(property="name", type="string", example="(주)테스트"),
|
|
|
|
|
* description="거래처 정보"
|
|
|
|
|
* ),
|
|
|
|
|
* @OA\Property(property="created_by", type="integer", example=1, nullable=true, description="생성자 ID"),
|
|
|
|
|
* @OA\Property(property="created_at", type="string", format="date-time"),
|
|
|
|
|
* @OA\Property(property="updated_at", type="string", format="date-time")
|
|
|
|
|
* )
|
|
|
|
|
*
|
|
|
|
|
* @OA\Schema(
|
|
|
|
|
* schema="SaleCreateRequest",
|
|
|
|
|
* type="object",
|
|
|
|
|
* required={"sale_date","client_id","supply_amount","tax_amount","total_amount"},
|
|
|
|
|
* description="매출 등록 요청",
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(property="sale_date", type="string", format="date", example="2025-01-15", description="매출일"),
|
|
|
|
|
* @OA\Property(property="client_id", type="integer", example=1, description="거래처 ID"),
|
|
|
|
|
* @OA\Property(property="supply_amount", type="number", format="float", example=1000000, description="공급가액"),
|
|
|
|
|
* @OA\Property(property="tax_amount", type="number", format="float", example=100000, description="세액"),
|
|
|
|
|
* @OA\Property(property="total_amount", type="number", format="float", example=1100000, description="합계"),
|
|
|
|
|
* @OA\Property(property="description", type="string", example="1월 매출", maxLength=1000, nullable=true, description="적요"),
|
|
|
|
|
* @OA\Property(property="deposit_id", type="integer", example=1, nullable=true, description="입금 연결 ID")
|
|
|
|
|
* )
|
|
|
|
|
*
|
|
|
|
|
* @OA\Schema(
|
|
|
|
|
* schema="SaleUpdateRequest",
|
|
|
|
|
* type="object",
|
|
|
|
|
* description="매출 수정 요청",
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(property="sale_date", type="string", format="date", example="2025-01-15", description="매출일"),
|
|
|
|
|
* @OA\Property(property="client_id", type="integer", example=1, description="거래처 ID"),
|
|
|
|
|
* @OA\Property(property="supply_amount", type="number", format="float", example=1000000, description="공급가액"),
|
|
|
|
|
* @OA\Property(property="tax_amount", type="number", format="float", example=100000, description="세액"),
|
|
|
|
|
* @OA\Property(property="total_amount", type="number", format="float", example=1100000, description="합계"),
|
|
|
|
|
* @OA\Property(property="description", type="string", example="1월 매출", maxLength=1000, nullable=true, description="적요"),
|
|
|
|
|
* @OA\Property(property="deposit_id", type="integer", example=1, nullable=true, description="입금 연결 ID")
|
|
|
|
|
* )
|
|
|
|
|
*
|
|
|
|
|
* @OA\Schema(
|
|
|
|
|
* schema="SaleSummary",
|
|
|
|
|
* type="object",
|
|
|
|
|
* description="매출 요약",
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(property="total_supply_amount", type="number", format="float", example=10000000, description="총 공급가액"),
|
|
|
|
|
* @OA\Property(property="total_tax_amount", type="number", format="float", example=1000000, description="총 세액"),
|
|
|
|
|
* @OA\Property(property="total_amount", type="number", format="float", example=11000000, description="총 합계"),
|
|
|
|
|
* @OA\Property(property="total_count", type="integer", example=10, description="총 건수"),
|
|
|
|
|
* @OA\Property(property="by_status", type="object", description="상태별 합계",
|
|
|
|
|
* @OA\Property(property="draft", type="object",
|
|
|
|
|
* @OA\Property(property="total", type="number", example=5500000),
|
|
|
|
|
* @OA\Property(property="count", type="integer", example=5)
|
|
|
|
|
* ),
|
|
|
|
|
* @OA\Property(property="confirmed", type="object",
|
|
|
|
|
* @OA\Property(property="total", type="number", example=5500000),
|
|
|
|
|
* @OA\Property(property="count", type="integer", example=5)
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
* )
|
feat: Phase 5 API 개발 완료 (사용자 초대, 알림설정, 계정관리, 거래명세서)
5.1 사용자 초대 기능:
- UserInvitation 마이그레이션, 모델, 서비스, 컨트롤러, Swagger
- 초대 발송/수락/취소/재발송 API
5.2 알림설정 확장:
- NotificationSetting 마이그레이션, 모델, 서비스, 컨트롤러, Swagger
- 채널별/유형별 알림 설정 관리
5.3 계정정보 수정 API:
- 회원탈퇴, 사용중지, 약관동의 관리
- AccountService, AccountController, Swagger
5.4 매출 거래명세서 API:
- 거래명세서 조회/발행/이메일발송
- SaleService 확장, Swagger 문서화
2025-12-19 14:52:53 +09:00
|
|
|
*
|
|
|
|
|
* @OA\Schema(
|
|
|
|
|
* schema="SaleStatementItem",
|
|
|
|
|
* type="object",
|
|
|
|
|
* description="거래명세서 품목",
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(property="description", type="string", example="1월 매출", description="품목 설명"),
|
|
|
|
|
* @OA\Property(property="quantity", type="integer", example=1, description="수량"),
|
|
|
|
|
* @OA\Property(property="unit_price", type="number", example=1000000, description="단가"),
|
|
|
|
|
* @OA\Property(property="supply_amount", type="number", example=1000000, description="공급가액"),
|
|
|
|
|
* @OA\Property(property="tax_amount", type="number", example=100000, description="세액"),
|
|
|
|
|
* @OA\Property(property="total_amount", type="number", example=1100000, description="합계")
|
|
|
|
|
* )
|
|
|
|
|
*
|
|
|
|
|
* @OA\Schema(
|
|
|
|
|
* schema="SaleStatementParty",
|
|
|
|
|
* type="object",
|
|
|
|
|
* description="거래명세서 거래 당사자 정보",
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(property="name", type="string", example="(주)테스트", description="상호"),
|
|
|
|
|
* @OA\Property(property="business_number", type="string", example="123-45-67890", description="사업자번호"),
|
|
|
|
|
* @OA\Property(property="representative", type="string", example="홍길동", description="대표자"),
|
|
|
|
|
* @OA\Property(property="address", type="string", example="서울시 강남구", description="주소"),
|
|
|
|
|
* @OA\Property(property="tel", type="string", example="02-1234-5678", description="전화번호"),
|
|
|
|
|
* @OA\Property(property="fax", type="string", example="02-1234-5679", description="팩스"),
|
|
|
|
|
* @OA\Property(property="email", type="string", example="test@example.com", description="이메일")
|
|
|
|
|
* )
|
|
|
|
|
*
|
|
|
|
|
* @OA\Schema(
|
|
|
|
|
* schema="SaleStatement",
|
|
|
|
|
* type="object",
|
|
|
|
|
* description="거래명세서 정보",
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(property="statement_number", type="string", example="STSL202501150001", description="거래명세서 번호"),
|
|
|
|
|
* @OA\Property(property="issued_at", type="string", format="date-time", nullable=true, description="발행일시"),
|
|
|
|
|
* @OA\Property(property="sale", ref="#/components/schemas/Sale"),
|
|
|
|
|
* @OA\Property(property="seller", ref="#/components/schemas/SaleStatementParty"),
|
|
|
|
|
* @OA\Property(property="buyer", ref="#/components/schemas/SaleStatementParty"),
|
|
|
|
|
* @OA\Property(property="items", type="array", @OA\Items(ref="#/components/schemas/SaleStatementItem")),
|
|
|
|
|
* @OA\Property(property="summary", type="object",
|
|
|
|
|
* @OA\Property(property="supply_amount", type="number", example=1000000),
|
|
|
|
|
* @OA\Property(property="tax_amount", type="number", example=100000),
|
|
|
|
|
* @OA\Property(property="total_amount", type="number", example=1100000)
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
*
|
|
|
|
|
* @OA\Schema(
|
|
|
|
|
* schema="SaleStatementIssueResponse",
|
|
|
|
|
* type="object",
|
|
|
|
|
* description="거래명세서 발행 응답",
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(property="statement_number", type="string", example="STSL202501150001", description="거래명세서 번호"),
|
|
|
|
|
* @OA\Property(property="issued_at", type="string", format="date-time", example="2025-01-15T10:30:00+09:00", description="발행일시")
|
|
|
|
|
* )
|
|
|
|
|
*
|
|
|
|
|
* @OA\Schema(
|
|
|
|
|
* schema="SaleStatementSendRequest",
|
|
|
|
|
* type="object",
|
|
|
|
|
* description="거래명세서 이메일 발송 요청",
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(property="email", type="string", format="email", example="buyer@example.com", nullable=true, description="수신자 이메일 (미입력 시 거래처 이메일 사용)"),
|
|
|
|
|
* @OA\Property(property="message", type="string", example="거래명세서를 발송합니다.", maxLength=1000, nullable=true, description="추가 메시지")
|
|
|
|
|
* )
|
|
|
|
|
*
|
|
|
|
|
* @OA\Schema(
|
|
|
|
|
* schema="SaleStatementSendResponse",
|
|
|
|
|
* type="object",
|
|
|
|
|
* description="거래명세서 발송 응답",
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(property="sent_to", type="string", format="email", example="buyer@example.com", description="발송 이메일"),
|
|
|
|
|
* @OA\Property(property="sent_at", type="string", format="date-time", example="2025-01-15T10:30:00+09:00", description="발송일시"),
|
|
|
|
|
* @OA\Property(property="statement_number", type="string", example="STSL202501150001", description="거래명세서 번호")
|
|
|
|
|
* )
|
2026-01-19 20:53:36 +09:00
|
|
|
*
|
|
|
|
|
* @OA\Schema(
|
|
|
|
|
* schema="SaleBulkIssueStatementRequest",
|
|
|
|
|
* type="object",
|
|
|
|
|
* required={"ids"},
|
|
|
|
|
* description="거래명세서 일괄 발행 요청",
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(property="ids", type="array", minItems=1, maxItems=100, description="발행할 매출 ID 목록 (최대 100개)",
|
|
|
|
|
* @OA\Items(type="integer", example=1)
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
*
|
|
|
|
|
* @OA\Schema(
|
|
|
|
|
* schema="SaleBulkIssueStatementResponse",
|
|
|
|
|
* type="object",
|
|
|
|
|
* description="거래명세서 일괄 발행 응답",
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(property="issued", type="integer", example=8, description="발행 성공 건수"),
|
|
|
|
|
* @OA\Property(property="failed", type="integer", example=2, description="발행 실패 건수"),
|
|
|
|
|
* @OA\Property(property="errors", type="object", description="실패 상세 (ID: 에러메시지)",
|
|
|
|
|
* @OA\AdditionalProperties(type="string", example="확정 상태가 아닌 매출입니다.")
|
|
|
|
|
* )
|
|
|
|
|
* )
|
feat: 매출/매입 관리 API 구현
- 매출(Sale) 및 매입(Purchase) CRUD API 구현
- 문서번호 자동 생성 (SL/PU + YYYYMMDD + 시퀀스)
- 상태 관리 (draft → confirmed → invoiced)
- 확정(confirm) 및 요약(summary) 기능 추가
- BelongsToTenant, SoftDeletes 적용
- Swagger API 문서 작성 완료
추가된 파일:
- 마이그레이션: sales, purchases 테이블
- 모델: Sale, Purchase
- 서비스: SaleService, PurchaseService
- 컨트롤러: SaleController, PurchaseController
- FormRequest: Store/Update 4개
- Swagger: SaleApi.php, PurchaseApi.php
API 엔드포인트 (14개):
- GET/POST /v1/sales, /v1/purchases
- GET/PUT/DELETE /v1/{sales,purchases}/{id}
- POST /v1/{sales,purchases}/{id}/confirm
- GET /v1/{sales,purchases}/summary
2025-12-17 22:14:48 +09:00
|
|
|
*/
|
|
|
|
|
class SaleApi
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Get(
|
|
|
|
|
* path="/api/v1/sales",
|
|
|
|
|
* tags={"Sales"},
|
|
|
|
|
* summary="매출 목록 조회",
|
|
|
|
|
* description="매출 목록을 조회합니다.",
|
|
|
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
|
|
|
*
|
|
|
|
|
* @OA\Parameter(name="search", in="query", description="검색어 (매출번호, 거래처명, 적요)", @OA\Schema(type="string")),
|
|
|
|
|
* @OA\Parameter(name="start_date", in="query", description="시작일", @OA\Schema(type="string", format="date")),
|
|
|
|
|
* @OA\Parameter(name="end_date", in="query", description="종료일", @OA\Schema(type="string", format="date")),
|
|
|
|
|
* @OA\Parameter(name="client_id", in="query", description="거래처 ID", @OA\Schema(type="integer")),
|
|
|
|
|
* @OA\Parameter(name="status", in="query", description="상태", @OA\Schema(type="string", enum={"draft","confirmed","invoiced"})),
|
|
|
|
|
* @OA\Parameter(name="sort_by", in="query", description="정렬 기준", @OA\Schema(type="string", enum={"sale_date","total_amount","created_at"}, default="sale_date")),
|
|
|
|
|
* @OA\Parameter(name="sort_dir", in="query", description="정렬 방향", @OA\Schema(type="string", enum={"asc","desc"}, default="desc")),
|
|
|
|
|
* @OA\Parameter(ref="#/components/parameters/Page"),
|
|
|
|
|
* @OA\Parameter(ref="#/components/parameters/Size"),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response=200,
|
|
|
|
|
* description="조회 성공",
|
|
|
|
|
*
|
|
|
|
|
* @OA\JsonContent(
|
|
|
|
|
* allOf={
|
|
|
|
|
*
|
|
|
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
|
|
|
* @OA\Schema(
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(
|
|
|
|
|
* property="data",
|
|
|
|
|
* type="object",
|
|
|
|
|
* @OA\Property(property="current_page", type="integer", example=1),
|
|
|
|
|
* @OA\Property(property="data", type="array", @OA\Items(ref="#/components/schemas/Sale")),
|
|
|
|
|
* @OA\Property(property="per_page", type="integer", example=20),
|
|
|
|
|
* @OA\Property(property="total", type="integer", example=50)
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
* }
|
|
|
|
|
* )
|
|
|
|
|
* ),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function index() {}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Post(
|
|
|
|
|
* path="/api/v1/sales",
|
|
|
|
|
* tags={"Sales"},
|
|
|
|
|
* summary="매출 등록",
|
|
|
|
|
* description="새로운 매출을 등록합니다. 매출번호는 자동 생성됩니다.",
|
|
|
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
|
|
|
*
|
|
|
|
|
* @OA\RequestBody(
|
|
|
|
|
* required=true,
|
|
|
|
|
*
|
|
|
|
|
* @OA\JsonContent(ref="#/components/schemas/SaleCreateRequest")
|
|
|
|
|
* ),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response=201,
|
|
|
|
|
* description="등록 성공",
|
|
|
|
|
*
|
|
|
|
|
* @OA\JsonContent(
|
|
|
|
|
* allOf={
|
|
|
|
|
*
|
|
|
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
|
|
|
* @OA\Schema(
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(property="data", ref="#/components/schemas/Sale")
|
|
|
|
|
* )
|
|
|
|
|
* }
|
|
|
|
|
* )
|
|
|
|
|
* ),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(response=400, description="잘못된 요청", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function store() {}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Get(
|
|
|
|
|
* path="/api/v1/sales/summary",
|
|
|
|
|
* tags={"Sales"},
|
|
|
|
|
* summary="매출 요약 조회",
|
|
|
|
|
* description="기간별 매출 요약을 조회합니다.",
|
|
|
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
|
|
|
*
|
|
|
|
|
* @OA\Parameter(name="start_date", in="query", description="시작일", @OA\Schema(type="string", format="date")),
|
|
|
|
|
* @OA\Parameter(name="end_date", in="query", description="종료일", @OA\Schema(type="string", format="date")),
|
|
|
|
|
* @OA\Parameter(name="client_id", in="query", description="거래처 ID", @OA\Schema(type="integer")),
|
|
|
|
|
* @OA\Parameter(name="status", in="query", description="상태", @OA\Schema(type="string", enum={"draft","confirmed","invoiced"})),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response=200,
|
|
|
|
|
* description="조회 성공",
|
|
|
|
|
*
|
|
|
|
|
* @OA\JsonContent(
|
|
|
|
|
* allOf={
|
|
|
|
|
*
|
|
|
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
|
|
|
* @OA\Schema(
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(property="data", ref="#/components/schemas/SaleSummary")
|
|
|
|
|
* )
|
|
|
|
|
* }
|
|
|
|
|
* )
|
|
|
|
|
* ),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function summary() {}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Get(
|
|
|
|
|
* path="/api/v1/sales/{id}",
|
|
|
|
|
* tags={"Sales"},
|
|
|
|
|
* summary="매출 상세 조회",
|
|
|
|
|
* description="매출 상세 정보를 조회합니다.",
|
|
|
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
|
|
|
*
|
|
|
|
|
* @OA\Parameter(name="id", in="path", required=true, description="매출 ID", @OA\Schema(type="integer")),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response=200,
|
|
|
|
|
* description="조회 성공",
|
|
|
|
|
*
|
|
|
|
|
* @OA\JsonContent(
|
|
|
|
|
* allOf={
|
|
|
|
|
*
|
|
|
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
|
|
|
* @OA\Schema(
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(property="data", ref="#/components/schemas/Sale")
|
|
|
|
|
* )
|
|
|
|
|
* }
|
|
|
|
|
* )
|
|
|
|
|
* ),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=404, description="매출 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function show() {}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Put(
|
|
|
|
|
* path="/api/v1/sales/{id}",
|
|
|
|
|
* tags={"Sales"},
|
|
|
|
|
* summary="매출 수정",
|
|
|
|
|
* description="매출 정보를 수정합니다. 임시저장(draft) 상태에서만 수정 가능합니다.",
|
|
|
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
|
|
|
*
|
|
|
|
|
* @OA\Parameter(name="id", in="path", required=true, description="매출 ID", @OA\Schema(type="integer")),
|
|
|
|
|
*
|
|
|
|
|
* @OA\RequestBody(
|
|
|
|
|
* required=true,
|
|
|
|
|
*
|
|
|
|
|
* @OA\JsonContent(ref="#/components/schemas/SaleUpdateRequest")
|
|
|
|
|
* ),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response=200,
|
|
|
|
|
* description="수정 성공",
|
|
|
|
|
*
|
|
|
|
|
* @OA\JsonContent(
|
|
|
|
|
* allOf={
|
|
|
|
|
*
|
|
|
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
|
|
|
* @OA\Schema(
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(property="data", ref="#/components/schemas/Sale")
|
|
|
|
|
* )
|
|
|
|
|
* }
|
|
|
|
|
* )
|
|
|
|
|
* ),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(response=400, description="잘못된 요청 또는 수정 불가", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=404, description="매출 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function update() {}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Delete(
|
|
|
|
|
* path="/api/v1/sales/{id}",
|
|
|
|
|
* tags={"Sales"},
|
|
|
|
|
* summary="매출 삭제",
|
|
|
|
|
* description="매출을 삭제합니다. 임시저장(draft) 상태에서만 삭제 가능합니다. (Soft Delete)",
|
|
|
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
|
|
|
*
|
|
|
|
|
* @OA\Parameter(name="id", in="path", required=true, description="매출 ID", @OA\Schema(type="integer")),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response=200,
|
|
|
|
|
* description="삭제 성공",
|
|
|
|
|
*
|
|
|
|
|
* @OA\JsonContent(ref="#/components/schemas/ApiResponse")
|
|
|
|
|
* ),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(response=400, description="삭제 불가", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=404, description="매출 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function destroy() {}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Post(
|
|
|
|
|
* path="/api/v1/sales/{id}/confirm",
|
|
|
|
|
* tags={"Sales"},
|
|
|
|
|
* summary="매출 확정",
|
|
|
|
|
* description="매출을 확정합니다. 임시저장(draft) 상태에서만 확정 가능합니다.",
|
|
|
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
|
|
|
*
|
|
|
|
|
* @OA\Parameter(name="id", in="path", required=true, description="매출 ID", @OA\Schema(type="integer")),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response=200,
|
|
|
|
|
* description="확정 성공",
|
|
|
|
|
*
|
|
|
|
|
* @OA\JsonContent(
|
|
|
|
|
* allOf={
|
|
|
|
|
*
|
|
|
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
|
|
|
* @OA\Schema(
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(property="data", ref="#/components/schemas/Sale")
|
|
|
|
|
* )
|
|
|
|
|
* }
|
|
|
|
|
* )
|
|
|
|
|
* ),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(response=400, description="확정 불가", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=404, description="매출 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function confirm() {}
|
feat: Phase 5 API 개발 완료 (사용자 초대, 알림설정, 계정관리, 거래명세서)
5.1 사용자 초대 기능:
- UserInvitation 마이그레이션, 모델, 서비스, 컨트롤러, Swagger
- 초대 발송/수락/취소/재발송 API
5.2 알림설정 확장:
- NotificationSetting 마이그레이션, 모델, 서비스, 컨트롤러, Swagger
- 채널별/유형별 알림 설정 관리
5.3 계정정보 수정 API:
- 회원탈퇴, 사용중지, 약관동의 관리
- AccountService, AccountController, Swagger
5.4 매출 거래명세서 API:
- 거래명세서 조회/발행/이메일발송
- SaleService 확장, Swagger 문서화
2025-12-19 14:52:53 +09:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Get(
|
|
|
|
|
* path="/api/v1/sales/{id}/statement",
|
|
|
|
|
* tags={"Sales"},
|
|
|
|
|
* summary="거래명세서 조회",
|
|
|
|
|
* description="매출에 대한 거래명세서 정보를 조회합니다.",
|
|
|
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
|
|
|
*
|
|
|
|
|
* @OA\Parameter(name="id", in="path", required=true, description="매출 ID", @OA\Schema(type="integer")),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response=200,
|
|
|
|
|
* description="조회 성공",
|
|
|
|
|
*
|
|
|
|
|
* @OA\JsonContent(
|
|
|
|
|
* allOf={
|
|
|
|
|
*
|
|
|
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
|
|
|
* @OA\Schema(
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(property="data", ref="#/components/schemas/SaleStatement")
|
|
|
|
|
* )
|
|
|
|
|
* }
|
|
|
|
|
* )
|
|
|
|
|
* ),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=404, description="매출 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function getStatement() {}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Post(
|
|
|
|
|
* path="/api/v1/sales/{id}/statement/issue",
|
|
|
|
|
* tags={"Sales"},
|
|
|
|
|
* summary="거래명세서 발행",
|
|
|
|
|
* description="매출에 대한 거래명세서를 발행합니다. 확정(confirmed) 상태의 매출만 발행 가능합니다.",
|
|
|
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
|
|
|
*
|
|
|
|
|
* @OA\Parameter(name="id", in="path", required=true, description="매출 ID", @OA\Schema(type="integer")),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response=200,
|
|
|
|
|
* description="발행 성공",
|
|
|
|
|
*
|
|
|
|
|
* @OA\JsonContent(
|
|
|
|
|
* allOf={
|
|
|
|
|
*
|
|
|
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
|
|
|
* @OA\Schema(
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(property="data", ref="#/components/schemas/SaleStatementIssueResponse")
|
|
|
|
|
* )
|
|
|
|
|
* }
|
|
|
|
|
* )
|
|
|
|
|
* ),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(response=400, description="발행 불가 (미확정 상태)", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=404, description="매출 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function issueStatement() {}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Post(
|
|
|
|
|
* path="/api/v1/sales/{id}/statement/send",
|
|
|
|
|
* tags={"Sales"},
|
|
|
|
|
* summary="거래명세서 이메일 발송",
|
|
|
|
|
* description="거래명세서를 이메일로 발송합니다. 이메일 미입력 시 거래처 이메일로 발송됩니다.",
|
|
|
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
|
|
|
*
|
|
|
|
|
* @OA\Parameter(name="id", in="path", required=true, description="매출 ID", @OA\Schema(type="integer")),
|
|
|
|
|
*
|
|
|
|
|
* @OA\RequestBody(
|
|
|
|
|
* required=false,
|
|
|
|
|
*
|
|
|
|
|
* @OA\JsonContent(ref="#/components/schemas/SaleStatementSendRequest")
|
|
|
|
|
* ),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response=200,
|
|
|
|
|
* description="발송 성공",
|
|
|
|
|
*
|
|
|
|
|
* @OA\JsonContent(
|
|
|
|
|
* allOf={
|
|
|
|
|
*
|
|
|
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
|
|
|
* @OA\Schema(
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(property="data", ref="#/components/schemas/SaleStatementSendResponse")
|
|
|
|
|
* )
|
|
|
|
|
* }
|
|
|
|
|
* )
|
|
|
|
|
* ),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(response=400, description="발송 불가 (이메일 없음)", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=404, description="매출 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function sendStatement() {}
|
2026-01-19 20:53:36 +09:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Post(
|
|
|
|
|
* path="/api/v1/sales/bulk-issue-statement",
|
|
|
|
|
* tags={"Sales"},
|
|
|
|
|
* summary="거래명세서 일괄 발행",
|
|
|
|
|
* description="여러 매출에 대한 거래명세서를 일괄 발행합니다. 확정(confirmed) 상태이면서 아직 발행되지 않은 건만 발행됩니다. 각 건별로 성공/실패가 처리됩니다.",
|
|
|
|
|
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
|
|
|
|
|
*
|
|
|
|
|
* @OA\RequestBody(
|
|
|
|
|
* required=true,
|
|
|
|
|
*
|
|
|
|
|
* @OA\JsonContent(ref="#/components/schemas/SaleBulkIssueStatementRequest")
|
|
|
|
|
* ),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response=200,
|
|
|
|
|
* description="일괄 발행 처리 완료",
|
|
|
|
|
*
|
|
|
|
|
* @OA\JsonContent(
|
|
|
|
|
* allOf={
|
|
|
|
|
*
|
|
|
|
|
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
|
|
|
|
|
* @OA\Schema(
|
|
|
|
|
*
|
|
|
|
|
* @OA\Property(property="data", ref="#/components/schemas/SaleBulkIssueStatementResponse")
|
|
|
|
|
* )
|
|
|
|
|
* }
|
|
|
|
|
* )
|
|
|
|
|
* ),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(response=400, description="잘못된 요청", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
|
|
|
|
|
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function bulkIssueStatement() {}
|
feat: 매출/매입 관리 API 구현
- 매출(Sale) 및 매입(Purchase) CRUD API 구현
- 문서번호 자동 생성 (SL/PU + YYYYMMDD + 시퀀스)
- 상태 관리 (draft → confirmed → invoiced)
- 확정(confirm) 및 요약(summary) 기능 추가
- BelongsToTenant, SoftDeletes 적용
- Swagger API 문서 작성 완료
추가된 파일:
- 마이그레이션: sales, purchases 테이블
- 모델: Sale, Purchase
- 서비스: SaleService, PurchaseService
- 컨트롤러: SaleController, PurchaseController
- FormRequest: Store/Update 4개
- Swagger: SaleApi.php, PurchaseApi.php
API 엔드포인트 (14개):
- GET/POST /v1/sales, /v1/purchases
- GET/PUT/DELETE /v1/{sales,purchases}/{id}
- POST /v1/{sales,purchases}/{id}/confirm
- GET /v1/{sales,purchases}/summary
2025-12-17 22:14:48 +09:00
|
|
|
}
|