Skip to content
This repository has been archived by the owner on Mar 9, 2024. It is now read-only.

Commit

Permalink
example: send-message 예제 업데이트
Browse files Browse the repository at this point in the history
  • Loading branch information
parksb committed Jan 4, 2020
1 parent 5083399 commit 28e64d0
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 52 deletions.
9 changes: 6 additions & 3 deletions examples/send-message/.env-sample
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ USER_ID="user@mail.com"
USER_PWD="password"

TRAINEE_NAME="박뫄뫄"
UNIT_NAME="00연대"
ENTER_DATE="20190000"
TRAINEE_BIRTH="20190000"
TRAINEE_BIRTH="20011129"

CLASS_NAME="예비군인/훈련병"
GROUP_NAME="육군"
UNIT_NAME="28사단"
ENTER_DATE="20200829"
34 changes: 18 additions & 16 deletions examples/send-message/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,28 @@ const thecamp = require('the-camp-lib');
const id = process.env.USER_ID || '';
const password = process.env.USER_PWD || '';

const traineeName = process.env.TRAINEE_NAME || '';
const unitName = process.env.UNIT_NAME || '';
const name = process.env.TRAINEE_NAME || '';
const birth = process.env.TRAINEE_BIRTH || '';
const enterDate = process.env.ENTER_DATE || '';
const birth = Number(process.env.TRAINEE_BIRTH || '');

const cookies = await thecamp.login(id, password);
const [group] = await thecamp.fetchGroups(cookies, unitName, enterDate);
const className = process.env.CLASS_NAME || '';
const groupName = process.env.GROUP_NAME || '';
const unitName = process.env.UNIT_NAME || '';

const trainee = {
const soldier = new thecamp.Soldier(
name,
birth,
traineeName,
unitCode: group.unitCode,
groupId: group.groupId,
relationship: thecamp.Relationship.FRIEND,
};
enterDate,
thecamp.SoldierClassName[className],
thecamp.SoldierGroupName[groupName],
thecamp.SoldierUnitName[unitName],
thecamp.SoldierRelationship.FRIEND,
);

const cookies = await thecamp.login(id, password);
await thecamp.addSoldier(cookies, soldier);
const [trainee] = await thecamp.fetchSoldiers(cookies, soldier);

const message = {
title: 'Test title',
content: 'Test content',
};
const message = new thecamp.Message('Title', 'Content', trainee.getTraineeMgrSeq());

await thecamp.sendMessage(cookies, trainee, message);
})();
60 changes: 30 additions & 30 deletions examples/send-message/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/send-message/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"license": "MIT",
"dependencies": {
"dotenv": "^8.1.0",
"the-camp-lib": "^1.2.0"
"the-camp-lib": "^2.0.1"
}
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "the-camp-lib",
"version": "2.0.0",
"version": "2.0.1",
"description": "대국민 국군 소통 서비스 더 캠프 비공식 라이브러리",
"homepage": "https://github.com/ParkSB/the-camp-lib/",
"repository": {
Expand Down

0 comments on commit 28e64d0

Please sign in to comment.